You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
persistence module doesn't handle dwarf arena mode well #6052
While testing DFHack/scripts#1654, I got errors from autotraining and buildingplan/quick-filters about not being able to save persistent data. This is because arena mode doesn't have any means to persist data; these tools should not be trying to persist data in arena mode.
There are two interrelated defects here.
One is that these two tools (and likely others) are using the wrong gate logic to detect when they should enable. autotraining is meaningless in arena mode, but it tries to start anyway because it only checks gamemode for DWARF but dwarf arena mode is also gamemode == DWARF. Tools that should only run in dwarf mode, but not in dwarf arena mode, need to use dfhack.world.isFortressMode() instead to avoid incorrectly activating in dwarf arena mode.
The other is that the persistence layer is assuming that GetCurrentSiteId will return an actual site, and doesn't handle the -1 "no site" return cleanly, leading to a Lua error.
A brief scan identified prioritize, immortal-cravings, idle-crafting, husbandry, warn-stranded, source, emigration, hermit, fix/protect-nicks, and autofish as all exhibiting the same defect pattern - as well as the API documentation (at or about line 7924).
Activity