]> git.lizzy.rs Git - signs_lib.git/commitdiff
rework horizontal pole detection slightly
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>
Sat, 21 Sep 2019 23:24:48 +0000 (19:24 -0400)
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>
Sat, 21 Sep 2019 23:24:48 +0000 (19:24 -0400)
api.lua

diff --git a/api.lua b/api.lua
index 0acc2c48a58395ec23208c411f241befbbb75cff..c6ee2eb7057e9f172e88d331e5eb5b8cd113f5ee 100644 (file)
--- a/api.lua
+++ b/api.lua
@@ -769,18 +769,26 @@ function signs_lib.check_for_horizontal_pole(pos, pointed_thing)
        local def = minetest.registered_items[node.name]
        local ppos = minetest.get_pointed_thing_position(pointed_thing)
        local pnode = minetest.get_node(ppos)
-       if pnode.name == "streets:bigpole" then
+       if pnode.name == "streets:bigpole" and pnode.param2 > 3 and pnode.param2 < 12 then
                if def.paramtype2 == "wallmounted" then
-                       if   ((node.param2 == 2 or node.param2 == 3) and (pnode.param2 > 3 and pnode.param2 < 12)) -- E/W
-                         or ((node.param2 == 4 or node.param2 == 5) and (pnode.param2 > 11 and pnode.param2 < 20)) -- N/S
+                       if node.param2 == 2 or node.param2 == 3 -- E/W
                                then return true
                        end
                else
-                       if   ((node.param2 == 1 or node.param2 == 3) and (pnode.param2 > 3 and pnode.param2 < 12)) -- E/W
-                         or ((node.param2 == 0 or node.param2 == 2) and (pnode.param2 > 11 and pnode.param2 < 20)) -- N/S
+                       if node.param2 == 1 or node.param2 == 3 -- E/W
                                then return true
                        end
                end
+       elseif pnode.name == "streets:bigpole" and pnode.param2 > 11 and pnode.param2 < 20 then
+               if def.paramtype2 == "wallmounted" then
+                       if node.param2 == 4 or node.param2 == 5 then
+                               return true
+                       end
+               else
+                       if node.param2 == 0 or node.param2 == 2 then
+                               return true
+                       end
+               end
        end
 end