Bones: Add Drop check

This will check any item before dropping on death to make sure it's a registered item and drops is not empty e.g. ""
This commit is contained in:
tenplus1 2020-06-06 17:22:20 +01:00 committed by GitHub
parent b1ab8d5123
commit 02ebb1bdbb
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -159,6 +159,13 @@ local function may_replace(pos, player)
end
local drop = function(pos, itemstack)
local def = minetest.registered_items[itemstack:get_name()]
-- do not drop items with drops set to ""
if not def or (def.drops and def.drops == "") then
return
end
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
if obj then
obj:set_velocity({