-
Notifications
You must be signed in to change notification settings - Fork 217
Add research-info script #1454
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
base: master
Are you sure you want to change the base?
Add research-info script #1454
Conversation
I haven't moved forward to review this PR because the pre-commit check hasn't been resolved. Is the OP still interested in pursuing this PR? |
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.
Since this tool can be invoked on its own from the command-line, it needs documentation. Without having a good understanding what this tool is supposed to do, it is hard to give good feedback. Please have a look at the .rst files in the docs folder. And then, of course, this also needs a changelog entry like every other PR.
goto continue | ||
end | ||
|
||
local historical_figure = researchInfo.getHistoricalFigure(unit.id) |
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.
local historical_figure = researchInfo.getHistoricalFigure(unit.id) | |
local historical_figure = df.historical_figure.find(unit.hist_figure_id) |
There are two observations here: units have a historical figure id field, and the idiomatic way to turn a numeric field into the corresponding structure is to use df.<structure_name>.find(id)
. This makes functions like your getHistoricalFigure
basically useless. Please revisit your code and see whether this same pattern can be applied elsewhere.
local unit = dfhack.units.getCitizens() | ||
local selected_unit = dfhack.gui.getSelectedUnit() | ||
|
||
if unit then |
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.
dfhack.units.getCitizens
returns a table, and even the empty table (which this will never return in an active fort) is a "truthy" value in lua. So this condition can never evaluate to false.
|
||
local parts = {} | ||
for part in str:gmatch("[^_]+") 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.
If you add comments, please add them in English.
local goal_info = "" | ||
for i = 0, 31 do | ||
if goal[i] then | ||
local global_flag_index = category * 32 + i -- wizards move | ||
goal_info = string.format("%s", df.dfhack_knowledge_scholar_flag[global_flag_index]) or string.format("Unknown Flag: %s", i) | ||
end | ||
end | ||
return goal_info |
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.
I don't understand what you're doing here. Please explain, so that we can see whether there is a better way.
The script to show more information about scholars activities, adapted for use with spectate-overlay or dfhack-console