From c9c8e45b0c410a370f35d39579691b856edb8a36 Mon Sep 17 00:00:00 2001 From: tekki mariani Date: Fri, 20 Mar 2026 17:39:25 +0000 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20clear=20FOREST/ROCK=20tile=20aft?= =?UTF-8?q?er=20harvest=20so=20Nisse=20can=20access=20deeper=20resources?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/systems/VillagerSystem.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/systems/VillagerSystem.ts b/src/systems/VillagerSystem.ts index f6eb302..68efa98 100644 --- a/src/systems/VillagerSystem.ts +++ b/src/systems/VillagerSystem.ts @@ -1,5 +1,6 @@ import Phaser from 'phaser' import { TILE_SIZE, VILLAGER_SPEED, VILLAGER_SPAWN_INTERVAL, VILLAGER_WORK_TIMES, VILLAGER_NAMES } from '../config' +import { TileType } from '../types' import type { VillagerState, VillagerJob, JobType, AIState, ItemId } from '../types' import { stateManager } from '../StateManager' import { findPath } from '../utils/pathfinding' @@ -200,13 +201,19 @@ export class VillagerSystem { const state = stateManager.getState() if (job.type === 'chop') { - if (state.world.resources[job.targetId]) { + const res = state.world.resources[job.targetId] + if (res) { this.adapter.send({ type: 'VILLAGER_HARVEST_RESOURCE', villagerId: v.id, resourceId: job.targetId }) + // Clear the FOREST tile so the area becomes passable for future pathfinding + this.adapter.send({ type: 'CHANGE_TILE', tileX: res.tileX, tileY: res.tileY, tile: TileType.DARK_GRASS }) this.resourceSystem.removeResource(job.targetId) } } else if (job.type === 'mine') { - if (state.world.resources[job.targetId]) { + const res = state.world.resources[job.targetId] + if (res) { this.adapter.send({ type: 'VILLAGER_HARVEST_RESOURCE', villagerId: v.id, resourceId: job.targetId }) + // Clear the ROCK tile so the area becomes passable for future pathfinding + this.adapter.send({ type: 'CHANGE_TILE', tileX: res.tileX, tileY: res.tileY, tile: TileType.GRASS }) this.resourceSystem.removeResource(job.targetId) } } else if (job.type === 'farm') {