From 27a59c071664a95a12019e8949512f0dfde2c592 Mon Sep 17 00:00:00 2001 From: Diego Martinez Date: Wed, 1 Oct 2014 02:49:17 -0300 Subject: [PATCH] Fix locked ovens reverting to unlocked. --- homedecor/furnaces.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/homedecor/furnaces.lua b/homedecor/furnaces.lua index 0d94c25d..f3fef1c8 100644 --- a/homedecor/furnaces.lua +++ b/homedecor/furnaces.lua @@ -288,11 +288,15 @@ function homedecor.register_furnace(name, furnacedef) end end + -- XXX: Quick patch, make it better in the future. + local locked = node.name:find("_locked$") and "_locked" or "" + local desc = minetest.registered_nodes[name..locked].description + if meta:get_float("fuel_time") < meta:get_float("fuel_totaltime") then local percent = math.floor(meta:get_float("fuel_time") / meta:get_float("fuel_totaltime") * 100) meta:set_string("infotext",S("%s active: %d%%"):format(desc,percent)) - hacky_swap_node(pos,name_active) + hacky_swap_node(pos,name_active..locked) meta:set_string("formspec", make_formspec(furnacedef, percent)) return end @@ -312,7 +316,7 @@ function homedecor.register_furnace(name, furnacedef) if (not fuel) or (fuel.time <= 0) then meta:set_string("infotext",desc..S(": Out of fuel")) - hacky_swap_node(pos,name) + hacky_swap_node(pos,name..locked) meta:set_string("formspec", make_formspec(furnacedef, 0)) return end @@ -320,7 +324,7 @@ function homedecor.register_furnace(name, furnacedef) if cooked.item:is_empty() then if was_active then meta:set_string("infotext",S("%s is empty"):format(desc)) - hacky_swap_node(pos,name) + hacky_swap_node(pos,name..locked) meta:set_string("formspec", make_formspec(furnacedef, 0)) end return @@ -328,7 +332,7 @@ function homedecor.register_furnace(name, furnacedef) if not inv:room_for_item("dst", cooked.item) then meta:set_string("infotext", desc..S(": output bins are full")) - hacky_swap_node(pos, name) + hacky_swap_node(pos, name..locked) meta:set_string("formspec", make_formspec(furnacedef, 0)) return end