From 962ae359af048f9e23bf4e38aafd99580db59d1a Mon Sep 17 00:00:00 2001 From: AFCMS Date: Sun, 23 May 2021 11:41:01 +0200 Subject: [PATCH] [mesecons] fix warnings --- mods/ITEMS/REDSTONE/mesecons/internal.lua | 12 ++++-------- mods/ITEMS/REDSTONE/mesecons/services.lua | 2 +- 2 files changed, 5 insertions(+), 9 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mesecons/internal.lua b/mods/ITEMS/REDSTONE/mesecons/internal.lua index f4ed9df4e..a5bcb80e8 100644 --- a/mods/ITEMS/REDSTONE/mesecons/internal.lua +++ b/mods/ITEMS/REDSTONE/mesecons/internal.lua @@ -329,7 +329,7 @@ function mesecon.get_conductor_on(node_off, rulename) return conductor.states[tonumber(binstate,2)+1] end end - return offstate + return conductor.offstate end function mesecon.get_conductor_off(node_on, rulename) @@ -345,7 +345,7 @@ function mesecon.get_conductor_off(node_on, rulename) return conductor.states[tonumber(binstate,2)+1] end end - return onstate + return conductor.onstate end function mesecon.conductor_get_rules(node) @@ -391,9 +391,7 @@ function mesecon.turnon(pos, link) local f = table.remove(frontiers, 1) local node = get_node_force(f.pos) - if not node then - -- Area does not exist; do nothing - elseif mesecon.is_conductor_off(node, f.link) then + if node and mesecon.is_conductor_off(node, f.link) then local rules = mesecon.conductor_get_rules(node) -- Call turnon on neighbors @@ -453,9 +451,7 @@ function mesecon.turnoff(pos, link) local f = table.remove(frontiers, 1) local node = get_node_force(f.pos) - if not node then - -- No-op - elseif mesecon.is_conductor_on(node, f.link) then + if node and mesecon.is_conductor_on(node, f.link) then local rules = mesecon.conductor_get_rules(node) for _, r in pairs(mesecon.rule2meta(f.link, rules)) do local np = vector.add(f.pos, r) diff --git a/mods/ITEMS/REDSTONE/mesecons/services.lua b/mods/ITEMS/REDSTONE/mesecons/services.lua index 9addda8bd..1e3e6237b 100644 --- a/mods/ITEMS/REDSTONE/mesecons/services.lua +++ b/mods/ITEMS/REDSTONE/mesecons/services.lua @@ -77,7 +77,7 @@ mesecon.on_dignode = function(pos, node) mesecon.receptor_off(pos, mesecon.receptor_get_rules(node)) end if minetest.get_item_group(node.name, "opaque") == 1 then - local sources = mesecon.is_powered(pos) + --local sources = mesecon.is_powered(pos) local neighbors = mesecon.mcl_get_neighbors(pos) for n=1, #neighbors do local npos = neighbors[n].pos