11-- show death cause of a creature
2+ -- @ module = true
23
34local DEATH_TYPES = reqscript (' gui/unit-info-viewer' ).DEATH_TYPES
45
@@ -29,7 +30,7 @@ function displayDeathUnit(unit)
2930 str = str .. dfhack .units .getReadableName (unit )
3031
3132 if not dfhack .units .isDead (unit ) then
32- return ( str .. " is not dead yet!" )
33+ return str .. " is not dead yet!"
3334 end
3435
3536 str = str .. (" %s" ):format (getDeathStringFromCause (unit .counters .death_cause ))
@@ -49,7 +50,7 @@ function displayDeathUnit(unit)
4950 end
5051 end
5152
52- return ( str .. ' .' )
53+ return str .. ' .'
5354end
5455
5556-- returns the item description if the item still exists; otherwise
@@ -86,7 +87,7 @@ function displayDeathEventHistFigUnit(histfig_unit, event)
8687 end
8788 end
8889
89- return ( str .. ' .' )
90+ return str .. ' .'
9091end
9192
9293-- Returns the death event for the given histfig or nil if not found
@@ -108,7 +109,7 @@ function displayDeathHistFig(histfig)
108109 end
109110
110111 if not dfhack .units .isDead (histfig_unit ) then
111- return (( " %s is not dead yet!" ):format (dfhack .units .getReadableName (histfig_unit ) ))
112+ return ( " %s is not dead yet!" ):format (dfhack .units .getReadableName (histfig_unit ))
112113 else
113114 local death_event = getDeathEventForHistFig (histfig .id )
114115 return displayDeathEventHistFigUnit (histfig_unit , death_event )
@@ -146,6 +147,10 @@ local function get_target()
146147 return selected_item .hist_figure_id , df .unit .find (selected_item .unit_id )
147148end
148149
150+ if dfhack_flags .module then
151+ return
152+ end
153+
149154local hist_figure_id , selected_unit = get_target ()
150155
151156if not hist_figure_id then
0 commit comments