mirror of
https://git.minetest.land/MineClone2/MineClone2.git
synced 2025-01-06 08:37:30 +01:00
Resolve some luacheck issues, change piston node name check for node definition callback _onmove(pos,node,def)
This commit is contained in:
parent
eae48677b5
commit
2787ce1bae
@ -1,14 +1,7 @@
|
|||||||
local S = minetest.get_translator(minetest.get_current_modname())
|
local S = minetest.get_translator(minetest.get_current_modname())
|
||||||
|
|
||||||
mcl_observers = {}
|
|
||||||
|
|
||||||
local string = string
|
|
||||||
|
|
||||||
local get_node = minetest.get_node
|
local get_node = minetest.get_node
|
||||||
|
|
||||||
local rules_flat = {
|
|
||||||
{ x = 0, y = 0, z = -1, spread = true },
|
|
||||||
}
|
|
||||||
local function get_rules_flat(node)
|
local function get_rules_flat(node)
|
||||||
local rule = core.facedir_to_dir((node.param2+2)%4)
|
local rule = core.facedir_to_dir((node.param2+2)%4)
|
||||||
rule.spread = true
|
rule.spread = true
|
||||||
@ -147,6 +140,7 @@ mesecon.register_node("mcl_observers:observer", {
|
|||||||
_mcl_observer_off_name = "mcl_observers:observer_off",
|
_mcl_observer_off_name = "mcl_observers:observer_off",
|
||||||
on_construct = decay_on_observer,
|
on_construct = decay_on_observer,
|
||||||
_onload = 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",
|
_mcl_observer_off_name = "mcl_observers:observer_down_off",
|
||||||
on_construct = decay_on_observer,
|
on_construct = decay_on_observer,
|
||||||
_onload = 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",
|
_mcl_observer_off_name = "mcl_observers:observer_up_off",
|
||||||
on_construct = decay_on_observer,
|
on_construct = decay_on_observer,
|
||||||
_onload = 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
|
if n.node_timer then
|
||||||
minetest.get_node_timer(np):set(unpack(n.node_timer))
|
minetest.get_node_timer(np):set(unpack(n.node_timer))
|
||||||
end
|
end
|
||||||
if string.find(n.node.name, "mcl_observers:observer") then
|
local def = core.registered_nodes[n.node.name]
|
||||||
-- It also counts as a block update when the observer itself is moved by a piston (Wiki):
|
if def and def._onmove then def._onmove(np, n.node, def) end
|
||||||
mcl_observers.observer_activate(np)
|
|
||||||
end
|
|
||||||
end
|
end
|
||||||
|
|
||||||
local moved_nodes = {}
|
local moved_nodes = {}
|
||||||
|
Loading…
Reference in New Issue
Block a user