Resolve some luacheck issues, change piston node name check for node definition callback _onmove(pos,node,def)

This commit is contained in:
teknomunk 2024-11-26 17:55:48 -06:00
parent eae48677b5
commit 2787ce1bae
2 changed files with 5 additions and 11 deletions

@ -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,
}
)

@ -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 = {}