From 9c83755f533c76270428ece04ee9941f1db0614d Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 29 Mar 2023 17:28:13 -0600 Subject: [PATCH 1/3] Make banners drop when support node is dug and when banner node is dug --- mods/ITEMS/mcl_banners/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index cc0e02e66..f50488b35 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -113,14 +113,6 @@ local function on_dig_banner(pos, node, digger) minetest.record_protection_violation(pos, name) return end - -- Drop item - local meta = minetest.get_meta(pos) - local item = meta:get_inventory():get_stack("banner", 1) - if not item:is_empty() then - minetest.handle_node_drops(pos, {item:to_string()}, digger) - else - minetest.handle_node_drops(pos, {"mcl_banners:banner_item_white"}, digger) - end -- Remove node minetest.remove_node(pos) end @@ -141,6 +133,14 @@ local function on_destruct_banner(pos, hanging) local ent = v:get_luaentity() if ent and ent.name == nodename then v:remove() + -- Drop item + local meta = minetest.get_meta(pos) + local item = meta:get_inventory():get_stack("banner", 1) + if not item:is_empty() then + minetest.handle_node_drops(pos, {item:to_string()}, digger) + else + minetest.handle_node_drops(pos, {"mcl_banners:banner_item_white"}, digger) + end end end end From a98f79763bcaa453501512a7454e8b177838ea52 Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 29 Mar 2023 17:31:23 -0600 Subject: [PATCH 2/3] Remove unused digger variable that I forgot --- mods/ITEMS/mcl_banners/init.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index f50488b35..b1e9070c6 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -137,9 +137,9 @@ local function on_destruct_banner(pos, hanging) local meta = minetest.get_meta(pos) local item = meta:get_inventory():get_stack("banner", 1) if not item:is_empty() then - minetest.handle_node_drops(pos, {item:to_string()}, digger) + minetest.handle_node_drops(pos, {item:to_string()}) else - minetest.handle_node_drops(pos, {"mcl_banners:banner_item_white"}, digger) + minetest.handle_node_drops(pos, {"mcl_banners:banner_item_white"}) end end end From 088922dc33d0f6bca2369dd35d1455079399bd6a Mon Sep 17 00:00:00 2001 From: PrairieWind Date: Wed, 29 Mar 2023 17:37:04 -0600 Subject: [PATCH 3/3] Make sure banner drops, even if banner entity doesn't exist --- mods/ITEMS/mcl_banners/init.lua | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/mods/ITEMS/mcl_banners/init.lua b/mods/ITEMS/mcl_banners/init.lua index b1e9070c6..bd71338ee 100644 --- a/mods/ITEMS/mcl_banners/init.lua +++ b/mods/ITEMS/mcl_banners/init.lua @@ -133,16 +133,16 @@ local function on_destruct_banner(pos, hanging) local ent = v:get_luaentity() if ent and ent.name == nodename then v:remove() - -- Drop item - local meta = minetest.get_meta(pos) - local item = meta:get_inventory():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 end + -- Drop item + local meta = minetest.get_meta(pos) + local item = meta:get_inventory():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 local function on_destruct_standing_banner(pos)