summaryrefslogtreecommitdiff
path: root/infrastructure/nodes.lua
diff options
context:
space:
mode:
Diffstat (limited to 'infrastructure/nodes.lua')
-rw-r--r--infrastructure/nodes.lua118
1 files changed, 42 insertions, 76 deletions
diff --git a/infrastructure/nodes.lua b/infrastructure/nodes.lua
index e0455ee..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
@@ -1349,91 +1360,46 @@
end
-- Traffic cone
+
+ local cbox = {
+ type = "fixed",
+ fixed = { -0.25, -0.5, -0.25, 0.25, 0.4065, 0.25 }
+ }
+
minetest.register_node("infrastructure:traffic_cone", {
description = "Traffic cone",
- tiles = {
- "infrastructure_traffic_cone_top.png",
- "infrastructure_traffic_cone_bottom.png",
- "infrastructure_traffic_cone_side.png",
- "infrastructure_traffic_cone_side.png",
- "infrastructure_traffic_cone_side.png",
- "infrastructure_traffic_cone_side.png"
- },
- drawtype = "nodebox",
+ tiles = { "infrastructure_traffic_cone.png" },
+ drawtype = "mesh",
+ mesh = "infrastructure_traffic_cone.obj",
paramtype = "light",
groups = {cracky = 2},
walkable = false,
light_source = ENERGY_ABSORBING_TERMINAL_LIGHT_RANGE,
- node_box = {
- type = "fixed",
- fixed = {
- {-1/4, -1/2, 0, 1/4, 1/4, 0},
- {0, -1/2, -1/4, 0, 1/4, 1/4},
-
- {-3/8, -1/2, -1/8, 3/8, -3/8, 1/8},
- {-1/8, -1/2, -3/8, 1/8, -3/8, 3/8},
-
- {-3/8, -1/2 + 0.001, -3/8, 3/8, -1/2 + 0.001, 3/8}
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-1/4, -1/2, 0, 1/4, 1/4, 0},
- {0, -1/2, -1/4, 0, 1/4, 1/4},
-
- {-3/8, -1/2, -1/8, 3/8, -3/8, 1/8},
- {-1/8, -1/2, -3/8, 1/8, -3/8, 3/8},
-
- {-3/8, -1/2 + 0.001, -3/8, 3/8, -1/2 + 0.001, 3/8}
- }
- },
-
+ collision_box = cbox,
+ selection_box = cbox,
after_place_node = function(pos, placer)
displacement(pos, placer)
end
})
for i = 1, 3 do
+
+ local cbox = {
+ type = "fixed",
+ fixed = { -0.25, -0.5 - i/4, -0.25, 0.25, 0.4065 - i/4, 0.25 }
+ }
+
minetest.register_node("infrastructure:traffic_cone_displacement_"..tostring(i), {
- tiles = {
- "infrastructure_traffic_cone_top.png",
- "infrastructure_traffic_cone_bottom.png",
- "[combine:32x32:0,"..tostring(i * 8).."=infrastructure_traffic_cone_side.png:0,"..tostring(i * 8 - 32).."=infrastructure_traffic_cone_side.png",
- "[combine:32x32:0,"..tostring(i * 8).."=infrastructure_traffic_cone_side.png:0,"..tostring(i * 8 - 32).."=infrastructure_traffic_cone_side.png",
- "[combine:32x32:0,"..tostring(i * 8).."=infrastructure_traffic_cone_side.png:0,"..tostring(i * 8 - 32).."=infrastructure_traffic_cone_side.png",
- "[combine:32x32:0,"..tostring(i * 8).."=infrastructure_traffic_cone_side.png:0,"..tostring(i * 8 - 32).."=infrastructure_traffic_cone_side.png"
- },
- drawtype = "nodebox",
+ tiles = { "infrastructure_traffic_cone.png" },
+ drawtype = "mesh",
+ mesh = "infrastructure_traffic_cone_i"..i..".obj",
paramtype = "light",
groups = {cracky = 2, not_in_creative_inventory = 1},
walkable = false,
light_source = ENERGY_ABSORBING_TERMINAL_LIGHT_RANGE,
drop = "infrastructure:traffic_cone",
- node_box = {
- type = "fixed",
- fixed = {
- {-1/4, -1/2 - i/4, 0, 1/4, 1/4 - i/4, 0},
- {0, -1/2 - i/4, -1/4, 0, 1/4 - i/4, 1/4},
-
- {-3/8, -1/2 - i/4, -1/8, 3/8, -3/8 - i/4, 1/8},
- {-1/8, -1/2 - i/4, -3/8, 1/8, -3/8 - i/4, 3/8},
-
- {-3/8, -1/2 + 0.001 - i/4, -3/8, 3/8, -1/2 + 0.001 - i/4, 3/8}
- }
- },
- selection_box = {
- type = "fixed",
- fixed = {
- {-1/4, -1/2 - i/4, 0, 1/4, 1/4 - i/4, 0},
- {0, -1/2 - i/4, -1/4, 0, 1/4 - i/4, 1/4},
-
- {-3/8, -1/2 - i/4, -1/8, 3/8, -3/8 - i/4, 1/8},
- {-1/8, -1/2 - i/4, -3/8, 1/8, -3/8 - i/4, 3/8},
-
- {-3/8, -1/2 + 0.001 - i/4, -3/8, 3/8, -1/2 + 0.001 - i/4, 3/8}
- }
- }
+ collision_box = cbox,
+ selection_box = cbox,
})
end