@@ -25,13 +25,11 @@ function getDeathStringFromCause(cause)
2525end
2626
2727function displayDeathUnit (unit )
28- local str = (" The %s" ):format (getRaceNameSingular (unit .race ))
29- if unit .name .has_name then
30- str = str .. (" %s" ):format (dfhack .TranslateName (unit .name ))
31- end
28+ local str = unit .name .has_name and ' ' or ' The '
29+ str = str .. dfhack .units .getReadableName (unit )
3230
3331 if not dfhack .units .isDead (unit ) then
34- print (str .. " is not dead yet!" )
32+ print (dfhack . df2console ( str ) .. " is not dead yet!" )
3533 return
3634 end
3735
@@ -46,13 +44,13 @@ function displayDeathUnit(unit)
4644 if killer then
4745 str = str .. (" , killed by the %s" ):format (getRaceNameSingular (killer .race ))
4846 if killer .name .has_name then
49- str = str .. (" %s" ):format (dfhack .TranslateName ( killer . name ))
47+ str = str .. (" %s" ):format (dfhack .translation . translateName ( dfhack . units . getVisibleName ( killer ) ))
5048 end
5149 end
5250 end
5351 end
5452
55- print (str .. ' .' )
53+ print (dfhack . df2console ( str ) .. ' .' )
5654end
5755
5856-- returns the item description if the item still exists; otherwise
6866function displayDeathEventHistFigUnit (histfig_unit , event )
6967 local str = (" The %s %s %s in year %d" ):format (
7068 getRaceNameSingular (histfig_unit .race ),
71- dfhack .TranslateName ( histfig_unit . name ),
69+ dfhack .translation . translateName ( dfhack . units . getVisibleName ( histfig_unit ) ),
7270 getDeathStringFromCause (event .death_cause ),
7371 event .year
7472 )
@@ -77,7 +75,7 @@ function displayDeathEventHistFigUnit(histfig_unit, event)
7775 if slayer_histfig then
7876 str = str .. (" , killed by the %s %s" ):format (
7977 getRaceNameSingular (slayer_histfig .race ),
80- dfhack .TranslateName ( slayer_histfig . name )
78+ dfhack .translation . translateName ( dfhack . units . getVisiblename ( slayer_histfig ) )
8179 )
8280 end
8381
@@ -89,7 +87,7 @@ function displayDeathEventHistFigUnit(histfig_unit, event)
8987 end
9088 end
9189
92- print (str .. ' .' )
90+ print (dfhack . df2console ( str ) .. ' .' )
9391end
9492
9593-- Returns the death event for the given histfig or nil if not found
@@ -111,7 +109,7 @@ function displayDeathHistFig(histfig)
111109 end
112110
113111 if not dfhack .units .isDead (histfig_unit ) then
114- print ((" %s is not dead yet!" ):format (dfhack .TranslateName ( histfig_unit . name )))
112+ print ((" %s is not dead yet!" ):format (dfhack .df2console ( dfhack . units . getReadableName ( histfig_unit ) )))
115113 else
116114 local death_event = getDeathEventForHistFig (histfig .id )
117115 displayDeathEventHistFigUnit (histfig_unit , death_event )
0 commit comments