forked from DFHack/scripts
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcannibalism.lua
More file actions
26 lines (22 loc) · 823 Bytes
/
cannibalism.lua
File metadata and controls
26 lines (22 loc) · 823 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
--Allows consumption of sapient corpses.
--[====[
cannibalism
===========
Allows consumption of sapient corpses. Use from an adventurer's inventory screen
or an individual item's detail screen.
]====]
function unmark_inventory(inventory)
for _, entry in ipairs(inventory) do
entry.item.flags.dead_dwarf = false
end
end
local scrn = dfhack.gui.getCurViewscreen()
if df.viewscreen_itemst:is_instance(scrn) then
scrn.item.flags.dead_dwarf = false --hint:df.viewscreen_itemst
elseif df.viewscreen_dungeon_monsterstatusst:is_instance(scrn) then
unmark_inventory(scrn.inventory) --hint:df.viewscreen_dungeon_monsterstatusst
elseif df.global.ui_advmode.menu == df.ui_advmode_menu.Inventory then
unmark_inventory(df.global.world.units.active[0].inventory)
else
qerror('Unsupported context')
end