forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
/
forget-dead-body.lua
43 lines (36 loc) · 968 Bytes
/
forget-dead-body.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
39
40
41
42
43
-- Removes emotions associated with seeing a dead body
--@ module = true
local utils = require 'utils'
local validArgs = utils.invert({
'help',
'all',
})
function forgetDeadBody(unit)
for _, t in ipairs(unit.status.current_soul.personality.emotions) do
if t.thought == df.unit_thought_type.SawDeadBody then
t.type = df.emotion_type.ANYTHING
end
end
end
function main(...)
local args = utils.processArgs({...}, validArgs)
if args.help then
print(dfhack.script_help())
return
end
if args.all then
for _, unit in ipairs(dfhack.units.getCitizens()) do
forgetDeadBody(unit)
end
else
local unit = dfhack.gui.getSelectedUnit()
if unit then
forgetDeadBody(unit)
else
qerror('Invalid usage: No unit selected and --all argument not given.')
end
end
end
if not dfhack_flags.module then
main(...)
end