Only save player data on entity remove if the player is not dead.

This commit is contained in:
Holly Stubbs 2023-11-13 00:00:17 +00:00
parent 1a08b5e991
commit a5910abd86
Signed by: tgpholly
GPG key ID: B8583C4B7D18119E

View file

@ -74,11 +74,13 @@ export class World {
this.players.remove(entity.entityId); this.players.remove(entity.entityId);
if (!entity.isDead) {
const writer = createWriter(Endian.BE); const writer = createWriter(Endian.BE);
entity.toSave(writer); entity.toSave(writer);
this.saveManager.writePlayerSaveToDisk(entity.username, writer); this.saveManager.writePlayerSaveToDisk(entity.username, writer);
} }
}
this.entites.remove(entity.entityId); this.entites.remove(entity.entityId);
this.sendToNearbyClients(entity, new PacketDestroyEntity(entity.entityId).writeData()); this.sendToNearbyClients(entity, new PacketDestroyEntity(entity.entityId).writeData());