2015-10-23 22:10:15 -06:00
|
|
|
-- make the selected dwarf 20 years old
|
2015-09-04 01:13:21 -06:00
|
|
|
-- by vjek
|
2015-10-23 22:10:15 -06:00
|
|
|
--[[=begin
|
|
|
|
|
|
|
|
rejuvenate
|
|
|
|
==========
|
|
|
|
Set the age of the selected dwarf to 20 years. Useful if valuable citizens are
|
|
|
|
getting old, or there are too many babies around...
|
|
|
|
|
|
|
|
=end]]
|
2015-09-04 00:51:28 -06:00
|
|
|
|
|
|
|
function rejuvenate()
|
2015-09-04 01:13:21 -06:00
|
|
|
local current_year,newbirthyear
|
|
|
|
unit=dfhack.gui.getSelectedUnit()
|
2015-09-04 00:51:28 -06:00
|
|
|
|
2015-09-04 01:13:21 -06:00
|
|
|
if unit==nil then print ("No unit under cursor! Aborting.") return end
|
2015-09-04 00:51:28 -06:00
|
|
|
|
2015-09-04 01:13:21 -06:00
|
|
|
current_year=df.global.cur_year
|
|
|
|
newbirthyear=current_year - 20
|
|
|
|
if unit.relations.birth_year < newbirthyear then
|
|
|
|
unit.relations.birth_year=newbirthyear
|
|
|
|
end
|
|
|
|
if unit.relations.old_year < current_year+100 then
|
|
|
|
unit.relations.old_year=current_year+100
|
|
|
|
end
|
|
|
|
print (dfhack.TranslateName(dfhack.units.getVisibleName(unit)).." is now 20 years old and will live at least 100 years")
|
2015-09-04 00:51:28 -06:00
|
|
|
|
|
|
|
end
|
|
|
|
|
2015-09-04 01:13:21 -06:00
|
|
|
rejuvenate()
|