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:
phosit 2025-09-13 17:50:53 +02:00
parent 08340ca18a
commit 7b50e32b28
No known key found for this signature in database
GPG key ID: C9430B600671C268

View file

@ -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);