Repository navigation
Add "civ styles" GUI #1603Snowstar38 wants to merge 2 commits into
Conversation
chdoc
commented
Aug 21, 2026
First of, thank you for contributing, this is a significant piece of work. At first glance, this looks to be in reasonably good shape. But the devil is usually in the detail. I'm still expecting this to require multiple rounds of code review before it can get merged. Given our currently limited reviewing capacity, this may take weeks or even months.
Please indicate the level of AI-support that was used in the development of this tool (if any) and your willingness to iterate on this for several weeks? I would like to avoid spending hours on an in-depth code review, just for another pull request to get abandoned.
@chdoc
chdoc
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here are some general remarks for the first round. I will do a more in-depth review once these are taken care of.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why call is tool civ-styles? the concept is already known as recipes. I would think the tool would be better named gui/recipes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Instead of fixing this behavior after the fact, please file a bug report against add-recipe.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
civ_id is an integer that is always defined when plotinfo is defined (basically always). So it is fine to directly call find with it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If all you need is a membership test, please use utils.linear_index(vector,key[,field]) and remove count_in.
Snowstar38
commented
Oct 20, 2026
Thanks for looking at it - sorry, I've had a lot going on and missed the notification email for this.
The tool was written with AI assistance. The design is mine, I wanted to see and remove civ style types, not just add them, since add-recipe only appends and doesn't show what your civ already knows. An AI agent implemented it, and we tested it in-game against a new and old world. I reviewed it before submitting.
On iterating: yes, I'm definitely willing to. Will be getting time this week to be able to rename it and polish anything that needs it.
Review feedback from chdoc on DFHack#1603: - Rename the tool to gui/recipes, since "recipes" is the established name for the concept (add-recipe). Renames the script, the docs file, the changelog entry, the classes and the focus path, and switches the user-facing strings from "style" to "recipe". - get_civ(): plotinfo.civ_id is always a defined integer, so call df.historical_entity.find with it directly. - Use utils.linear_index for the membership test in Recipes:add and remove count_in. Also narrows one docs claim: duplicate entries come from "add-recipe single", which inserts without a duplicate check; the "all"/"exotic" path already guards with checkKnown.
Review feedback from chdoc on DFHack#1603: - Rename the tool to gui/recipes, since "recipes" is the established name for the concept (add-recipe). Renames the script, the docs file, the changelog entry, the classes and the focus path, and switches the user-facing strings from "style" to "recipe". - get_civ(): plotinfo.civ_id is always a defined integer, so call df.historical_entity.find with it directly. - Use utils.linear_index for the membership test in Recipes:add and remove count_in. Also narrows one docs claim: duplicate entries come from "add-recipe single", which inserts without a duplicate check; the "all"/"exotic" path already guards with checkKnown.
da9e05e to
d533dcd
Compare
Snowstar38
commented
Oct 21, 2026
Thanks for the review. All four are done, but I did have a question about the last one.
- Renamed to
gui/recipes. That covers the script, the docs file, the changelog entry, the classes and the focus path, and the user-facing strings now say "recipe" instead of "style". get_civcallsdf.historical_entity.find(df.global.plotinfo.civ_id)directly.count_inis gone, replaced withutils.linear_index.- Filed the duplicates bug as add-recipe single inserts a duplicate when the civ already knows the recipe dfhack#6022 . It turned out to be specific to
add-recipe single, which inserts without checkingcheckKnown. Theall/nativepaths already guard.
On dropping the dedupe feature - I think it could make sense to leave it, though I'd like to hear your thoughts? After add-recipe is fixed, duplicates ideally won't happen anymore, but some people might end up with saves that do have them. If you think it's better off without I'll remove it tho
I loaded the renamed version in game and checked it: the window opens, categories populate, toggling works, and Ctrl-D correctly removed a duplicate I made on purpose with add-recipe single SHOES:ITEM_SHOES_BOOTS.
Also rebased onto current master, so the branch isn't 126 commits behind anymore.
Disclosure: I used AI assistance (Claude) for this round of changes and for the write-up in #6022. The testing above is mine.
Uh oh!
There was an error while loading. Please reload this page.
Adds gui/civ-styles, letting people edit the item styles a civilization knows how to make.
"add-recipe" can only add; there's no way to see what your civ already knows or remove any styles. This lists every style per category, marks which ones came from the civ's raws [helpful for modded civs/races], and lets you take styles away as well as grant them.
It also flags duplicate styles and can clear them (in case add-recipe was accidentally called 2x, lets users fix duplicate entries in menus). There are toggles to show known, unknown, etc.
Covers: armor, helms, gloves, shoes, pants, shields, weapons, diggers, training weapons, ammo, siege ammo, trap components, tools, toys, and instruments.
20260812211703_1