Skip to content

Add "civ styles" GUI - #1603

Open
Snowstar38 wants to merge 1 commit into
DFHack:masterfrom
Snowstar38:civ-styles
Open

Add "civ styles" GUI#1603
Snowstar38 wants to merge 1 commit into
DFHack:masterfrom
Snowstar38:civ-styles

Conversation

@Snowstar38

@Snowstar38 Snowstar38 commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

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

@chdoc

chdoc commented Aug 21, 2026

Copy link
Copy Markdown
Member

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

Copy link
Copy Markdown
Member

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.

Comment thread docs/gui/civ-styles.rst
@@ -0,0 +1,30 @@
gui/civ-styles

Copy link
Copy Markdown
Member

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.

Comment thread docs/gui/civ-styles.rst
Comment on lines +21 to +23
it did not, ``gen`` for procedurally generated items, and ``xN`` if the style is
listed more than once, which repeated `add-recipe` runs will do.
:kbd:`Ctrl`:kbd:`D` removes duplicates.

Copy link
Copy Markdown
Member

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.

Comment thread gui/civ-styles.lua
Comment on lines +46 to +47
local civ_id = df.global.plotinfo.civ_id
if not civ_id or civ_id < 0 then return nil end

Copy link
Copy Markdown
Member

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.

Comment thread gui/civ-styles.lua
local cat = self.by_key[cat_key]
local vec = cat and self:get_vec(cat)
if not vec then return end
if count_in(vec, subtype) == 0 then

Copy link
Copy Markdown
Member

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants