Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

script for debugging items being assigned to multiple squads #902

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

chdoc
Copy link
Contributor

@chdoc chdoc commented Nov 22, 2023

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.

Copy link
Member

@myk002 myk002 left a comment

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
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
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
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
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
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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants