gui/settings-manager: recompute unit labors after work detail import - #1631
Open
Alistair-Afton wants to merge 2 commits into
Open
Alistair-Afton wants to merge 2 commits into
Alistair-Afton wants to merge 2 commits into
Conversation
Match saved built-in work details by identity instead of raw vector position, then restore custom details after the current built-in prefix. This keeps built-ins added by newer DF versions from being overwritten or truncated by older settings.
Importing work details changed each detail's allowed labors but left the units' effective labor flags untouched, so jobs that depended on the newly imported details (e.g. Mechanics and Jeweler's workshops) found no workers until some later action happened to trigger recomputation. Call dfhack.units.setAutomaticProfessions() for all citizens after importing, matching what the game does when work details are applied through the labor UI. Also match saved built-in details by icon when the name no longer matches, so settings exported before a built-in was renamed (by the user or a DF update) still apply, re-read the settings file before each load so files swapped in while the game is running are seen, and skip malformed saved entries instead of erroring on them.
This was referenced Sep 16, 2026
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.
Fixes DFHack/dfhack#5503 (stacked on #1630).
Importing work details changed each detail's
allowed_laborsbut left every unit's effective labor flags untouched. Jobs that depended on the imported details — like Mechanics and Jeweler's workshops in the report — found no workers until some later action happened to trigger recomputation.Changes in
load_work_details:dfhack.units.setAutomaticProfessions()for all citizens after importing, matching what the game does when work details are applied through the labor UI. This removes the documented caveat that imported details only take effect after making a change on the work details screen.CUSTOM_*/NONEicons are never treated as built-ins.Also updated the docs to remove the now-obsolete caveat.
Test plan
settings-manager.jsoninto a running fort; renamed built-ins received their saved labors, custom details were recreated, and assigned units'status.laborsmatch their detail'sallowed_labors(0 mismatches)test -t settingsin-engine: 7/7 pass