diff --git a/app/ecs-components/index.js b/app/ecs-components/index.js index 355e489..de1aeb4 100644 --- a/app/ecs-components/index.js +++ b/app/ecs-components/index.js @@ -17,7 +17,7 @@ for (const componentName in specificationsAndOrDecorators) { if ('function' === typeof specificationOrDecorator) { Components[componentName] = specificationOrDecorator( class Decorated extends Arbitrary { - static name = componentName; + static componentName = componentName; } ); if (!Components[componentName]) { @@ -26,7 +26,7 @@ for (const componentName in specificationsAndOrDecorators) { } else { Components[componentName] = class Component extends Arbitrary { - static name = componentName; + static componentName = componentName; static schema = new Schema({ type: 'object', properties: specificationOrDecorator, diff --git a/app/ecs/base.js b/app/ecs/base.js index 2acaff7..4e44d64 100644 --- a/app/ecs/base.js +++ b/app/ecs/base.js @@ -83,7 +83,7 @@ export default class Base { } markChange(entityId, key, value) { - this.ecs.markChange(entityId, {[this.constructor.name]: {[key]: value}}) + this.ecs.markChange(entityId, {[this.constructor.componentName]: {[key]: value}}) } mergeDiff(original, update) { diff --git a/app/net/server/worker.js b/app/net/server/worker.js index d2564b5..1354e49 100644 --- a/app/net/server/worker.js +++ b/app/net/server/worker.js @@ -51,8 +51,10 @@ onmessage = async (event) => { postMessage(encode({type: 'ConnectionStatus', payload: 'connected'})); })(); -import.meta.hot.accept('../../engine/engine.js', async () => { - await engine.disconnectPlayer(0, 0); - postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'})); - close(); -}); +if (import.meta.hot) { + import.meta.hot.accept('../../engine/engine.js', async () => { + await engine.disconnectPlayer(0, 0); + postMessage(encode({type: 'ConnectionStatus', payload: 'aborted'})); + close(); + }); +}