🐛 clear FOREST/ROCK tile after harvest so Nisse can access deeper resources

This commit is contained in:
2026-03-20 17:39:25 +00:00
parent 787ada7cb4
commit c9c8e45b0c

View File

@@ -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') {