Repository navigation
fix: NPCs move on with their daily routine - a routine change ends the routine's state (Harad leaves the anvil, sleepers get up) - #575
Open
BoroBongo wants to merge 7 commits into
Conversation
…e routine's state (Harad leaves the anvil, sleepers get up) - NpcRoutineService: when a visible NPC's routine entry changes (time or Npc_ExchangeRoutine) and its state is a routine state, it ends like the engine: _End once the current actions are done, then the new entry's state; perception/AI_StartState states, the dialog partner, dead/knocked out NPCs and same state+waypoint entries are left alone; culled NPCs keep the culling behaviour; removes the FIXME and the double NotifyNpcRoutineChanged - AiHandler/NpcAiService/StartState: AI_StartState from a routine state's start/loop function stays a routine state (engine keeps the end time) - G2 TA_Sleep is ZS_GotoBed -> ZS_Sleep - UseMob: AI_UseMob(x, -1) without a mob in use does nothing (engine) instead of walking to the nearest mob - NpcMeshCullingService.IsAwake; ADR 2026-11-25-routine-change-ends-state, npc-ai.md Co-Authored-By: Claude Opus 5.5 <[email protected]>
…be put on their spot - the time-skip reset alone starts them over, the routine change doesn't end their states then Co-Authored-By: Claude Opus 5.5 <[email protected]>
… down for hours - the sleep queued for the old routine entry gives way to the new one Co-Authored-By: Claude Opus 5.5 <[email protected]>
… - the AI loop no longer overwrites it with "looping" Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ally frozen NPC counts like everywhere else Co-Authored-By: Claude Opus 5.5 <[email protected]>
… hero talks to the NPC Co-Authored-By: Claude Opus 5.5 <[email protected]>
…a reaction - the routine change doesn't cut it off Co-Authored-By: Claude Opus 5.5 <[email protected]>
6 tasks
Contributor
Author
Review (architecture-reviewer + gothic-reviewer)Gothic: OK to merge. Architecture: fits with concerns. Fixed in this PR:
Follow-up: #568 (one operation for ending a state). Note: Todi's earlier remote branch Editor check (G2): at 07:10 the log shows |
8 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
When a visible NPC's routine entry changes, the state the routine started now ends the engine way. Its
ZS_*_Endruns (for exampleAI_UseMob(-1), standing up from the anvil), and then the next routine state starts. Example: G2 Harad goes forge fire -> anvil -> cooling bucket every 10 minutes, where before he stayed at the first mob. Sleepers get up in the morning while you watch.Cases:
AI_StartStatefrom outside a routine state are not ended: talking, fighting, watching the player.ZS_GotoBed->ZS_Sleep.AI_UseMob(-1)without a mob in use does nothing, like OpenGothic.Why
In a playtest, Harad stayed at the anvil forever and visible sleepers never got up. A FIXME in
NpcRoutineServicesaid this was missing.How to test manually
[Routine] Harad: routine changed - ... ends, next ....Save/load
Nothing new is saved.
ZS_Sleep(G2) and the monsterZS_MM_Rtn_*states are now saved as routine states; after a load they restart their routine entry.Known gaps / follow-ups
fix/routine-change-ends-state(2026-10-29..31, no PR, e.g. 235f284 "NPCs in sight follow their daily routine by the clock"). It was not used here and is left untouched. Worth comparing before merging.CurrentLoopStatefrom outsideAiHandler; that should become one operation.Docs/adr/2026-11-25-routine-change-ends-state.md🤖 Generated with Claude Code