fork update #10

Merged
chmodsayshello merged 220 commits from VoxeLibre/VoxeLibre:master into master 2023-06-04 12:44:03 +02:00
1 changed files with 15 additions and 5 deletions
Showing only changes of commit 87bf3aed59 - Show all commits

View File

@ -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