Call on_drop for dropped items on player death

Fixes charged bow dropping on death
This commit is contained in:
Wuzzy 2019-02-11 18:55:48 +01:00
parent 2ffd16377b
commit 2d721a98cb
1 changed files with 5 additions and 2 deletions

View File

@ -24,13 +24,16 @@ minetest.register_on_dieplayer(function(player)
pos.x = pos.x + x pos.x = pos.x + x
pos.z = pos.z + z pos.z = pos.z + z
if not void_deadly and drop then if not void_deadly and drop then
local def = minetest.registered_items[stack:get_name()]
if def and def.on_drop then
stack = def.on_drop(stack, player, pos)
end
minetest.add_item(pos, stack) minetest.add_item(pos, stack)
end end
stack:clear()
inv:set_stack(listname, i, stack)
pos.x = pos.x - x pos.x = pos.x - x
pos.z = pos.z - z pos.z = pos.z - z
end end
inv:set_list(listname, {})
end end
end end
armor:set_player_armor(player) armor:set_player_armor(player)