forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathremove-stress.lua
38 lines (31 loc) · 954 Bytes
/
remove-stress.lua
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
-- Sets stress to negative one million
--By Putnam; http://www.bay12forums.com/smf/index.php?topic=139553.msg5820486#msg5820486
local help = [====[
remove-stress
=============
Sets stress to -1,000,000; the normal range is 0 to 500,000 with very stable or
very stressed dwarves taking on negative or greater values respectively.
Applies to the selected unit, or use ``remove-stress -all`` to apply to all units.
]====]
local utils = require 'utils'
validArgs = validArgs or utils.invert({
'help',
'all'
})
local args = utils.processArgs({...}, validArgs)
if args.help then
print(help)
return
end
if args.all then
for k,v in ipairs(df.global.world.units.active) do
v.status.current_soul.personality.stress_level=-1000000
end
else
local unit = dfhack.gui.getSelectedUnit()
if unit then
unit.status.current_soul.personality.stress_level=-1000000
else
error 'Invalid usage: No unit selected and -all argument not given.'
end
end