diff --git a/packages/app/src/hooks/use-room.js b/packages/app/src/hooks/use-room.js index 746801d..8fd3bc4 100644 --- a/packages/app/src/hooks/use-room.js +++ b/packages/app/src/hooks/use-room.js @@ -29,7 +29,7 @@ export default () => { return undefined; } const onCreated = (created) => { - const {Room} = flecks.avocado.Resources; + const {Room} = flecks.avocado.resource.Resources; switch (created.constructor.resourceId) { // Track room. case Room.resourceId: { diff --git a/packages/combat/src/traits/harmful.js b/packages/combat/src/traits/harmful.js index c764cb9..3db73b2 100644 --- a/packages/combat/src/traits/harmful.js +++ b/packages/combat/src/traits/harmful.js @@ -70,7 +70,7 @@ export default (flecks) => class Harmful extends decorate(Trait) { listeners() { const listeners = { harming: async (harm, harmed) => { - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; this.entity.addTickingPromise(Script.loadTickingPromise(this.params.harmingScript, { ...this.entity.contextOrDefault, harm, diff --git a/packages/combat/src/traits/vulnerable.js b/packages/combat/src/traits/vulnerable.js index 49e2584..ee6746b 100644 --- a/packages/combat/src/traits/vulnerable.js +++ b/packages/combat/src/traits/vulnerable.js @@ -192,7 +192,7 @@ export default (flecks) => class Vulnerable extends Trait { } interactions(harmed, harm) { - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; const {affinity, from} = harm; const interactions = flecks.get('$humus/combat.interactions'); flatten( @@ -278,7 +278,7 @@ export default (flecks) => class Vulnerable extends Trait { }, harmed: async (harm, from) => { - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; const script = await Script.load(this.params.harmedScript, { entity: this.entity, from, diff --git a/packages/core/src/traits/item.js b/packages/core/src/traits/item.js index 7351eca..5799459 100644 --- a/packages/core/src/traits/item.js +++ b/packages/core/src/traits/item.js @@ -55,7 +55,7 @@ export default (flecks) => class Item extends decorate(Trait) { use: () => { const {cooldown} = this.params; - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; const promises = [Script.loadTickingPromise(this.params.useScript, this.entity.context)]; if (cooldown > 0) { promises.push(new Promise((resolve) => { diff --git a/packages/farm/src/traits/plant.js b/packages/farm/src/traits/plant.js index d23c3c0..a332f7d 100644 --- a/packages/farm/src/traits/plant.js +++ b/packages/farm/src/traits/plant.js @@ -65,7 +65,7 @@ export default (flecks) => class Plant extends decorate(Trait) { async load(json) { await super.load(json); - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; const {growthCheck, growthScript} = this.params; if (growthCheck) { this.growthCheck = await Script.load(growthCheck, { diff --git a/packages/farm/src/traits/tool.js b/packages/farm/src/traits/tool.js index 9c2f514..bc2c2d2 100644 --- a/packages/farm/src/traits/tool.js +++ b/packages/farm/src/traits/tool.js @@ -180,7 +180,7 @@ export default (flecks) => class Tool extends Trait { } this.calculateTargets(); const promises = this.$$targets.map((target) => { - const {Script} = flecks.avocado.Resources; + const {Script} = flecks.avocado.resource.Resources; const context = this.createTargetContext(target); return Script.loadTickingPromise(this.params.toolScript, context); }); diff --git a/packages/inventory/src/traits/receptacle.js b/packages/inventory/src/traits/receptacle.js index e919488..e6644f3 100644 --- a/packages/inventory/src/traits/receptacle.js +++ b/packages/inventory/src/traits/receptacle.js @@ -48,7 +48,7 @@ export default (flecks) => class Receptacle extends decorate(Trait) { break; } case 'TraitUpdateReceptacleItemFull': { - const {Entity} = flecks.avocado.Resources; + const {Entity} = flecks.avocado.resource.Resources; this.entity.addItemToSlot(await Entity.load(packet.data.json), packet.data.slotIndex); break; } @@ -195,7 +195,7 @@ export default (flecks) => class Receptacle extends decorate(Trait) { } async load(json) { - const {Entity} = flecks.avocado.Resources; + const {Entity} = flecks.avocado.resource.Resources; await super.load(json); await Promise.all(Object.entries(this.params.slots).map(async ([slotIndex, slotSpec]) => { const item = await Entity.load({extends: slotSpec.extends}); diff --git a/packages/universe/src/server/gen/alpha.js b/packages/universe/src/server/gen/alpha.js index dda3db2..b2545ff 100644 --- a/packages/universe/src/server/gen/alpha.js +++ b/packages/universe/src/server/gen/alpha.js @@ -56,7 +56,7 @@ noiseSeed(seed); Plains.generate(); export default async (room, flecks) => { - const {Entity} = flecks.avocado.Resources; + const {Entity} = flecks.avocado.resource.Resources; room.tiles[0].stampAt( [0, 0, w, h], Plains.matrix, diff --git a/packages/universe/src/server/gen/player-entity.js b/packages/universe/src/server/gen/player-entity.js index 8b16083..298cc7f 100644 --- a/packages/universe/src/server/gen/player-entity.js +++ b/packages/universe/src/server/gen/player-entity.js @@ -1,5 +1,5 @@ const createPlayerEntity = async (flecks, name) => { - const {Entity} = flecks.avocado.Resources; + const {Entity} = flecks.avocado.resource.Resources; const entity = await Entity.load({ extends: '/player/index.entity.json', traits: {Named: {state: {name}}}, diff --git a/packages/universe/src/server/gen/player-room.js b/packages/universe/src/server/gen/player-room.js index cd4c3fe..655043f 100644 --- a/packages/universe/src/server/gen/player-room.js +++ b/packages/universe/src/server/gen/player-room.js @@ -1,5 +1,5 @@ const createPlayerRoom = async (flecks) => { - const {Room} = flecks.avocado.Resources; + const {Room} = flecks.avocado.resource.Resources; const room = await Room.load({extends: '/player/index.room.json'}); flecks.invoke('@humus/universe.player.room', room); return room; diff --git a/packages/universe/src/server/universe/index.js b/packages/universe/src/server/universe/index.js index 295be7b..0677dd7 100644 --- a/packages/universe/src/server/universe/index.js +++ b/packages/universe/src/server/universe/index.js @@ -80,7 +80,7 @@ export default class Universe { async createEntity(user) { const playerPath = join(this.$$root, 'players', `${user.id}`); - const {Entity} = this.$$flecks.avocado.Resources; + const {Entity} = this.$$flecks.avocado.resource.Resources; await mkdir(playerPath, {recursive: true}); const entity = await createPlayerEntity(this.$$flecks, user.email); entity.currentRoom = `/${join('players', `${user.id}`, 'index.room.json')}`; @@ -132,7 +132,7 @@ export default class Universe { } const universe = new this(flecks, path); await universe.loadOrCreateResource(); - const {Room} = flecks.avocado.Resources; + const {Room} = flecks.avocado.resource.Resources; await Promise.all( (await pglob('**/*.room.json', {cwd: path})) .map(async (roomUri) => { @@ -153,7 +153,7 @@ export default class Universe { async loadOrCreateEntity(user) { debugSilly('loadOrCreateEntity from user id %d', user.id); const playerPath = join(this.$$root, 'players', `${user.id}`); - const {Entity} = this.$$flecks.avocado.Resources; + const {Entity} = this.$$flecks.avocado.resource.Resources; try { await stat(join(playerPath, 'index.entity.json')); const json = JSON.parse((await readFile(join(playerPath, 'index.entity.json'))).toString()); @@ -183,7 +183,7 @@ export default class Universe { debug("resource doesn't exist, creating..."); await writeFile(uri, '{}'); } - const {Universe} = this.$$flecks.avocado.Resources; + const {Universe} = this.$$flecks.avocado.resource.Resources; const buffer = await readFile(uri); const json = JSON.parse(buffer.toString()); this.$$universe = await Universe.load(json);