fix: control transfer
This commit is contained in:
parent
a54aed9b89
commit
fc96f637ff
|
@ -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;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue
Block a user