|
|
@ -11,33 +11,40 @@ def display_death_event(e)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
item = df.item_find(:selected)
|
|
|
|
item = df.item_find(:selected)
|
|
|
|
|
|
|
|
unit = df.unit_find(:selected)
|
|
|
|
|
|
|
|
|
|
|
|
if !item or !item.kind_of?(DFHack::ItemBodyComponent)
|
|
|
|
if !item or !item.kind_of?(DFHack::ItemBodyComponent)
|
|
|
|
item = df.world.items.other[:ANY_CORPSE].find { |i| df.at_cursor?(i) }
|
|
|
|
item = df.world.items.other[:ANY_CORPSE].find { |i| df.at_cursor?(i) }
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
if !item or !item.kind_of?(DFHack::ItemBodyComponent)
|
|
|
|
if item and item.kind_of?(DFHack::ItemBodyComponent)
|
|
|
|
puts "Please select a corpse in the loo'k' menu"
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
hf = item.hist_figure_id
|
|
|
|
hf = item.hist_figure_id
|
|
|
|
if hf == -1
|
|
|
|
elsif unit
|
|
|
|
|
|
|
|
hf = unit.hist_figure_id
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if not hf
|
|
|
|
|
|
|
|
puts "Please select a corpse in the loo'k' menu, or an unit in the 'u'nitlist screen"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
elsif hf == -1
|
|
|
|
# TODO try to retrieve info from the unit (u = item.unit_tg)
|
|
|
|
# TODO try to retrieve info from the unit (u = item.unit_tg)
|
|
|
|
puts "Not a historical figure, cannot death find info"
|
|
|
|
puts "Not a historical figure, cannot death find info"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
|
|
|
|
histfig = df.world.history.figures.binsearch(hf)
|
|
|
|
|
|
|
|
unit = histfig ? df.unit_find(histfig.unit_id) : nil
|
|
|
|
|
|
|
|
if unit and not unit.flags1.dead
|
|
|
|
|
|
|
|
puts "#{unit.name} is not dead yet !"
|
|
|
|
|
|
|
|
|
|
|
|
else
|
|
|
|
else
|
|
|
|
events = df.world.history.events
|
|
|
|
events = df.world.history.events
|
|
|
|
found = false
|
|
|
|
|
|
|
|
(0...events.length).reverse_each { |i|
|
|
|
|
(0...events.length).reverse_each { |i|
|
|
|
|
e = events[i]
|
|
|
|
e = events[i]
|
|
|
|
if e.kind_of?(DFHack::HistoryEventHistFigureDiedst) and e.victim_hf == hf
|
|
|
|
if e.kind_of?(DFHack::HistoryEventHistFigureDiedst) and e.victim_hf == hf
|
|
|
|
display_death_event(e)
|
|
|
|
display_death_event(e)
|
|
|
|
found = true
|
|
|
|
|
|
|
|
break
|
|
|
|
break
|
|
|
|
end
|
|
|
|
end
|
|
|
|
}
|
|
|
|
}
|
|
|
|
if not found
|
|
|
|
|
|
|
|
u = item.unit_tg
|
|
|
|
|
|
|
|
puts "#{u.name} is not dead yet !" if u and not u.flags1.dead
|
|
|
|
|
|
|
|
end
|
|
|
|
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
end
|
|
|
|
|
|
|
|
|
|
|
|