Fix furnace meta not being wiped

This commit is contained in:
ANAND 2019-03-05 18:40:00 +05:30 committed by rubenwardy
parent c9bcfbb36e
commit cb08c8c6e0
3 changed files with 15 additions and 9 deletions

@ -1 +1 @@
Subproject commit 9e2581925aed31e5572507a0aba8120c18f41fa0 Subproject commit 512d86a21c9de0b628d49def24740a32fc85c3ac

View file

@ -1 +1,2 @@
default default
ctf_match?

View file

@ -238,6 +238,8 @@ local function furnace_node_timer(pos, elapsed)
return result return result
end end
local furnaces = {}
local function on_destruct(pos) local function on_destruct(pos)
local inv = minetest.get_inventory({ type = "node", pos = pos }) local inv = minetest.get_inventory({ type = "node", pos = pos })
for _, list in pairs(inv:get_lists()) do for _, list in pairs(inv:get_lists()) do
@ -245,6 +247,7 @@ local function on_destruct(pos)
minetest.add_item(pos, item) minetest.add_item(pos, item)
end end
end end
furnaces[minetest.pos_to_string(pos)] = nil
end end
-- --
@ -273,6 +276,7 @@ minetest.register_node("furnace:furnace", {
inv:set_size('src', 1) inv:set_size('src', 1)
inv:set_size('fuel', 1) inv:set_size('fuel', 1)
inv:set_size('dst', 4) inv:set_size('dst', 4)
furnaces[minetest.pos_to_string(pos)] = true
end, end,
on_metadata_inventory_move = function(pos) 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_alias("default:furnace", "furnace:furnace")
minetest.register_craft({ if minetest.global_exists("ctf_match") then
output = 'furnace:furnace', ctf_match.register_on_new_match(function()
recipe = { for i, _ in pairs(furnaces) do
{'group:stone', 'group:stone', 'group:stone'}, local pos = minetest.string_to_pos(i)
{'group:stone', '', 'group:stone'}, minetest.remove_node(pos)
{'group:stone', 'group:stone', 'group:stone'}, furnaces[i] = nil
} end
}) end)
end