Skip to content

script for debugging items being assigned to multiple squads - #902

Closed
chdoc wants to merge 1 commit into
DFHack:masterfrom
chdoc:equipment-conflicts
Closed

script for debugging items being assigned to multiple squads#902
chdoc wants to merge 1 commit into
DFHack:masterfrom
chdoc:equipment-conflicts

Conversation

@chdoc

@chdoc chdoc commented Nov 22, 2023

Copy link
Copy Markdown
Member

For what its worth, here is the script I wrote to debug the equipment situation in one of my forts.

Is would be nice if someone could check that the logic is sound.

Of course, it would be nice to automatically fix the conflicts, but doing so requires further analysis.

@chdoc
chdoc force-pushed the equipment-conflicts branch from ad56041 to fbeea05 Compare November 22, 2023 10:58

@myk002 myk002 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.

ugh, I forgot to actually submit my review. sorry for the delay.

=========================

.. dfhack-tool::
:summary: Tool for debugging equipment conflicts

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.

Suggested change
:summary: Tool for debugging equipment conflicts
:summary: Tool for debugging equipment conflicts.

:summary: Tool for debugging equipment conflicts
:tags: dev

This script analyzes uniforms of squad members and reports items that are

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.

Aren't "uniforms" the templates, and not the actual worn items?

Comment on lines +1 to +6
--[[

This script analyzes uniforms of squad members and reports items that are
claimed by more than one squad member.

--]]

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.

this is already in the docs and doesn't need to be repeated here

Comment on lines +15 to +21
local function addToNestedTable(outer_table, outer_key, value)
if outer_table[outer_key] then
table.insert(outer_table[outer_key],value)
else
outer_table[outer_key] = { value }
end
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.

can replace with table.insert(ensure_key(outer_table, outer_key), value)

end

-- analyze uniforms of squad members
for _, unit in pairs(dfhack.units.getCitizens(true)) do

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.

functionally the same, but semantically, this is an ipairs

@chdoc chdoc closed this Sep 5, 2026
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