From db4c860aa811ddeffd4ffa1ca7972f93e2122db1 Mon Sep 17 00:00:00 2001 From: Wuzzy Date: Mon, 22 Jan 2018 21:32:07 +0100 Subject: [PATCH] More work on redstone torch state --- mods/ITEMS/REDSTONE/mesecons_torch/init.lua | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua index 7b15a1d7a..fb0226461 100644 --- a/mods/ITEMS/REDSTONE/mesecons_torch/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_torch/init.lua @@ -45,14 +45,18 @@ local torch_get_input_rules = function(node) end end -local torch_inversion = function(pos, node) +local torch_action_on = function(pos, node) if node.name == "mesecons_torch:mesecon_torch_on" then minetest.set_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_on_wall" then minetest.set_node(pos, {name="mesecons_torch:mesecon_torch_off_wall", param2=node.param2}) mesecon.receptor_off(pos, torch_get_output_rules(node)) - elseif node.name == "mesecons_torch:mesecon_torch_off" then + end +end + +local torch_action_off = function(pos, node) + if node.name == "mesecons_torch:mesecon_torch_off" then minetest.set_node(pos, {name="mesecons_torch:mesecon_torch_on", param2=node.param2}) mesecon.receptor_on(pos, torch_get_output_rules(node)) elseif node.name == "mesecons_torch:mesecon_torch_off_wall" then @@ -86,7 +90,7 @@ mcl_torches.register_torch("mesecon_torch_off", "Redstone Torch (off)", effector = { state = mesecon.state.on, rules = torch_get_input_rules, - action_off = torch_inversion, + action_off = torch_action_off, }, }, drop = "mesecons_torch:mesecon_torch_on", @@ -116,7 +120,7 @@ mcl_torches.register_torch("mesecon_torch_on", "Redstone Torch", effector = { state = mesecon.state.off, rules = torch_get_input_rules, - action_on = torch_inversion, + action_on = torch_action_on, }, } }