diff --git a/packages/behavior/src/traits/behaved.js b/packages/behavior/src/traits/behaved.js index 5fd9501..b6df394 100644 --- a/packages/behavior/src/traits/behaved.js +++ b/packages/behavior/src/traits/behaved.js @@ -86,8 +86,8 @@ export default (latus) => class Behaved extends decorate(Trait) { this.#routines = undefined; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#context = new Context( { entity: [this.entity, 'entity'], diff --git a/packages/entity/src/resources/entity-list.js b/packages/entity/src/resources/entity-list.js index 75540bc..cb8509a 100644 --- a/packages/entity/src/resources/entity-list.js +++ b/packages/entity/src/resources/entity-list.js @@ -98,7 +98,7 @@ export default (latus) => class EntityList extends decorate(JsonResource) { } async load(json = []) { - super.load(json); + await super.load(json); const {fromResourceType: {Entity}} = resource(latus); const entityInstances = await Promise.all(json.map((entity) => Entity.load(entity))); for (let i = 0; i < entityInstances.length; i++) { diff --git a/packages/entity/src/traits/alive.js b/packages/entity/src/traits/alive.js index 0087de2..1a16b61 100644 --- a/packages/entity/src/traits/alive.js +++ b/packages/entity/src/traits/alive.js @@ -160,8 +160,8 @@ export default (latus) => class Alive extends decorate(Trait) { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#context = new Context( { entity: [this.entity, 'entity'], diff --git a/packages/entity/src/traits/listed.js b/packages/entity/src/traits/listed.js index 221423f..af2c5ff 100644 --- a/packages/entity/src/traits/listed.js +++ b/packages/entity/src/traits/listed.js @@ -64,8 +64,8 @@ export default () => class Listed extends Trait { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.entity.list = null; } diff --git a/packages/entity/src/traits/perishable.js b/packages/entity/src/traits/perishable.js index e158338..ac5c1d9 100644 --- a/packages/entity/src/traits/perishable.js +++ b/packages/entity/src/traits/perishable.js @@ -30,8 +30,8 @@ export default () => class Perishable extends decorate(Trait) { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#ttl = this.params.ttl; } diff --git a/packages/entity/src/traits/positioned.js b/packages/entity/src/traits/positioned.js index cd536a3..89cd39a 100644 --- a/packages/entity/src/traits/positioned.js +++ b/packages/entity/src/traits/positioned.js @@ -74,8 +74,8 @@ export default () => class Positioned extends decorate(Trait) { } } - load(json) { - super.load(json); + async load(json) { + await super.load(json); const {x, y} = this.state; this.trackedPosition = [x, y]; this.entity.position[0] = x; diff --git a/packages/graphics/src/traits/pictured.js b/packages/graphics/src/traits/pictured.js index b6dcc0c..83a6b8d 100644 --- a/packages/graphics/src/traits/pictured.js +++ b/packages/graphics/src/traits/pictured.js @@ -144,7 +144,7 @@ export default (latus) => class Pictured extends decorate(Trait) { } async load(json = {}) { - super.load(json); + await super.load(json); if (Object.keys(this.params.images).length > 0) { const {fromResourceType: {Image}} = resource(latus); const sprites = await mapValuesAsync( diff --git a/packages/graphics/src/traits/visible.js b/packages/graphics/src/traits/visible.js index 1fa8df5..7021b28 100644 --- a/packages/graphics/src/traits/visible.js +++ b/packages/graphics/src/traits/visible.js @@ -195,8 +195,8 @@ export default () => class Visible extends decorate(Trait) { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); if ('client' === process.env.SIDE) { const {filter} = this.params; if (filter) { diff --git a/packages/physics/src/traits/collider.js b/packages/physics/src/traits/collider.js index 358eb89..e8d9748 100644 --- a/packages/physics/src/traits/collider.js +++ b/packages/physics/src/traits/collider.js @@ -8,7 +8,7 @@ const decorate = compose( StateProperty('isColliding'), ); -export default () => class Collider extends decorate(Trait) { +export default (latus) => class Collider extends decorate(Trait) { #collidesWithGroups = []; @@ -217,8 +217,8 @@ export default () => class Collider extends decorate(Trait) { return this.#isSensor; } - load(load) { - super.load(load); + async load(load) { + await super.load(load); const { collidesWithGroups, collisionEndActions, @@ -238,10 +238,13 @@ export default () => class Collider extends decorate(Trait) { } pushCollisionTickingPromise(actions, other) { - const context = new Context({ - entity: [this.entity, 'entity'], - other: [other, 'entity'], - }); + const context = new Context( + { + entity: [this.entity, 'entity'], + other: [other, 'entity'], + }, + latus, + ); this.entity.addTickingPromise(actions.tickingPromise(context)); } diff --git a/packages/physics/src/traits/emitted.js b/packages/physics/src/traits/emitted.js index 2051066..ef2305a 100644 --- a/packages/physics/src/traits/emitted.js +++ b/packages/physics/src/traits/emitted.js @@ -138,8 +138,8 @@ export default () => class Emitted extends decorate(Trait) { return !!this.params.transient; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#alphaStart = new Range(this.params.alpha.start); this.#alphaEnd = new Range(this.params.alpha.end); this.#force = new Vector.Range(this.params.force); diff --git a/packages/physics/src/traits/shaped.js b/packages/physics/src/traits/shaped.js index bdba669..768a21b 100644 --- a/packages/physics/src/traits/shaped.js +++ b/packages/physics/src/traits/shaped.js @@ -56,8 +56,8 @@ export default () => class Shaped extends decorate(Trait) { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#shape = shapeFromJSON(this.params.shape); } diff --git a/packages/resource/test/resource.js b/packages/resource/test/resource.js index 13b6703..68fe786 100644 --- a/packages/resource/test/resource.js +++ b/packages/resource/test/resource.js @@ -9,15 +9,15 @@ Resource.root = 'test/fixtures'; JsonResource.root = 'test/fixtures'; class ResourceSubclass extends Resource { - load(buffer) { - super.load(buffer); + async load(buffer) { + await super.load(buffer); this.buffer = buffer; } } class JsonResourceSubclass extends JsonResource { - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.json = json; } } diff --git a/packages/sound/src/resources/sound.js b/packages/sound/src/resources/sound.js index 58a9e97..35eab95 100644 --- a/packages/sound/src/resources/sound.js +++ b/packages/sound/src/resources/sound.js @@ -17,7 +17,7 @@ export default () => class Sound extends JsonResource { } async load(json = {}) { - super.load(json); + await super.load(json); const {interval = 0, volume = 1} = json; this.interval = interval; this.originalVolume = volume; diff --git a/packages/sound/src/traits/audible.js b/packages/sound/src/traits/audible.js index dde6165..794ee0d 100644 --- a/packages/sound/src/traits/audible.js +++ b/packages/sound/src/traits/audible.js @@ -64,8 +64,8 @@ export default (latus) => class Audible extends Trait { return extended; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); if (json.sounds) { this.#sounds = json.sounds; } diff --git a/packages/timing/src/traits/animated.js b/packages/timing/src/traits/animated.js index ac614eb..60a6725 100644 --- a/packages/timing/src/traits/animated.js +++ b/packages/timing/src/traits/animated.js @@ -200,7 +200,7 @@ export default (latus) => class Animated extends decorate(Trait) { } async load(json) { - super.load(json); + await super.load(json); if (Object.keys(json.params.animations).length > 0) { const {fromResourceType: {Animation}} = resource(latus); const animations = await mapValuesAsync( diff --git a/packages/topdown/src/resources/layer.js b/packages/topdown/src/resources/layer.js index 6763373..3fa5803 100644 --- a/packages/topdown/src/resources/layer.js +++ b/packages/topdown/src/resources/layer.js @@ -91,7 +91,7 @@ export default (latus) => class Layer extends decorate(JsonResource) { } async load(json = {}) { - super.load(json); + await super.load(json); const { entities, tiles, diff --git a/packages/topdown/src/resources/layers.js b/packages/topdown/src/resources/layers.js index a3a9df9..3d4fa6f 100644 --- a/packages/topdown/src/resources/layers.js +++ b/packages/topdown/src/resources/layers.js @@ -82,7 +82,7 @@ export default (latus) => class Layers extends decorate(JsonResource) { } async load(json = []) { - super.load(json); + await super.load(json); this.removeAllLayers(); const {fromResourceType: {Layer}} = resource(latus); const layers = await Promise.all(json.map((layer) => Layer.load(layer))); diff --git a/packages/topdown/src/resources/room.js b/packages/topdown/src/resources/room.js index 25e20bf..3320547 100644 --- a/packages/topdown/src/resources/room.js +++ b/packages/topdown/src/resources/room.js @@ -64,7 +64,7 @@ export default (latus) => class Room extends decorate(JsonResource) { } async load(json = {}) { - super.load(json); + await super.load(json); const {layers, size} = json; if (size) { this.size = size; diff --git a/packages/topdown/src/resources/tileset.js b/packages/topdown/src/resources/tileset.js index 4945e3a..956ef69 100644 --- a/packages/topdown/src/resources/tileset.js +++ b/packages/topdown/src/resources/tileset.js @@ -38,7 +38,7 @@ export default () => class Tileset extends decorate(JsonResource) { } async load(json = {}) { - super.load(json); + await super.load(json); const {imageUri, tileSize} = json; if (imageUri) { this.image = await Image.load(imageUri); diff --git a/packages/topdown/src/traits/followed.js b/packages/topdown/src/traits/followed.js index bb2e7de..d480763 100644 --- a/packages/topdown/src/traits/followed.js +++ b/packages/topdown/src/traits/followed.js @@ -72,8 +72,8 @@ export default () => class Followed extends Trait { }; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.#camera.viewSize = this.params.viewSize; this.updatePosition(); this.onRoomSizeChanged(); diff --git a/packages/topdown/src/traits/layered.js b/packages/topdown/src/traits/layered.js index c57abc0..b008516 100644 --- a/packages/topdown/src/traits/layered.js +++ b/packages/topdown/src/traits/layered.js @@ -41,8 +41,8 @@ export default () => class Layered extends Trait { return this.#tileOffset; } - load(json) { - super.load(json); + async load(json) { + await super.load(json); this.entity.layer = null; this.setCurrentTileFromLayer(); }