diff options
author | Anthony Zhang <azhang9@gmail.com> | 2012-12-15 19:16:59 -0500 |
---|---|---|
committer | Anthony Zhang <azhang9@gmail.com> | 2012-12-15 19:16:59 -0500 |
commit | 9dee0c020c9d0807594a4de9f3728dd6b0e20223 (patch) | |
tree | 8c834f2c60b77e7c485f539f5680df304df200d0 | |
parent | aab0d4d9439d8a0fbc0b4bb6792e0d27fc69c1cc (diff) | |
download | mesecons-9dee0c020c9d0807594a4de9f3728dd6b0e20223.tar mesecons-9dee0c020c9d0807594a4de9f3728dd6b0e20223.tar.gz mesecons-9dee0c020c9d0807594a4de9f3728dd6b0e20223.tar.bz2 mesecons-9dee0c020c9d0807594a4de9f3728dd6b0e20223.tar.xz mesecons-9dee0c020c9d0807594a4de9f3728dd6b0e20223.zip |
Fix placing while facing diagonally.
-rw-r--r-- | mesecons_pistons/init.lua | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/mesecons_pistons/init.lua b/mesecons_pistons/init.lua index c2358de..840cce2 100644 --- a/mesecons_pistons/init.lua +++ b/mesecons_pistons/init.lua @@ -192,7 +192,7 @@ minetest.register_node("mesecons_pistons:piston_normal", { return minetest.item_place(itemstack, placer, pointed_thing) end local dir = placer:get_look_dir() - if math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then --vertical look direction is most significant + if math.abs(dir.y) > math.sqrt(dir.x ^ 2 + dir.z ^ 2) then --vertical look direction is most significant local fakestack if dir.y > 0 then fakestack = ItemStack("mesecons_pistons:piston_down_normal") @@ -227,7 +227,7 @@ minetest.register_node("mesecons_pistons:piston_sticky", { return minetest.item_place(itemstack, placer, pointed_thing) end local dir = placer:get_look_dir() - if math.abs(dir.y) > math.abs(dir.x) and math.abs(dir.y) > math.abs(dir.z) then --vertical look direction is most significant + if math.abs(dir.y) > math.sqrt(dir.x ^ 2 + dir.z ^ 2) then --vertical look direction is most significant local fakestack if dir.y > 0 then fakestack = ItemStack("mesecons_pistons:piston_down_sticky") |