fix: to each their own
This commit is contained in:
parent
3d7b0fc14e
commit
52f19b1d89
|
@ -168,16 +168,18 @@ export default async function createHomestead(id) {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
collisionStartScript: `
|
collisionStartScript: `
|
||||||
ecs.switchEcs(
|
if (other.Player) {
|
||||||
other,
|
ecs.switchEcs(
|
||||||
'town',
|
other,
|
||||||
{
|
'town',
|
||||||
Position: {
|
{
|
||||||
x: 940,
|
Position: {
|
||||||
y: 480,
|
x: 940,
|
||||||
|
y: 480,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
);
|
||||||
);
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|
|
@ -38,16 +38,18 @@ export default async function createTown() {
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
collisionStartScript: `
|
collisionStartScript: `
|
||||||
ecs.switchEcs(
|
if (other.Player) {
|
||||||
other,
|
ecs.switchEcs(
|
||||||
['homesteads', '0'].join('/'),
|
other,
|
||||||
{
|
['homesteads', other.Player.id].join('/'),
|
||||||
Position: {
|
{
|
||||||
x: 20,
|
Position: {
|
||||||
y: 438,
|
x: 20,
|
||||||
|
y: 438,
|
||||||
|
},
|
||||||
},
|
},
|
||||||
},
|
);
|
||||||
);
|
}
|
||||||
`,
|
`,
|
||||||
},
|
},
|
||||||
Position: {x: 952, y: 480},
|
Position: {x: 952, y: 480},
|
||||||
|
|
|
@ -63,6 +63,7 @@ export default class Engine {
|
||||||
if (entity !== connectedPlayer.entity) {
|
if (entity !== connectedPlayer.entity) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
const {id} = entity.Player;
|
||||||
// remove entity link to connection to start queueing actions and pause updates
|
// remove entity link to connection to start queueing actions and pause updates
|
||||||
delete connectedPlayer.entity;
|
delete connectedPlayer.entity;
|
||||||
// forget previous state
|
// forget previous state
|
||||||
|
@ -93,6 +94,7 @@ export default class Engine {
|
||||||
}
|
}
|
||||||
// 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
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -226,11 +228,12 @@ export default class Engine {
|
||||||
await this.loadEcs(entityJson.Ecs.path);
|
await this.loadEcs(entityJson.Ecs.path);
|
||||||
}
|
}
|
||||||
const ecs = this.ecses[entityJson.Ecs.path];
|
const ecs = this.ecses[entityJson.Ecs.path];
|
||||||
const entity = await ecs.create(entityJson);
|
const entity = ecs.get(await ecs.create(entityJson));
|
||||||
|
entity.Player.id = id
|
||||||
this.connectedPlayers.set(
|
this.connectedPlayers.set(
|
||||||
connection,
|
connection,
|
||||||
{
|
{
|
||||||
entity: ecs.get(entity),
|
entity,
|
||||||
id,
|
id,
|
||||||
memory: {
|
memory: {
|
||||||
chunks: new Map(),
|
chunks: new Map(),
|
||||||
|
|
Loading…
Reference in New Issue
Block a user