diff --git a/app/server/engine.js b/app/server/engine.js index 1d78259..977d486 100644 --- a/app/server/engine.js +++ b/app/server/engine.js @@ -90,7 +90,13 @@ export default class Engine { // dump entity state with updates for the transition const dumped = { ...entity.toJSON(), - Controlled: entity.Controlled, + // manually transfer control + Controlled: { + moveUp: entity.Controlled.moveUp, + moveRight: entity.Controlled.moveRight, + moveDown: entity.Controlled.moveDown, + moveLeft: entity.Controlled.moveLeft, + }, Ecs: {path}, ...updates, }; @@ -104,7 +110,7 @@ export default class Engine { Promise.all(promises).then(async () => { // recreate the entity in the new ECS and again associate it with the connection connectedPlayer.entity = engine.ecses[path].get(await engine.ecses[path].create(dumped)); - connectedPlayer.entity.Player.id = id + connectedPlayer.entity.Player.id = id; }); } }