1
0
Fork 0

handle_node_drops no longer destroys metadata

objects
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 end
for _,item in ipairs(drops) do for _,item in ipairs(drops) do
local count, name local count
if type(item) == "string" then if type(item) == "string" then
count = 1 count = ItemStack(item):get_count()
name = item
else else
count = item:get_count() count = item:get_count()
name = item:get_name()
end end
local drop_item = ItemStack(item)
drop_item:set_count(1)
for i=1,count do for i=1,count do
local obj = core.add_item(pos, name) local obj = core.add_item(pos, drop_item)
if obj ~= nil then if obj ~= nil then
local x = math.random(1, 5) local x = math.random(1, 5)
if math.random(1,2) == 1 then 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() local inv = digger:get_inventory()
if inv then if inv then
for _,item in ipairs(drops) do for _,item in ipairs(drops) do
item = ItemStack(item):get_name() if not inv:contains_item("main", item, true) then
if not inv:contains_item("main", item) then
inv:add_item("main", item) inv:add_item("main", item)
end end
end end