Divergent/mods/Weapons Drop on Bodies/gamedata/scripts/keep_guns_on_bodies.script

18 lines
351 B
Plaintext
Raw Permalink Normal View History

2024-03-17 20:18:03 -04:00
function keep_item_hook(npc, item)
if not (item) then
return
end
local item_id = item:id()
local active_item = npc:active_item()
old_keep_item(npc, item)
if active_item ~= nil and active_item:id() == item_id then
npc:transfer_item(item, npc)
end
end
old_keep_item = death_manager.keep_item
death_manager.keep_item = keep_item_hook