mirror of
https://github.com/mt-mods/pipeworks.git
synced 2024-09-27 06:40:36 +02:00
if someone screwdrivers a valve or sensor out of horizontal, reset it back
to horizontal
This commit is contained in:
parent
fd0366cfd9
commit
4144fb84b0
|
@ -208,9 +208,14 @@ minetest.register_abm({
|
|||
chance = 1,
|
||||
action = function(pos, node, active_object_count, active_object_count_wider)
|
||||
local fdir = node.param2
|
||||
local axisdir = math.floor(fdir/4)
|
||||
local fdir_mod4 = fdir % 4
|
||||
local fdir_mod4_p2 = (fdir+2) % 4
|
||||
|
||||
if axisdir ~= 0 and axisdir ~= 5 then -- if it isn't horizontal, force it.
|
||||
minetest.swap_node(pos, {name = node.name, param2 = fdir_mod4})
|
||||
end
|
||||
|
||||
local fdir_to_pos = {
|
||||
{x = pos.x+1, y = pos.y, z = pos.z },
|
||||
{x = pos.x, y = pos.y, z = pos.z-1},
|
||||
|
|
Loading…
Reference in New Issue
Block a user