dev: bit nicer HMR
This commit is contained in:
parent
bcbef693cc
commit
aa586a98e5
|
@ -57,8 +57,14 @@ onmessage = async (event) => {
|
||||||
})();
|
})();
|
||||||
|
|
||||||
if (import.meta.hot) {
|
if (import.meta.hot) {
|
||||||
import.meta.hot.accept('../engine/engine.js', async () => {
|
import.meta.hot.accept('../../engine.js', async ({default: Engine}) => {
|
||||||
await engine.disconnectPlayer(0, 0);
|
await engine.disconnectPlayer(0);
|
||||||
|
if (Engine.prototype.createHomestead.toString() !== engine.createHomestead.toString()) {
|
||||||
|
delete engine.ecses['homesteads/0'];
|
||||||
|
await engine.server.removeData('homesteads/0');
|
||||||
|
const newEngine = new Engine(WorkerServer);
|
||||||
|
await newEngine.createHomestead(0);
|
||||||
|
}
|
||||||
postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'}));
|
postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'}));
|
||||||
close();
|
close();
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user