diff --git a/packages/farm/src/resources/decorators/room.js b/packages/farm/src/resources/decorators/room.js index 4864c4b..7306d8d 100644 --- a/packages/farm/src/resources/decorators/room.js +++ b/packages/farm/src/resources/decorators/room.js @@ -64,17 +64,6 @@ export default (Room) => class FarmableRoom extends Room { this.$$waterChanges = []; } - isPlantAt(target) { - const entities = this.entityList.visibleEntities(Rectangle.centerOn(target, [1, 1])); - for (let i = 0; i < entities.length; ++i) { - const entity = entities[i]; - if (Vector.equals(entity.position, target) && entity.is('Plant')) { - return true; - } - } - return false; - } - async load(json) { await super.load(json); const { @@ -100,7 +89,7 @@ export default (Room) => class FarmableRoom extends Room { return ( 'web' !== process.env.FLECKS_CORE_BUILD_TARGET && TILLED === tiles.tileAt(target) - && !this.isPlantAt(center) + && !this.plantAt(center) ); } @@ -112,6 +101,17 @@ export default (Room) => class FarmableRoom extends Room { return packets; } + plantAt(target) { + const entities = this.entityList.visibleEntities(Rectangle.centerOn(target, [1, 1])); + for (let i = 0; i < entities.length; ++i) { + const entity = entities[i]; + if (Vector.equals(entity.position, target) && entity.is('Plant')) { + return entity; + } + } + return null; + } + prepareSoilAt(target) { if ('web' !== process.env.FLECKS_CORE_BUILD_TARGET) { const tiles = this.tiles[1];