From cb08c8c6e06f0d15ef3f349fdbb955f06af42cb4 Mon Sep 17 00:00:00 2001 From: ANAND Date: Tue, 5 Mar 2019 18:40:00 +0530 Subject: [PATCH] Fix furnace meta not being wiped --- mods/ctf/ctf_map/maps | 2 +- mods/mtg/furnace/depends.txt | 1 + mods/mtg/furnace/init.lua | 21 +++++++++++++-------- 3 files changed, 15 insertions(+), 9 deletions(-) diff --git a/mods/ctf/ctf_map/maps b/mods/ctf/ctf_map/maps index 9e25819..512d86a 160000 --- a/mods/ctf/ctf_map/maps +++ b/mods/ctf/ctf_map/maps @@ -1 +1 @@ -Subproject commit 9e2581925aed31e5572507a0aba8120c18f41fa0 +Subproject commit 512d86a21c9de0b628d49def24740a32fc85c3ac diff --git a/mods/mtg/furnace/depends.txt b/mods/mtg/furnace/depends.txt index 4ad96d5..02e0e18 100644 --- a/mods/mtg/furnace/depends.txt +++ b/mods/mtg/furnace/depends.txt @@ -1 +1,2 @@ default +ctf_match? diff --git a/mods/mtg/furnace/init.lua b/mods/mtg/furnace/init.lua index 65afff2..6d84402 100644 --- a/mods/mtg/furnace/init.lua +++ b/mods/mtg/furnace/init.lua @@ -238,6 +238,8 @@ local function furnace_node_timer(pos, elapsed) return result end +local furnaces = {} + local function on_destruct(pos) local inv = minetest.get_inventory({ type = "node", pos = pos }) for _, list in pairs(inv:get_lists()) do @@ -245,6 +247,7 @@ local function on_destruct(pos) minetest.add_item(pos, item) end end + furnaces[minetest.pos_to_string(pos)] = nil end -- @@ -273,6 +276,7 @@ minetest.register_node("furnace:furnace", { inv:set_size('src', 1) inv:set_size('fuel', 1) inv:set_size('dst', 4) + furnaces[minetest.pos_to_string(pos)] = true end, on_metadata_inventory_move = function(pos) @@ -332,11 +336,12 @@ minetest.register_node("furnace:furnace_active", { minetest.register_alias("default:furnace", "furnace:furnace") -minetest.register_craft({ - output = 'furnace:furnace', - recipe = { - {'group:stone', 'group:stone', 'group:stone'}, - {'group:stone', '', 'group:stone'}, - {'group:stone', 'group:stone', 'group:stone'}, - } -}) +if minetest.global_exists("ctf_match") then + ctf_match.register_on_new_match(function() + for i, _ in pairs(furnaces) do + local pos = minetest.string_to_pos(i) + minetest.remove_node(pos) + furnaces[i] = nil + end + end) +end