forked from DFHack/dfhack
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrejuvenate.lua
More file actions
38 lines (28 loc) · 1001 Bytes
/
Copy pathrejuvenate.lua
File metadata and controls
38 lines (28 loc) · 1001 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
-- This script will make any "old" dwarf 20 years old
-- usage is: target a unit in DF, and execute this script in dfhack
-- the target will be changed to 20 years old
-- by vjek
--[[
BEGIN_DOCS
.. _scripts/rejuvenate:
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_DOCS
]]
function rejuvenate()
local current_year,newbirthyear
unit=dfhack.gui.getSelectedUnit()
if unit==nil then print ("No unit under cursor! Aborting.") return end
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")
end
rejuvenate()