refactor: immediate player destroy

This commit is contained in:
cha0s 2024-07-21 19:24:22 -05:00
parent 4278ee7675
commit 3809bf98e6

View File

@ -88,7 +88,7 @@ export default class Engine {
...updates, ...updates,
}; };
// remove from old ECS // remove from old ECS
this.destroy(entity.id); this.destroyImmediately(entity.id);
// load if necessary // load if necessary
if (!engine.ecses[path]) { if (!engine.ecses[path]) {
await engine.loadEcs(path); await engine.loadEcs(path);
@ -230,7 +230,7 @@ export default class Engine {
const {entity, id} = connectedPlayer; const {entity, id} = connectedPlayer;
const ecs = this.ecses[entity.Ecs.path]; const ecs = this.ecses[entity.Ecs.path];
await this.savePlayer(id, entity); await this.savePlayer(id, entity);
ecs.destroy(entity.id); ecs.destroyImmediately(entity.id);
this.connectedPlayers.delete(connection); this.connectedPlayers.delete(connection);
this.incomingActions.delete(connection); this.incomingActions.delete(connection);
} }
@ -322,7 +322,6 @@ export default class Engine {
stop() { stop() {
clearTimeout(this.handle); clearTimeout(this.handle);
this.handle = undefined; this.handle = undefined;
this.tick(0);
} }
tick(elapsed) { tick(elapsed) {