From 3981ed7fd6aa16959058535bb5220a0f96918c5d Mon Sep 17 00:00:00 2001 From: Vanessa Dannenberg Date: Fri, 28 Sep 2018 02:50:29 -0400 Subject: rewrite displace function for clarity, and make it check for all modern slabs, and a few more slab-like shapes. --- infrastructure/nodes.lua | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'infrastructure') 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 -- cgit v1.2.3