File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ research-info
2+ =========
3+
4+ .. dfhack-tool ::
5+ :summary: Show information about current scholars research progress.
6+ :tags: fort units
7+
8+ Use with a unit selected to show information about units research progress.
9+
10+
11+ Usage
12+ -----
13+
14+ ::
15+
16+ research-info
17+ research-info all <RELATIONSHIP>
18+ research-info <CIV_ID> <RELATIONSHIP>
19+
20+ Examples
21+ --------
22+
23+ ``research-info ``
24+ Show the selected unit research progress.
25+ ``research-info --unit <id> ``
26+ Show the specified unit research progress.
27+ ``research-info --all ``
28+ Show all citizens and residents research progress.
Original file line number Diff line number Diff line change @@ -40,7 +40,6 @@ function getGoalInfo(goal, category)
4040 return goal_info
4141 end
4242
43- local goal_info = " "
4443 for i = 0 , 31 do
4544 if goal [i ] then
4645 local global_flag_index = category * 32 + i -- wizards move
@@ -59,7 +58,7 @@ local function getTopicInfo(topic)
5958
6059 for key , value in pairs (topic ) do
6160 if type (value ) == " boolean" and value then
62- -- Если значение булевое и равно true, выводим тему как изученную
61+ -- show learned topics
6362 topic_info = topic_info .. string.format (" \n\t\t %s" , key )
6463 end
6564 end
102101function getResearchData (historical_figure )
103102 local knowledge = getHistoricKnowledge (historical_figure )
104103 local data = {
105-
106- name = dfhack .translation .translateName (historical_figure .name ), -- dfhack.translation.TranslateName(historical_figure.name),
104+ name = dfhack .translation .translateName (historical_figure .name ),
107105 knowledge_goal_category = getKnowledgeGoalCategoryInfo (knowledge .knowledge_goal_category ),
108- -- knowledge_goal = getGoalInfo(knowledge.knowledge_goal),
109106 knowledge_goal = getGoalInfo (knowledge .knowledge_goal , knowledge .knowledge_goal_category ),
110107 research_points = knowledge .research_points ,
111108 research_percentage = string.format (" %.2f" , (knowledge .research_points / 100000 ) * 100 ),
Original file line number Diff line number Diff line change @@ -10,7 +10,7 @@ local function formatKnowledgeString(str)
1010
1111 local parts = {}
1212 for part in str :gmatch (" [^_]+" ) do
13- -- Первую букву делаем заглавной, остальные - строчными
13+ -- do capitalize the first letter
1414 local formatted = part :sub (1 ,1 ):upper () .. part :sub (2 ):lower ()
1515 table.insert (parts , formatted )
1616 end
2020
2121function GetUnitResearchInfo (unit_id )
2222 local info = ' '
23-
23+ historical_figure = df . historical_figure . find ( unit_id )
2424 historical_figure = researchInfo .getHistoricalFigure (unit_id )
2525 local knowledge = researchInfo .getHistoricKnowledge (historical_figure )
2626 local data = {
@@ -30,7 +30,7 @@ function GetUnitResearchInfo(unit_id)
3030 research_percentage = string.format (" %.2f" , (knowledge .research_points / 100000 ) * 100 ),
3131 times_pondered = knowledge .times_pondered
3232 }
33-
33+
3434 if ((data .knowledge_goal ~= ' nil' ) and ((data .times_pondered > 0 ) or (knowledge .research_points > 0 ))) then
3535 info = data .knowledge_goal .. string.format (' %s%%' , data .research_percentage ).. string.format (' [%d] ' , data .times_pondered )
3636 end
Original file line number Diff line number Diff line change @@ -44,12 +44,12 @@ local selected_unit = dfhack.gui.getSelectedUnit()
4444if unit then
4545 local research_data_list = {}
4646 for i , unit in pairs (dfhack .units .getCitizens ()) do
47-
47+
4848 if selected_unit and selected_unit .id ~= unit .id then
4949 goto continue
5050 end
5151
52- local historical_figure = researchInfo . getHistoricalFigure (unit .id )
52+ local historical_figure = df . historical_figure . find (unit .hist_figure_id )
5353 if historical_figure then
5454 local research_data , error_msg = researchInfo .getResearchData (historical_figure )
5555 if research_data then
You can’t perform that action at this time.
0 commit comments