Use mesh models for trafficlights

This commit is contained in:
Joachim Stolberg 2025-01-12 19:20:25 +01:00
parent ca318235cc
commit 0ecb178312
15 changed files with 301 additions and 82 deletions

View File

@ -104,56 +104,6 @@ local function switch_off(pos)
end end
end end
local node_box = {
type = "fixed",
fixed = {{-6/32, -16/32, -6/32, 6/32, 16/32, 6/32}},
}
local node_boxB = {
type = "fixed",
fixed = {{-6/32, -16/32, 8/32, 6/32, 16/32, 20/32}},
}
local tiles1 = {
-- up, down, right, left, back, front
"techage_trafficlight1.png^[transformR90",
"techage_trafficlight1.png^[transformFXR90",
"techage_trafficlight1.png",
"techage_trafficlight1.png^[transformFX",
"techage_trafficlight1.png",
"techage_trafficlight1_off.png",
}
local tiles1B = {
-- up, down, right, left, back, front
"techage_trafficlight1B.png^[transformR90",
"techage_trafficlight1B.png^[transformFXR90",
"techage_trafficlight1B.png",
"techage_trafficlight1B.png^[transformFX",
"techage_trafficlight1.png",
"techage_trafficlight1_off.png",
}
local tiles2 = {
-- up, down, right, left, back, front
"techage_trafficlight2.png^[transformR90",
"techage_trafficlight2.png^[transformFXR90",
"techage_trafficlight2.png",
"techage_trafficlight2.png^[transformFX",
"techage_trafficlight2.png",
"techage_trafficlight2_off.png",
}
local tiles2B = {
-- up, down, right, left, back, front
"techage_trafficlight2B.png^[transformR90",
"techage_trafficlight2B.png^[transformFXR90",
"techage_trafficlight2B.png",
"techage_trafficlight2B.png^[transformFX",
"techage_trafficlight2.png",
"techage_trafficlight2_off.png",
}
local function on_rightclick(pos, node, clicker) local function on_rightclick(pos, node, clicker)
if not minetest.is_protected(pos, clicker:get_player_name()) then if not minetest.is_protected(pos, clicker:get_player_name()) then
local state = M(pos):get_string("state") local state = M(pos):get_string("state")
@ -169,12 +119,11 @@ local function after_dig_node(pos, oldnode, oldmetadata)
techage.remove_node(pos, oldnode, oldmetadata) techage.remove_node(pos, oldnode, oldmetadata)
end end
minetest.register_node("techage:ta4_trafficlight1", { minetest.register_node("techage:ta4_trafficlight1", {
description = TITLE, description = TITLE,
tiles = table.copy(tiles1), tiles = {"techage_trafficlight1.png"},
drawtype = "nodebox", drawtype = "mesh",
node_box = node_box, mesh = "techage_traffic_light.obj",
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local number local number
@ -205,12 +154,12 @@ minetest.register_node("techage:ta4_trafficlight1", {
}) })
for _,color in ipairs({"green", "amber", "red"}) do for _,color in ipairs({"green", "amber", "red"}) do
tiles1[6] = "techage_trafficlight1_" .. color .. '.png' tiles = {"techage_trafficlight1_" .. color .. '.png'}
minetest.register_node("techage:ta4_trafficlight1_" .. color, { minetest.register_node("techage:ta4_trafficlight1_" .. color, {
description = TITLE, description = TITLE,
tiles = table.copy(tiles1), tiles = tiles,
drawtype = "nodebox", drawtype = "mesh",
node_box = node_box, mesh = "techage_traffic_light.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
@ -229,9 +178,9 @@ end
minetest.register_node("techage:ta4_trafficlight1B", { minetest.register_node("techage:ta4_trafficlight1B", {
description = TITLE, description = TITLE,
tiles = table.copy(tiles1B), tiles = {"techage_trafficlight1.png"},
drawtype = "nodebox", drawtype = "mesh",
node_box = node_boxB, mesh = "techage_traffic_lightB.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
@ -248,13 +197,13 @@ minetest.register_node("techage:ta4_trafficlight1B", {
}) })
for _,color in ipairs({"green", "amber", "red"}) do for _,color in ipairs({"green", "amber", "red"}) do
tiles1B[6] = "techage_trafficlight1_" .. color .. '.png' tiles = {"techage_trafficlight1_" .. color .. '.png'}
minetest.register_node("techage:ta4_trafficlight1B_" .. color, { minetest.register_node("techage:ta4_trafficlight1B_" .. color, {
description = TITLE, description = TITLE,
tiles = table.copy(tiles1B), tiles = tiles,
drawtype = "nodebox", drawtype = "mesh",
node_box = node_boxB, mesh = "techage_traffic_lightB.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
@ -272,9 +221,9 @@ end
minetest.register_node("techage:ta4_trafficlight2", { minetest.register_node("techage:ta4_trafficlight2", {
description = TITLE, description = TITLE,
tiles = table.copy(tiles2), tiles = {"techage_trafficlight2.png"},
drawtype = "nodebox", drawtype = "mesh",
node_box = node_box, mesh = "techage_traffic_light.obj",
after_place_node = function(pos, placer) after_place_node = function(pos, placer)
local number local number
@ -305,13 +254,13 @@ minetest.register_node("techage:ta4_trafficlight2", {
}) })
for _,color in ipairs({"green", "amber", "red"}) do for _,color in ipairs({"green", "amber", "red"}) do
tiles2[6] = "techage_trafficlight2_" .. color .. '.png' tiles = {"techage_trafficlight2_" .. color .. '.png'}
minetest.register_node("techage:ta4_trafficlight2_" .. color, { minetest.register_node("techage:ta4_trafficlight2_" .. color, {
description = TITLE, description = TITLE,
tiles = table.copy(tiles2), tiles = tiles,
drawtype = "nodebox", drawtype = "mesh",
node_box = node_box, mesh = "techage_traffic_light.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
@ -329,9 +278,9 @@ end
minetest.register_node("techage:ta4_trafficlight2B", { minetest.register_node("techage:ta4_trafficlight2B", {
description = TITLE, description = TITLE,
tiles = table.copy(tiles2B), tiles = {"techage_trafficlight2.png"},
drawtype = "nodebox", drawtype = "mesh",
node_box = node_boxB, mesh = "techage_traffic_lightB.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,
@ -348,13 +297,13 @@ minetest.register_node("techage:ta4_trafficlight2B", {
}) })
for _,color in ipairs({"green", "amber", "red"}) do for _,color in ipairs({"green", "amber", "red"}) do
tiles2B[6] = "techage_trafficlight2_" .. color .. '.png' tiles = {"techage_trafficlight2_" .. color .. '.png'}
minetest.register_node("techage:ta4_trafficlight2B_" .. color, { minetest.register_node("techage:ta4_trafficlight2B_" .. color, {
description = TITLE, description = TITLE,
tiles = table.copy(tiles2B), tiles = tiles,
drawtype = "nodebox", drawtype = "mesh",
node_box = node_boxB, mesh = "techage_traffic_lightB.obj",
on_rightclick = on_rightclick, on_rightclick = on_rightclick,
after_dig_node = after_dig_node, after_dig_node = after_dig_node,

View File

@ -0,0 +1,135 @@
# Blender 4.3.2
# www.blender.org
o Cube
v -0.187500 -0.500000 -0.187500
v -0.187500 0.500000 -0.187500
v 0.187500 -0.500000 -0.187500
v 0.187500 0.500000 -0.187500
v -0.187500 -0.500000 0.187500
v -0.187500 0.500000 0.187500
v 0.187500 -0.500000 0.187500
v 0.187500 0.500000 0.187500
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.333333 1.000000
vt 0.000000 0.111111
vt 0.333333 0.111111
vt 0.666667 1.000000
vt 0.666667 0.111111
vt 1.000000 0.666667
vt 0.666667 0.666667
vt 1.000000 1.000000
vt 0.000000 1.000000
s 0
f 2/1/1 3/2/1 1/3/1
f 4/4/2 7/3/2 3/5/2
f 8/4/3 5/3/3 7/5/3
f 6/4/4 1/3/4 5/5/4
f 7/6/5 1/4/5 3/7/5
f 4/8/6 6/7/6 8/6/6
f 2/1/1 4/9/1 3/2/1
f 4/4/2 8/1/2 7/3/2
f 8/4/3 6/1/3 5/3/3
f 6/4/4 2/1/4 1/3/4
f 7/6/5 5/8/5 1/4/5
f 4/8/6 2/4/6 6/7/6
o Cube.001
v -0.127817 -0.441256 -0.437500
v -0.127817 -0.185622 -0.437500
v 0.127817 -0.441256 -0.437500
v 0.127817 -0.185622 -0.437500
v -0.127817 -0.441256 -0.187500
v -0.127817 -0.185622 -0.187500
v 0.127817 -0.441256 -0.187500
v 0.127817 -0.185622 -0.187500
v -0.125728 -0.439152 -0.437500
v -0.125728 -0.187696 -0.437500
v 0.125728 -0.439152 -0.437500
v 0.125728 -0.187696 -0.437500
v -0.125728 -0.439152 -0.187500
v -0.125728 -0.187696 -0.187500
v 0.125728 -0.439152 -0.187500
v 0.125728 -0.187696 -0.187500
v -0.127817 -0.128756 -0.437500
v -0.127817 0.126878 -0.437500
v 0.127817 -0.128756 -0.437500
v 0.127817 0.126878 -0.437500
v -0.127817 -0.128756 -0.187500
v -0.127817 0.126878 -0.187500
v 0.127817 -0.128756 -0.187500
v 0.127817 0.126878 -0.187500
v -0.125728 -0.126652 -0.437500
v -0.125728 0.124804 -0.437500
v 0.125728 -0.126652 -0.437500
v 0.125728 0.124804 -0.437500
v -0.125728 -0.126652 -0.187500
v -0.125728 0.124804 -0.187500
v 0.125728 -0.126652 -0.187500
v 0.125728 0.124804 -0.187500
v -0.127817 0.183744 -0.437500
v -0.127817 0.439378 -0.437500
v 0.127817 0.183744 -0.437500
v 0.127817 0.439378 -0.437500
v -0.127817 0.183744 -0.187500
v -0.127817 0.439378 -0.187500
v 0.127817 0.183744 -0.187500
v 0.127817 0.439378 -0.187500
v -0.125728 0.185848 -0.437500
v -0.125728 0.437304 -0.437500
v 0.125728 0.185848 -0.437500
v 0.125728 0.437304 -0.437500
v -0.125728 0.185848 -0.187500
v -0.125728 0.437304 -0.187500
v 0.125728 0.185848 -0.187500
v 0.125728 0.437304 -0.187500
vn 1.0000 -0.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vt 0.888889 0.444444
vt 0.666667 0.222222
vt 0.888889 0.222222
vt 0.666667 0.444444
vt 0.888889 0.666667
vt 0.666667 0.666667
s 0
f 12/10/7 15/11/7 11/12/7
f 14/13/8 9/12/8 13/11/8
f 12/14/9 14/13/9 16/10/9
f 23/11/8 20/10/8 19/12/8
f 17/12/7 22/13/7 21/11/7
f 22/13/10 20/14/10 24/10/10
f 28/10/7 31/11/7 27/12/7
f 30/13/8 25/12/8 29/11/8
f 28/14/9 30/13/9 32/10/9
f 39/11/8 36/10/8 35/12/8
f 33/12/7 38/13/7 37/11/7
f 38/13/10 36/14/10 40/10/10
f 44/10/7 47/11/7 43/12/7
f 46/13/8 41/12/8 45/11/8
f 44/14/9 46/13/9 48/10/9
f 55/11/8 52/10/8 51/12/8
f 49/12/7 54/13/7 53/11/7
f 54/13/10 52/14/10 56/10/10
f 12/10/7 16/13/7 15/11/7
f 14/13/8 10/10/8 9/12/8
f 12/14/9 10/15/9 14/13/9
f 23/11/8 24/13/8 20/10/8
f 17/12/7 18/10/7 22/13/7
f 22/13/10 18/15/10 20/14/10
f 28/10/7 32/13/7 31/11/7
f 30/13/8 26/10/8 25/12/8
f 28/14/9 26/15/9 30/13/9
f 39/11/8 40/13/8 36/10/8
f 33/12/7 34/10/7 38/13/7
f 38/13/10 34/15/10 36/14/10
f 44/10/7 48/13/7 47/11/7
f 46/13/8 42/10/8 41/12/8
f 44/14/9 42/15/9 46/13/9
f 55/11/8 56/13/8 52/10/8
f 49/12/7 50/10/7 54/13/7
f 54/13/10 50/15/10 52/14/10

View File

@ -0,0 +1,135 @@
# Blender 4.3.2
# www.blender.org
o Cube
v -0.187500 -0.500000 0.375000
v -0.187500 0.500000 0.375000
v 0.187500 -0.500000 0.375000
v 0.187500 0.500000 0.375000
v -0.187500 -0.500000 0.750000
v -0.187500 0.500000 0.750000
v 0.187500 -0.500000 0.750000
v 0.187500 0.500000 0.750000
vn -0.0000 -0.0000 -1.0000
vn 1.0000 -0.0000 -0.0000
vn -0.0000 -0.0000 1.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vt 0.333333 1.000000
vt 0.000000 0.111111
vt 0.333333 0.111111
vt 0.666667 1.000000
vt 0.666667 0.111111
vt 1.000000 0.666667
vt 0.666667 0.666667
vt 1.000000 1.000000
vt 0.000000 1.000000
s 0
f 2/1/1 3/2/1 1/3/1
f 4/4/2 7/3/2 3/5/2
f 8/4/3 5/3/3 7/5/3
f 6/4/4 1/3/4 5/5/4
f 7/6/5 1/4/5 3/7/5
f 4/8/6 6/7/6 8/6/6
f 2/1/1 4/9/1 3/2/1
f 4/4/2 8/1/2 7/3/2
f 8/4/3 6/1/3 5/3/3
f 6/4/4 2/1/4 1/3/4
f 7/6/5 5/8/5 1/4/5
f 4/8/6 2/4/6 6/7/6
o Cube.001
v -0.127817 -0.441256 0.125000
v -0.127817 -0.185622 0.125000
v 0.127817 -0.441256 0.125000
v 0.127817 -0.185622 0.125000
v -0.127817 -0.441256 0.375000
v -0.127817 -0.185622 0.375000
v 0.127817 -0.441256 0.375000
v 0.127817 -0.185622 0.375000
v -0.125728 -0.439152 0.125000
v -0.125728 -0.187696 0.125000
v 0.125728 -0.439152 0.125000
v 0.125728 -0.187696 0.125000
v -0.125728 -0.439152 0.375000
v -0.125728 -0.187696 0.375000
v 0.125728 -0.439152 0.375000
v 0.125728 -0.187696 0.375000
v -0.127817 -0.128756 0.125000
v -0.127817 0.126878 0.125000
v 0.127817 -0.128756 0.125000
v 0.127817 0.126878 0.125000
v -0.127817 -0.128756 0.375000
v -0.127817 0.126878 0.375000
v 0.127817 -0.128756 0.375000
v 0.127817 0.126878 0.375000
v -0.125728 -0.126652 0.125000
v -0.125728 0.124804 0.125000
v 0.125728 -0.126652 0.125000
v 0.125728 0.124804 0.125000
v -0.125728 -0.126652 0.375000
v -0.125728 0.124804 0.375000
v 0.125728 -0.126652 0.375000
v 0.125728 0.124804 0.375000
v -0.127817 0.183744 0.125000
v -0.127817 0.439378 0.125000
v 0.127817 0.183744 0.125000
v 0.127817 0.439378 0.125000
v -0.127817 0.183744 0.375000
v -0.127817 0.439378 0.375000
v 0.127817 0.183744 0.375000
v 0.127817 0.439378 0.375000
v -0.125728 0.185848 0.125000
v -0.125728 0.437304 0.125000
v 0.125728 0.185848 0.125000
v 0.125728 0.437304 0.125000
v -0.125728 0.185848 0.375000
v -0.125728 0.437304 0.375000
v 0.125728 0.185848 0.375000
v 0.125728 0.437304 0.375000
vn 1.0000 -0.0000 -0.0000
vn -1.0000 -0.0000 -0.0000
vn -0.0000 1.0000 -0.0000
vn -0.0000 -1.0000 -0.0000
vt 0.888889 0.444444
vt 0.666667 0.222222
vt 0.888889 0.222222
vt 0.666667 0.444444
vt 0.888889 0.666667
vt 0.666667 0.666667
s 0
f 12/10/7 15/11/7 11/12/7
f 14/13/8 9/12/8 13/11/8
f 12/14/9 14/13/9 16/10/9
f 23/11/8 20/10/8 19/12/8
f 17/12/7 22/13/7 21/11/7
f 22/13/10 20/14/10 24/10/10
f 28/10/7 31/11/7 27/12/7
f 30/13/8 25/12/8 29/11/8
f 28/14/9 30/13/9 32/10/9
f 39/11/8 36/10/8 35/12/8
f 33/12/7 38/13/7 37/11/7
f 38/13/10 36/14/10 40/10/10
f 44/10/7 47/11/7 43/12/7
f 46/13/8 41/12/8 45/11/8
f 44/14/9 46/13/9 48/10/9
f 55/11/8 52/10/8 51/12/8
f 49/12/7 54/13/7 53/11/7
f 54/13/10 52/14/10 56/10/10
f 12/10/7 16/13/7 15/11/7
f 14/13/8 10/10/8 9/12/8
f 12/14/9 10/15/9 14/13/9
f 23/11/8 24/13/8 20/10/8
f 17/12/7 18/10/7 22/13/7
f 22/13/10 18/15/10 20/14/10
f 28/10/7 32/13/7 31/11/7
f 30/13/8 26/10/8 25/12/8
f 28/14/9 26/15/9 30/13/9
f 39/11/8 40/13/8 36/10/8
f 33/12/7 34/10/7 38/13/7
f 38/13/10 34/15/10 36/14/10
f 44/10/7 48/13/7 47/11/7
f 46/13/8 42/10/8 41/12/8
f 44/14/9 42/15/9 46/13/9
f 55/11/8 56/13/8 52/10/8
f 49/12/7 50/10/7 54/13/7
f 54/13/10 50/15/10 52/14/10

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 205 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 181 B

After

Width:  |  Height:  |  Size: 264 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 222 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 217 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 122 B

After

Width:  |  Height:  |  Size: 243 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 120 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

After

Width:  |  Height:  |  Size: 246 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 209 B

After

Width:  |  Height:  |  Size: 231 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 235 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 210 B

After

Width:  |  Height:  |  Size: 246 B