mirror of
https://github.com/minetest-mods/mesecons.git
synced 2024-12-28 08:17:29 +01:00
Fix very rare piston bug (needs testing)
This commit is contained in:
parent
cdd9a93da9
commit
2a8bd68c41
@ -643,13 +643,18 @@ local piston_up_down_get_stopper = function (node, dir, stack, stackid)
|
|||||||
end
|
end
|
||||||
|
|
||||||
local piston_get_stopper = function (node, dir, stack, stackid)
|
local piston_get_stopper = function (node, dir, stack, stackid)
|
||||||
if (stack[stackid + 1]
|
pistonspec = minetest.registered_nodes[node.name].mesecons_piston
|
||||||
and stack[stackid + 1].node.name == minetest.registered_nodes[node.name].mesecons_piston.pusher
|
dir = piston_get_direction(pistonspec.dir, node)
|
||||||
and stack[stackid + 1].node.param2 == node.param2)
|
local pusherpos = mesecon:addPosRule(stack[stackid].pos, dir)
|
||||||
or (stack[stackid - 1]
|
local pushernode = minetest.env:get_node(pusherpos)
|
||||||
and stack[stackid - 1].node.name == minetest.registered_nodes[node.name].mesecons_piston.pusher
|
|
||||||
and stack[stackid + 1].node.param2 == node.param2) then
|
if minetest.registered_nodes[node.name].mesecons_piston.pusher == pushernode.name then
|
||||||
return false
|
for _, s in ipairs(stack) do
|
||||||
|
if mesecon:cmpPos(s.pos, pusherpos) -- pusher is also to be pushed
|
||||||
|
and s.node.param2 == node.param2 then
|
||||||
|
return false
|
||||||
|
end
|
||||||
|
end
|
||||||
end
|
end
|
||||||
return true
|
return true
|
||||||
end
|
end
|
||||||
@ -657,11 +662,11 @@ end
|
|||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_get_stopper)
|
||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_pusher_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_pusher_get_stopper)
|
||||||
|
|
||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_up_down_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_up_normal_on", piston_up_down_get_stopper)
|
||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_up_down_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_up_sticky_on", piston_up_down_get_stopper)
|
||||||
|
|
||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_normal_on", piston_up_down_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_down_normal_on", piston_up_down_get_stopper)
|
||||||
mesecon:register_mvps_stopper("mesecons_pistons:piston_sticky_on", piston_up_down_get_stopper)
|
mesecon:register_mvps_stopper("mesecons_pistons:piston_down_sticky_on", piston_up_down_get_stopper)
|
||||||
|
|
||||||
--craft recipes
|
--craft recipes
|
||||||
minetest.register_craft({
|
minetest.register_craft({
|
||||||
|
Loading…
Reference in New Issue
Block a user