-
Notifications
You must be signed in to change notification settings - Fork 196
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
base: master
Are you sure you want to change the base?
Conversation
ad56041
to
fbeea05
Compare
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.
ugh, I forgot to actually submit my review. sorry for the delay.
========================= | ||
|
||
.. dfhack-tool:: | ||
:summary: Tool for debugging equipment conflicts |
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.
: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 |
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.
Aren't "uniforms" the templates, and not the actual worn items?
--[[ | ||
|
||
This script analyzes uniforms of squad members and reports items that are | ||
claimed by more than one squad member. | ||
|
||
--]] |
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.
this is already in the docs and doesn't need to be repeated here
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 |
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.
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 |
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.
functionally the same, but semantically, this is an ipairs
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.