handle_node_drops no longer destroys metadata

This commit is contained in:
Wuzzy 2019-03-01 17:30:21 +01:00
parent 19b1cf5986
commit a711c7bdb7
2 changed files with 6 additions and 7 deletions

View File

@ -245,16 +245,16 @@ function minetest.handle_node_drops(pos, drops, digger)
end
for _,item in ipairs(drops) do
local count, name
local count
if type(item) == "string" then
count = 1
name = item
count = ItemStack(item):get_count()
else
count = item:get_count()
name = item:get_name()
end
local drop_item = ItemStack(item)
drop_item:set_count(1)
for i=1,count do
local obj = core.add_item(pos, name)
local obj = core.add_item(pos, drop_item)
if obj ~= nil then
local x = math.random(1, 5)
if math.random(1,2) == 1 then

View File

@ -555,8 +555,7 @@ if minetest.settings:get_bool("creative_mode") then
local inv = digger:get_inventory()
if inv then
for _,item in ipairs(drops) do
item = ItemStack(item):get_name()
if not inv:contains_item("main", item) then
if not inv:contains_item("main", item, true) then
inv:add_item("main", item)
end
end