summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-28 02:50:29 -0400
committerVanessa Dannenberg <vanessa.e.dannenberg@gmail.com>2018-09-28 02:50:29 -0400
commit3981ed7fd6aa16959058535bb5220a0f96918c5d (patch)
treebd4845be4e7ce89a3bccc384992688368151d733
parenta62e29300e4b8590e2c2ccdac1ad1fda38546225 (diff)
downloadroads-3981ed7fd6aa16959058535bb5220a0f96918c5d.tar
roads-3981ed7fd6aa16959058535bb5220a0f96918c5d.tar.gz
roads-3981ed7fd6aa16959058535bb5220a0f96918c5d.tar.bz2
roads-3981ed7fd6aa16959058535bb5220a0f96918c5d.tar.xz
roads-3981ed7fd6aa16959058535bb5220a0f96918c5d.zip
rewrite displace function for clarity, and make it check for all modern
slabs, and a few more slab-like shapes.
-rw-r--r--infrastructure/nodes.lua29
1 files changed, 20 insertions, 9 deletions
diff --git a/infrastructure/nodes.lua b/infrastructure/nodes.lua
index d941aaf..5b28f1a 100644
--- a/infrastructure/nodes.lua
+++ b/infrastructure/nodes.lua
@@ -388,15 +388,26 @@
pos.y = pos.y - 1
local node = minetest.get_node(pos)
- if ((string.find(node.name, "_three_quarter") ~= nil) or (string.find(node.name, "_displacement_1") ~= nil)) then
- pos.y = pos.y + 1
- minetest.set_node(pos, {name = displaced_node.name.."_displacement_1", param2 = fdir})
- elseif (((string.find(node.name, "slab_") ~= nil) and (string.find(node.name, "_quarter") == nil)) or (string.find(node.name, "_displacement_2") ~= nil)) then
- pos.y = pos.y + 1
- minetest.set_node(pos, {name = displaced_node.name.."_displacement_2", param2 = fdir})
- elseif (((string.find(node.name, "_quarter") ~= nil) and (string.find(node.name, "_three_quarter") == nil)) or (string.find(node.name, "_displacement_3") ~= nil)) then
- pos.y = pos.y + 1
- minetest.set_node(pos, {name = displaced_node.name.."_displacement_3", param2 = fdir})
+ if string.find(node.name, "slab_") then
+ if (string.find(node.name, "_1")
+ and not (string.find(node.name, "_14")
+ or string.find(node.name, "_15")))
+ or string.find(node.name, "_2")
+ or (string.find(node.name, "_quarter") and not string.find(node.name, "_three_quarter"))
+ or string.find(node.name, "_two_sides")
+ or string.find(node.name, "_three_sides")
+ or string.find(node.name, "_displacement_3") then
+ pos.y = pos.y + 1
+ minetest.set_node(pos, {name = displaced_node.name.."_displacement_3", param2 = fdir})
+ elseif string.find(node.name, "_three_quarter") or string.find(node.name, "_displacement_1") then
+ pos.y = pos.y + 1
+ minetest.set_node(pos, {name = displaced_node.name.."_displacement_1", param2 = fdir})
+ elseif not (string.find(node.name, "_14")
+ or string.find(node.name, "_15"))
+ or string.find(node.name, "_displacement_2") then
+ pos.y = pos.y + 1
+ minetest.set_node(pos, {name = displaced_node.name.."_displacement_2", param2 = fdir})
+ end
end
end