From 58238284b83d3abd13f2b2325092ea3b36739d86 Mon Sep 17 00:00:00 2001 From: h-v-smacker Date: Thu, 29 Nov 2018 23:28:55 +0300 Subject: [PATCH] abm -> node timer 2 --- mesecons_torch/init.lua | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/mesecons_torch/init.lua b/mesecons_torch/init.lua index c1ba118..160ef5f 100644 --- a/mesecons_torch/init.lua +++ b/mesecons_torch/init.lua @@ -50,6 +50,7 @@ local torch_selectionbox = } local torch_update = function(pos) + local node = minetest.get_node(pos) local is_powered = false for _, rule in ipairs(torch_get_input_rules(node)) do @@ -59,16 +60,15 @@ local torch_update = function(pos) end end - if is_powered then - if node.name == "mesecons_torch:mesecon_torch_on" then - minetest.swap_node(pos, {name = "mesecons_torch:mesecon_torch_off", param2 = node.param2}) - mesecon.receptor_off(pos, torch_get_output_rules(node)) - end + if is_powered and node.name == "mesecons_torch:mesecon_torch_on" then + minetest.swap_node(pos, {name = "mesecons_torch:mesecon_torch_off", param2 = node.param2}) + mesecon.receptor_off(pos, torch_get_output_rules(node)) elseif node.name == "mesecons_torch:mesecon_torch_off" then minetest.swap_node(pos, {name = "mesecons_torch:mesecon_torch_on", param2 = node.param2}) mesecon.receptor_on(pos, torch_get_output_rules(node)) end - return true + + end minetest.register_node("mesecons_torch:mesecon_torch_off", {