forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathghostly.lua
More file actions
26 lines (22 loc) · 688 Bytes
/
ghostly.lua
File metadata and controls
26 lines (22 loc) · 688 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
-- Turns an adventurer into a ghost or back
--[====[
ghostly
=======
Toggles an adventurer's ghost status. Useful for walking through walls, avoiding
attacks, or recovering after a death.
]====]
if df.global.gamemode ~= df.game_mode.ADVENTURE then
qerror('This script must be used in adventure mode')
end
local unit = df.global.world.units.active[0]
if unit then
if unit.flags1.inactive then
unit.flags1.inactive = false
unit.flags3.ghostly = true
elseif unit.body.components.body_part_status[0].missing then
unit.flags1.inactive = true
unit.flags3.ghostly = false
else
unit.flags3.ghostly = not unit.flags3.ghostly
end
end