🐛 fix Nisse stuck idle after stockpile deposit; rename Villager → Nisse in UI

This commit is contained in:
2026-03-20 17:07:34 +00:00
parent 8ed67313a8
commit 787ada7cb4
4 changed files with 24 additions and 11 deletions

View File

@@ -170,6 +170,7 @@ export class VillagerSystem {
case 'stockpile':
this.adapter.send({ type: 'VILLAGER_DEPOSIT', villagerId: v.id })
this.adapter.send({ type: 'VILLAGER_SET_AI', villagerId: v.id, aiState: 'idle' })
rt.idleScanTimer = 0 // scan for a new job immediately after deposit
break
case 'bed':
@@ -217,7 +218,13 @@ export class VillagerSystem {
}
}
// Back to idle so decideAction handles depositing
// If the harvest produced nothing (resource already gone), clear the stale job
// so tickIdle does not try to walk to a stockpile with nothing to deposit.
if (!v.job?.carrying || !Object.values(v.job.carrying).some(n => (n ?? 0) > 0)) {
this.adapter.send({ type: 'VILLAGER_SET_JOB', villagerId: v.id, job: null })
}
// Back to idle — tickIdle will handle hauling to stockpile if carrying items
this.adapter.send({ type: 'VILLAGER_SET_AI', villagerId: v.id, aiState: 'idle' })
}
@@ -342,7 +349,7 @@ export class VillagerSystem {
this.adapter.send({ type: 'SPAWN_VILLAGER', villager })
this.spawnSprite(villager)
this.onMessage?.(`${name} has joined the settlement! 🏘`)
this.onMessage?.(`${name} the Nisse has arrived! 🏘`)
}
// ─── Sprite management ────────────────────────────────────────────────────