mirror of
https://git.minetest.land/VoxeLibre/VoxeLibre.git
synced 2024-12-23 08:29:34 +01:00
Don't drop banners in creative mode
This commit is contained in:
parent
0ee31bd322
commit
87bf3aed59
1 changed files with 15 additions and 5 deletions
|
@ -113,6 +113,17 @@ local function on_dig_banner(pos, node, digger)
|
|||
minetest.record_protection_violation(pos, name)
|
||||
return
|
||||
end
|
||||
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local item = inv:get_stack("banner", 1)
|
||||
local item_str = item:is_empty() and "mcl_banners:banner_item_white"
|
||||
or item:to_string()
|
||||
|
||||
minetest.handle_node_drops(pos, { item_str }, digger)
|
||||
|
||||
item:set_count(0)
|
||||
inv:set_stack("banner", 1, item)
|
||||
|
||||
-- Remove node
|
||||
minetest.remove_node(pos)
|
||||
end
|
||||
|
@ -135,13 +146,12 @@ local function on_destruct_banner(pos, hanging)
|
|||
v:remove()
|
||||
end
|
||||
end
|
||||
-- Drop item
|
||||
local meta = minetest.get_meta(pos)
|
||||
local item = meta:get_inventory():get_stack("banner", 1)
|
||||
|
||||
-- Drop item only if it was not handled in on_dig_banner
|
||||
local inv = minetest.get_meta(pos):get_inventory()
|
||||
local item = inv:get_stack("banner", 1)
|
||||
if not item:is_empty() then
|
||||
minetest.handle_node_drops(pos, {item:to_string()})
|
||||
else
|
||||
minetest.handle_node_drops(pos, {"mcl_banners:banner_item_white"})
|
||||
end
|
||||
end
|
||||
|
||||
|
|
Loading…
Reference in a new issue