summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-02-03 02:55:46 -0500
committerVanessa Ezekowitz <vanessaezekowitz@gmail.com>2015-06-18 12:42:20 -0400
commit4144fb84b0385286fa94b8d086f1ddc9753b8e0e (patch)
tree5136f80136b805a589fe3441fced560223b68055
parentfd0366cfd99e097994f1201518c05439e8ddac6c (diff)
if someone screwdrivers a valve or sensor out of horizontal, reset it back
to horizontal
-rw-r--r--flowing_logic.lua5
1 files changed, 5 insertions, 0 deletions
diff --git a/flowing_logic.lua b/flowing_logic.lua
index dce7bc4..009f7c0 100644
--- a/flowing_logic.lua
+++ b/flowing_logic.lua
@@ -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},