mirror of
https://github.com/luanti-org/minetest_game.git
synced 2025-05-21 06:43:17 -04:00
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:
parent
b1ab8d5123
commit
02ebb1bdbb
1 changed files with 7 additions and 0 deletions
|
@ -159,6 +159,13 @@ local function may_replace(pos, player)
|
||||||
end
|
end
|
||||||
|
|
||||||
local drop = function(pos, itemstack)
|
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()))
|
local obj = minetest.add_item(pos, itemstack:take_item(itemstack:get_count()))
|
||||||
if obj then
|
if obj then
|
||||||
obj:set_velocity({
|
obj:set_velocity({
|
||||||
|
|
Loading…
Add table
Reference in a new issue