Creative: Reduce item droppings
This commit is contained in:
parent
c0f377c100
commit
da38048ed6
@ -84,7 +84,13 @@ minetest.register_globalstep(
|
|||||||
end
|
end
|
||||||
|
|
||||||
if inv:room_for_item("main", ItemStack(lua.itemstring)) then
|
if inv:room_for_item("main", ItemStack(lua.itemstring)) then
|
||||||
inv:add_item("main", ItemStack(lua.itemstring))
|
if minetest.settings:get_bool("creative_mode") then
|
||||||
|
if not inv:contains_item("main", ItemStack(lua.itemstring), true) then
|
||||||
|
inv:add_item("main", ItemStack(lua.itemstring))
|
||||||
|
end
|
||||||
|
else
|
||||||
|
inv:add_item("main", ItemStack(lua.itemstring))
|
||||||
|
end
|
||||||
|
|
||||||
if lua.itemstring ~= "" then
|
if lua.itemstring ~= "" then
|
||||||
minetest.sound_play(
|
minetest.sound_play(
|
||||||
@ -119,6 +125,20 @@ minetest.register_globalstep(
|
|||||||
end)
|
end)
|
||||||
|
|
||||||
function minetest.handle_node_drops(pos, drops, digger)
|
function minetest.handle_node_drops(pos, drops, digger)
|
||||||
|
if minetest.settings:get_bool("creative_mode") then
|
||||||
|
if not digger or not digger:is_player() then
|
||||||
|
return
|
||||||
|
end
|
||||||
|
local inv = digger:get_inventory()
|
||||||
|
if inv then
|
||||||
|
for _,item in ipairs(drops) do
|
||||||
|
if not inv:contains_item("main", item, true) then
|
||||||
|
inv:add_item("main", item)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
end
|
||||||
|
return
|
||||||
|
end
|
||||||
for _,item in ipairs(drops) do
|
for _,item in ipairs(drops) do
|
||||||
local count, name
|
local count, name
|
||||||
if type(item) == "string" then
|
if type(item) == "string" then
|
||||||
|
Loading…
Reference in New Issue
Block a user