mirror of
https://gitea.wildfiregames.com/0ad/0ad.git
synced 2026-06-20 23:24:16 +00:00
Always delete metadata when destroying entities
On newly deserialized clients there is no property for the destroied entities. Because of that the metadata of the entity wasn't remembered in the event and wasn't destroied.
This commit is contained in:
@@ -237,9 +237,6 @@ SharedScript.prototype.ApplyEntitiesDelta = function(state)
|
||||
|
||||
for (const evt of state.events.Destroy)
|
||||
{
|
||||
if (!this._entities.has(evt.entity))
|
||||
continue;// probably should remove the event.
|
||||
|
||||
if (foundationFinished[evt.entity])
|
||||
evt.SuccessfulFoundation = true;
|
||||
|
||||
@@ -251,9 +248,12 @@ SharedScript.prototype.ApplyEntitiesDelta = function(state)
|
||||
evt.metadata[player] = this._entityMetadata[player][evt.entity];
|
||||
|
||||
const entity = this._entities.get(evt.entity);
|
||||
for (const entCol of this._entityCollections.values())
|
||||
entCol.removeEnt(entity);
|
||||
this.entities.removeEnt(entity);
|
||||
if (entity)
|
||||
{
|
||||
for (const entCol of this._entityCollections.values())
|
||||
entCol.removeEnt(entity);
|
||||
this.entities.removeEnt(entity);
|
||||
}
|
||||
|
||||
this._entities.delete(evt.entity);
|
||||
this._entitiesModifications.delete(evt.entity);
|
||||
|
||||
Reference in New Issue
Block a user