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
|
// dump entity state with updates for the transition
|
||||||
const dumped = {
|
const dumped = {
|
||||||
...entity.toJSON(),
|
...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},
|
Ecs: {path},
|
||||||
...updates,
|
...updates,
|
||||||
};
|
};
|
||||||
|
@ -104,7 +110,7 @@ export default class Engine {
|
||||||
Promise.all(promises).then(async () => {
|
Promise.all(promises).then(async () => {
|
||||||
// recreate the entity in the new ECS and again associate it with the connection
|
// 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 = 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