diff --git a/logic/trafficlight.lua b/logic/trafficlight.lua index ee3ed1a..78e4faa 100644 --- a/logic/trafficlight.lua +++ b/logic/trafficlight.lua @@ -104,56 +104,6 @@ local function switch_off(pos) 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) if not minetest.is_protected(pos, clicker:get_player_name()) then 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) end - minetest.register_node("techage:ta4_trafficlight1", { description = TITLE, - tiles = table.copy(tiles1), - drawtype = "nodebox", - node_box = node_box, + tiles = {"techage_trafficlight1.png"}, + drawtype = "mesh", + mesh = "techage_traffic_light.obj", after_place_node = function(pos, placer) local number @@ -205,12 +154,12 @@ minetest.register_node("techage:ta4_trafficlight1", { }) 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, { description = TITLE, - tiles = table.copy(tiles1), - drawtype = "nodebox", - node_box = node_box, + tiles = tiles, + drawtype = "mesh", + mesh = "techage_traffic_light.obj", on_rightclick = on_rightclick, after_dig_node = after_dig_node, @@ -229,9 +178,9 @@ end minetest.register_node("techage:ta4_trafficlight1B", { description = TITLE, - tiles = table.copy(tiles1B), - drawtype = "nodebox", - node_box = node_boxB, + tiles = {"techage_trafficlight1.png"}, + drawtype = "mesh", + mesh = "techage_traffic_lightB.obj", on_rightclick = on_rightclick, after_dig_node = after_dig_node, @@ -248,13 +197,13 @@ minetest.register_node("techage:ta4_trafficlight1B", { }) 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, { description = TITLE, - tiles = table.copy(tiles1B), - drawtype = "nodebox", - node_box = node_boxB, - + tiles = tiles, + drawtype = "mesh", + mesh = "techage_traffic_lightB.obj", + on_rightclick = on_rightclick, after_dig_node = after_dig_node, @@ -272,9 +221,9 @@ end minetest.register_node("techage:ta4_trafficlight2", { description = TITLE, - tiles = table.copy(tiles2), - drawtype = "nodebox", - node_box = node_box, + tiles = {"techage_trafficlight2.png"}, + drawtype = "mesh", + mesh = "techage_traffic_light.obj", after_place_node = function(pos, placer) local number @@ -305,13 +254,13 @@ minetest.register_node("techage:ta4_trafficlight2", { }) 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, { description = TITLE, - tiles = table.copy(tiles2), - drawtype = "nodebox", - node_box = node_box, - + tiles = tiles, + drawtype = "mesh", + mesh = "techage_traffic_light.obj", + on_rightclick = on_rightclick, after_dig_node = after_dig_node, @@ -329,9 +278,9 @@ end minetest.register_node("techage:ta4_trafficlight2B", { description = TITLE, - tiles = table.copy(tiles2B), - drawtype = "nodebox", - node_box = node_boxB, + tiles = {"techage_trafficlight2.png"}, + drawtype = "mesh", + mesh = "techage_traffic_lightB.obj", on_rightclick = on_rightclick, after_dig_node = after_dig_node, @@ -348,13 +297,13 @@ minetest.register_node("techage:ta4_trafficlight2B", { }) 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, { description = TITLE, - tiles = table.copy(tiles2B), - drawtype = "nodebox", - node_box = node_boxB, - + tiles = tiles, + drawtype = "mesh", + mesh = "techage_traffic_lightB.obj", + on_rightclick = on_rightclick, after_dig_node = after_dig_node, diff --git a/models/techage_traffic_light.obj b/models/techage_traffic_light.obj new file mode 100644 index 0000000..4e7bc77 --- /dev/null +++ b/models/techage_traffic_light.obj @@ -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 diff --git a/models/techage_traffic_lightB.obj b/models/techage_traffic_lightB.obj new file mode 100644 index 0000000..b7ffe8f --- /dev/null +++ b/models/techage_traffic_lightB.obj @@ -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 diff --git a/textures/techage_trafficlight1.png b/textures/techage_trafficlight1.png index 58cba40..ee8dd41 100644 Binary files a/textures/techage_trafficlight1.png and b/textures/techage_trafficlight1.png differ diff --git a/textures/techage_trafficlight1B.png b/textures/techage_trafficlight1B.png deleted file mode 100644 index ba11207..0000000 Binary files a/textures/techage_trafficlight1B.png and /dev/null differ diff --git a/textures/techage_trafficlight1_amber.png b/textures/techage_trafficlight1_amber.png index 7e1fcfa..4877ab7 100644 Binary files a/textures/techage_trafficlight1_amber.png and b/textures/techage_trafficlight1_amber.png differ diff --git a/textures/techage_trafficlight1_green.png b/textures/techage_trafficlight1_green.png index 49a8b03..4473f88 100644 Binary files a/textures/techage_trafficlight1_green.png and b/textures/techage_trafficlight1_green.png differ diff --git a/textures/techage_trafficlight1_off.png b/textures/techage_trafficlight1_off.png deleted file mode 100644 index 5dfc3b1..0000000 Binary files a/textures/techage_trafficlight1_off.png and /dev/null differ diff --git a/textures/techage_trafficlight1_red.png b/textures/techage_trafficlight1_red.png index 6f89d4a..ef32bf0 100644 Binary files a/textures/techage_trafficlight1_red.png and b/textures/techage_trafficlight1_red.png differ diff --git a/textures/techage_trafficlight2.png b/textures/techage_trafficlight2.png index 43507f7..9224a63 100644 Binary files a/textures/techage_trafficlight2.png and b/textures/techage_trafficlight2.png differ diff --git a/textures/techage_trafficlight2B.png b/textures/techage_trafficlight2B.png deleted file mode 100644 index 951ba39..0000000 Binary files a/textures/techage_trafficlight2B.png and /dev/null differ diff --git a/textures/techage_trafficlight2_amber.png b/textures/techage_trafficlight2_amber.png index e086384..d38775d 100644 Binary files a/textures/techage_trafficlight2_amber.png and b/textures/techage_trafficlight2_amber.png differ diff --git a/textures/techage_trafficlight2_green.png b/textures/techage_trafficlight2_green.png index 7c88f8d..32a1b63 100644 Binary files a/textures/techage_trafficlight2_green.png and b/textures/techage_trafficlight2_green.png differ diff --git a/textures/techage_trafficlight2_off.png b/textures/techage_trafficlight2_off.png deleted file mode 100644 index a936aa2..0000000 Binary files a/textures/techage_trafficlight2_off.png and /dev/null differ diff --git a/textures/techage_trafficlight2_red.png b/textures/techage_trafficlight2_red.png index 30f95c8..97130a5 100644 Binary files a/textures/techage_trafficlight2_red.png and b/textures/techage_trafficlight2_red.png differ