From 2787ce1bae90420f332c0fef6fd29ee51b12844c Mon Sep 17 00:00:00 2001 From: teknomunk Date: Tue, 26 Nov 2024 17:55:48 -0600 Subject: [PATCH] Resolve some luacheck issues, change piston node name check for node definition callback _onmove(pos,node,def) --- mods/ITEMS/REDSTONE/mcl_observers/init.lua | 10 +++------- mods/ITEMS/REDSTONE/mesecons_mvps/init.lua | 6 ++---- 2 files changed, 5 insertions(+), 11 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 980827567..d698b1257 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -1,14 +1,7 @@ local S = minetest.get_translator(minetest.get_current_modname()) -mcl_observers = {} - -local string = string - local get_node = minetest.get_node -local rules_flat = { - { x = 0, y = 0, z = -1, spread = true }, -} local function get_rules_flat(node) local rule = core.facedir_to_dir((node.param2+2)%4) rule.spread = true @@ -147,6 +140,7 @@ mesecon.register_node("mcl_observers:observer", { _mcl_observer_off_name = "mcl_observers:observer_off", on_construct = decay_on_observer, _onload = decay_on_observer, + _onmove = update_observer, } ) @@ -188,6 +182,7 @@ mesecon.register_node("mcl_observers:observer_down", { _mcl_observer_off_name = "mcl_observers:observer_down_off", on_construct = decay_on_observer, _onload = decay_on_observer, + _onmove = update_observer, } ) @@ -229,6 +224,7 @@ mesecon.register_node("mcl_observers:observer_up", { _mcl_observer_off_name = "mcl_observers:observer_up_off", on_construct = decay_on_observer, _onload = decay_on_observer, + _onmove = update_observer, } ) diff --git a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua index 1d2e7820d..ff8cbee83 100644 --- a/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_mvps/init.lua @@ -326,10 +326,8 @@ function mesecon.mvps_push_or_pull(pos, stackdir, movedir, maximum, player_name, if n.node_timer then minetest.get_node_timer(np):set(unpack(n.node_timer)) end - if string.find(n.node.name, "mcl_observers:observer") then - -- It also counts as a block update when the observer itself is moved by a piston (Wiki): - mcl_observers.observer_activate(np) - end + local def = core.registered_nodes[n.node.name] + if def and def._onmove then def._onmove(np, n.node, def) end end local moved_nodes = {}