diff --git a/README.md b/README.md index d2e48a8..21f4b20 100644 --- a/README.md +++ b/README.md @@ -96,6 +96,13 @@ Available worlds will be converted to 'lsqlite3', but there is no way back, so: ### History +**2025-01-08 V1.20** + +- Add Traffic Lights and accesories +- Add TA4 water remover device +- Improve door and fly controller +- Fix several issues + **2024-12-31 V1.19** - Add Everness support #187 (ore sieving) diff --git a/doc/manual_ta4_DE.lua b/doc/manual_ta4_DE.lua index e87f00c..caa02b8 100644 --- a/doc/manual_ta4_DE.lua +++ b/doc/manual_ta4_DE.lua @@ -63,6 +63,7 @@ return { "3,TA4 LED Pflanzenlampe / TA4 LED Grow Light", "3,TA4 LED Straßenlampe / TA4 LED Street Lamp", "3,TA4 LED Industrielampe / TA4 LED Industrial Lamp", + "3,TA4 Ampel / TA4 Traffic Light", "2,TA4 Flüssigkeitsfilter", "3,Fundament-Ebene", "3,Schotter-Ebene", @@ -605,6 +606,17 @@ return { "\n".. "\n".. "\n", + "Die TA4 Ampel gibt es in zwei Ausführungen: in schwarz (europäische Version) und in gelb (amerikanische Version). Zusätzlich gibt es\n".. + "einen Mast\\, einen Arm und einen Verbinder-Block. Die Ampel kann auf oder an einen Mast montiert werden. Sie kann aber nicht\n".. + "an einen Arm montiert werden. Dies hat technische Gründe. Dafür gibt es den Verbinder-Block\\, der zwischen Arm und Ampel gesetzt wird.\n".. + "\n".. + "Die Ampel kann über Kommandos wie beim TA4 Signal Tower angesteuert werden.\n".. + "Wird zusätzlich der TA4 Spieler Detektor eingesetzt\\, so kann die Ampel auch auf Fußgänger oder Fahrzeuge reagieren.\n".. + "\n".. + "Die Ampel benötigt keinen Strom.\n".. + "\n".. + "\n".. + "\n", "Im Flüssigkeitsfilter wird Rotschlamm gefiltert.\n".. "Dabei entsteht entweder Lauge\\, welche unten in einem Tank gesammelt werden kann oder Wüstenkopfsteinpflaster\\, welches sich im Filter absetzt.\n".. "Wenn der Filter zu sehr verstopft ist\\, muss er geleert und neu befüllt werden.\n".. @@ -940,6 +952,7 @@ return { "ta4_growlight", "ta4_streetlamp", "ta4_industriallamp", + "ta4_trafficlight", "ta4_liquid_filter", "", "", @@ -1036,6 +1049,7 @@ return { "", "", "", + "", "ta4_liquid_filter_base", "ta4_liquid_filter_gravel", "ta4_liquid_filter_top", diff --git a/doc/manual_ta4_EN.lua b/doc/manual_ta4_EN.lua index fb58c28..262a7a1 100644 --- a/doc/manual_ta4_EN.lua +++ b/doc/manual_ta4_EN.lua @@ -63,6 +63,7 @@ return { "3,TA4 LED Grow Light", "3,TA4 Street Lamp", "3,TA4 LED Industrial Lamp", + "3,TA4 traffic light", "2,TA4 Liquid Filter", "3,Base Layer", "3,Gravel Layer", @@ -603,6 +604,14 @@ return { "\n".. "\n".. "\n", + "The TA4 traffic light is available in two versions: black (European version) and yellow (American version). In addition\\, there is a mast\\, an arm and a connector block. The traffic light can be mounted on or to a mast. However\\, it cannot be mounted to an arm. This is for technical reasons. This is why there is the connector block\\, which is placed between the arm and the traffic light.\n".. + "\n".. + "The traffic light can be controlled using commands like the TA4 signal tower. If the TA4 player detector is also used\\, the traffic light can also react to pedestrians or vehicles.\n".. + "\n".. + "The traffic light does not require any electricity.\n".. + "\n".. + "\n".. + "\n", "The liquid filter filters red mud.\n".. "A part of the red mud becomes lye\\, which can be collected at the bottom in a tank.\n".. "The other part becomes desert cobblestone and clutters the filter material.\n".. @@ -941,6 +950,7 @@ return { "ta4_growlight", "ta4_streetlamp", "ta4_industriallamp", + "ta4_trafficlight", "ta4_liquid_filter", "", "", @@ -1037,6 +1047,7 @@ return { "", "", "", + "", "ta4_liquid_filter_base", "ta4_liquid_filter_gravel", "ta4_liquid_filter_top", diff --git a/init.lua b/init.lua index bb59229..41e2c2f 100644 --- a/init.lua +++ b/init.lua @@ -13,7 +13,7 @@ techage = {} -- Version for compatibility checks, see readme.md/history -techage.version = 1.19 +techage.version = 1.20 if minetest.global_exists("tubelib") then minetest.log("error", "[techage] Techage can't be used together with the mod tubelib!") @@ -305,6 +305,7 @@ dofile(MP.."/logic/button_2x.lua") dofile(MP.."/logic/button_4x.lua") dofile(MP.."/logic/signallamp_2x.lua") dofile(MP.."/logic/signallamp_4x.lua") +dofile(MP.."/logic/trafficlight.lua") if minetest.global_exists("mesecon") then dofile(MP.."/logic/mesecons_converter.lua") end diff --git a/iron_age/recipes.lua b/iron_age/recipes.lua index 9635b22..e17c501 100644 --- a/iron_age/recipes.lua +++ b/iron_age/recipes.lua @@ -142,8 +142,11 @@ end -- if techage.modified_recipes_enabled then minetest.clear_craft({ - output = "default:bronze_ingot", - type = "crafting", + recipe = { + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:tin_ingot", "default:copper_ingot"}, + {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot"}, + } }) -- delete cooking iron lumps into steel ingots minetest.clear_craft({ @@ -159,14 +162,6 @@ if techage.modified_recipes_enabled then }) end - -- add again - minetest.register_craft({ - output = 'default:bronze_ingot 9', - recipe = { - {'default:bronzeblock'}, - } - }) - techage.ironage_register_recipe({ output = "default:bronze_ingot 4", recipe = {"default:copper_ingot", "default:copper_ingot", "default:copper_ingot", "default:tin_ingot"}, diff --git a/locale/techage.de.tr b/locale/techage.de.tr index 28e6c18..2a536a4 100644 --- a/locale/techage.de.tr +++ b/locale/techage.de.tr @@ -1522,6 +1522,13 @@ TA4 Derrick=TA4 Bohrturm [TA] Derrick is being built!=[TA] Bohrturm wird errichtet [TA] Derrick is being removed!=[TA] Bohrturm wird abgebaut +### trafficlight.lua ### + +TA4 Traffic Light=TA4 Ampel +TA4 Traffic Light Arm=TA4 Ampel Arm +TA4 Traffic Light Connector=TA4 Ampel Verbinder +TA4 Traffic Light Pole=TA4 Ampel Mast + ### transformer.lua ### TA4 Isolation Transformer=TA4 Trenntransformator diff --git a/locale/techage.fr.tr b/locale/techage.fr.tr index a4a4883..6881a9a 100644 --- a/locale/techage.fr.tr +++ b/locale/techage.fr.tr @@ -1522,6 +1522,13 @@ TA4 Derrick=TA4 Derrick [TA] Derrick is being built!=[TA] Le derrick est en cours de construction! [TA] Derrick is being removed!=[TA] Le derrick est retiré! +### trafficlight.lua ### + +TA4 Traffic Light= +TA4 Traffic Light Arm= +TA4 Traffic Light Connector= +TA4 Traffic Light Pole= + ### transformer.lua ### TA4 Isolation Transformer= diff --git a/locale/techage.ru.tr b/locale/techage.ru.tr index e552650..dd562c9 100644 --- a/locale/techage.ru.tr +++ b/locale/techage.ru.tr @@ -1518,6 +1518,13 @@ TA4 Derrick=TA4 Буровая вышка [TA] Derrick is being built!=[TA] Буровая вышка построена! [TA] Derrick is being removed!=[TA] Буровая вышка удалена! +### trafficlight.lua ### + +TA4 Traffic Light= +TA4 Traffic Light Arm= +TA4 Traffic Light Connector= +TA4 Traffic Light Pole= + ### transformer.lua ### TA4 Isolation Transformer=TA4 Изолирующий трансформатор diff --git a/locale/template.txt b/locale/template.txt index 3847e97..0613504 100644 --- a/locale/template.txt +++ b/locale/template.txt @@ -1522,6 +1522,13 @@ TA4 Derrick= [TA] Derrick is being built!= [TA] Derrick is being removed!= +### trafficlight.lua ### + +TA4 Traffic Light= +TA4 Traffic Light Arm= +TA4 Traffic Light Connector= +TA4 Traffic Light Pole= + ### transformer.lua ### TA4 Isolation Transformer= diff --git a/logic/trafficlight.lua b/logic/trafficlight.lua new file mode 100644 index 0000000..ee3ed1a --- /dev/null +++ b/logic/trafficlight.lua @@ -0,0 +1,577 @@ +--[[ + + TechAge + ======= + + Copyright (C) 2019-2025 Joachim Stolberg + + AGPL v3 + See LICENSE.txt for more information + + Traffic Lights + +]]-- + +local S = techage.S +local M = minetest.get_meta +local P2S = minetest.pos_to_string + +local TITLE = S("TA4 Traffic Light") + +local +ConvertTo = { + off = { + ["techage:ta4_trafficlight1_red"] = "techage:ta4_trafficlight1", + ["techage:ta4_trafficlight1_amber"] = "techage:ta4_trafficlight1", + ["techage:ta4_trafficlight1_green"] = "techage:ta4_trafficlight1", + ["techage:ta4_trafficlight1B_red"] = "techage:ta4_trafficlight1B", + ["techage:ta4_trafficlight1B_amber"] = "techage:ta4_trafficlight1B", + ["techage:ta4_trafficlight1B_green"] = "techage:ta4_trafficlight1B", + ["techage:ta4_trafficlight2_red"] = "techage:ta4_trafficlight2", + ["techage:ta4_trafficlight2_amber"] = "techage:ta4_trafficlight2", + ["techage:ta4_trafficlight2_green"] = "techage:ta4_trafficlight2", + ["techage:ta4_trafficlight2B_red"] = "techage:ta4_trafficlight2B", + ["techage:ta4_trafficlight2B_amber"] = "techage:ta4_trafficlight2B", + ["techage:ta4_trafficlight2B_green"] = "techage:ta4_trafficlight2B", + }, + green = { + ["techage:ta4_trafficlight1_red"] = "techage:ta4_trafficlight1_green", + ["techage:ta4_trafficlight1_amber"] = "techage:ta4_trafficlight1_green", + ["techage:ta4_trafficlight1"] = "techage:ta4_trafficlight1_green", + ["techage:ta4_trafficlight1B_red"] = "techage:ta4_trafficlight1B_green", + ["techage:ta4_trafficlight1B_amber"] = "techage:ta4_trafficlight1B_green", + ["techage:ta4_trafficlight1B"] = "techage:ta4_trafficlight1B_green", + ["techage:ta4_trafficlight2_red"] = "techage:ta4_trafficlight2_green", + ["techage:ta4_trafficlight2_amber"] = "techage:ta4_trafficlight2_green", + ["techage:ta4_trafficlight2"] = "techage:ta4_trafficlight2_green", + ["techage:ta4_trafficlight2B_red"] = "techage:ta4_trafficlight2B_green", + ["techage:ta4_trafficlight2B_amber"] = "techage:ta4_trafficlight2B_green", + ["techage:ta4_trafficlight2B"] = "techage:ta4_trafficlight2B_green", + }, + amber = { + ["techage:ta4_trafficlight1_red"] = "techage:ta4_trafficlight1_amber", + ["techage:ta4_trafficlight1_green"] = "techage:ta4_trafficlight1_amber", + ["techage:ta4_trafficlight1"] = "techage:ta4_trafficlight1_amber", + ["techage:ta4_trafficlight1B_red"] = "techage:ta4_trafficlight1B_amber", + ["techage:ta4_trafficlight1B_green"] = "techage:ta4_trafficlight1B_amber", + ["techage:ta4_trafficlight1B"] = "techage:ta4_trafficlight1B_amber", + ["techage:ta4_trafficlight2_red"] = "techage:ta4_trafficlight2_amber", + ["techage:ta4_trafficlight2_green"] = "techage:ta4_trafficlight2_amber", + ["techage:ta4_trafficlight2"] = "techage:ta4_trafficlight2_amber", + ["techage:ta4_trafficlight2B_red"] = "techage:ta4_trafficlight2B_amber", + ["techage:ta4_trafficlight2B_green"] = "techage:ta4_trafficlight2B_amber", + ["techage:ta4_trafficlight2B"] = "techage:ta4_trafficlight2B_amber", + }, + red = { + ["techage:ta4_trafficlight1_amber"] = "techage:ta4_trafficlight1_red", + ["techage:ta4_trafficlight1_green"] = "techage:ta4_trafficlight1_red", + ["techage:ta4_trafficlight1"] = "techage:ta4_trafficlight1_red", + ["techage:ta4_trafficlight1B_amber"] = "techage:ta4_trafficlight1B_red", + ["techage:ta4_trafficlight1B_green"] = "techage:ta4_trafficlight1B_red", + ["techage:ta4_trafficlight1B"] = "techage:ta4_trafficlight1B_red", + ["techage:ta4_trafficlight2_amber"] = "techage:ta4_trafficlight2_red", + ["techage:ta4_trafficlight2_green"] = "techage:ta4_trafficlight2_red", + ["techage:ta4_trafficlight2"] = "techage:ta4_trafficlight2_red", + ["techage:ta4_trafficlight2B_amber"] = "techage:ta4_trafficlight2B_red", + ["techage:ta4_trafficlight2B_green"] = "techage:ta4_trafficlight2B_red", + ["techage:ta4_trafficlight2B"] = "techage:ta4_trafficlight2B_red", + }, +} + +local function is_pole(pos) + local node = minetest.get_node(pos) + local dir = tubelib2.side_to_dir("B", node.param2) + local pos2 = tubelib2.get_pos(pos, dir) + local name = minetest.get_node(pos2).name + return name == "techage:trafficlight_connector" or name == "techage:trafficlight_pole" +end + +local function switch_on(pos, color) + local node = techage.get_node_lvm(pos) + if ConvertTo[color][node.name] then + node.name = ConvertTo[color][node.name] + M(pos):set_string("state", color) + minetest.swap_node(pos, node) + end +end + +local function switch_off(pos) + local node = techage.get_node_lvm(pos) + if ConvertTo["off"][node.name] then + node.name = ConvertTo["off"][node.name] + M(pos):set_string("state", "off") + minetest.swap_node(pos, node) + 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") + if state == "off" then + switch_on(pos, "green") + else + switch_off(pos) + end + end +end + +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, + + after_place_node = function(pos, placer) + local number + if is_pole(pos) then + local node = minetest.get_node(pos) + node.name = "techage:ta4_trafficlight1B" + minetest.swap_node(pos, node) + number = techage.add_node(pos, "techage:ta4_trafficlight1B") + else + number = techage.add_node(pos, "techage:ta4_trafficlight1") + end + local meta = M(pos) + meta:set_string("state", "off") + meta:set_string("infotext", TITLE .. " " .. number) + end, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 0, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), +}) + +for _,color in ipairs({"green", "amber", "red"}) do + tiles1[6] = "techage_trafficlight1_" .. color .. '.png' + minetest.register_node("techage:ta4_trafficlight1_" .. color, { + description = TITLE, + tiles = table.copy(tiles1), + drawtype = "nodebox", + node_box = node_box, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 10, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {crumbly=0, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight1", + }) +end + +minetest.register_node("techage:ta4_trafficlight1B", { + description = TITLE, + tiles = table.copy(tiles1B), + drawtype = "nodebox", + node_box = node_boxB, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 0, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight1", +}) + +for _,color in ipairs({"green", "amber", "red"}) do + tiles1B[6] = "techage_trafficlight1_" .. color .. '.png' + minetest.register_node("techage:ta4_trafficlight1B_" .. color, { + description = TITLE, + tiles = table.copy(tiles1B), + drawtype = "nodebox", + node_box = node_boxB, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 10, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {crumbly=0, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight1", + }) +end + +minetest.register_node("techage:ta4_trafficlight2", { + description = TITLE, + tiles = table.copy(tiles2), + drawtype = "nodebox", + node_box = node_box, + + after_place_node = function(pos, placer) + local number + if is_pole(pos) then + local node = minetest.get_node(pos) + node.name = "techage:ta4_trafficlight2B" + minetest.swap_node(pos, node) + number = techage.add_node(pos, "techage:ta4_trafficlight2B") + else + number = techage.add_node(pos, "techage:ta4_trafficlight2") + end + local meta = M(pos) + meta:set_string("state", "off") + meta:set_string("infotext", TITLE .. " " .. number) + end, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 0, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), +}) + +for _,color in ipairs({"green", "amber", "red"}) do + tiles2[6] = "techage_trafficlight2_" .. color .. '.png' + minetest.register_node("techage:ta4_trafficlight2_" .. color, { + description = TITLE, + tiles = table.copy(tiles2), + drawtype = "nodebox", + node_box = node_box, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 10, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {crumbly=0, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight2", + }) +end + +minetest.register_node("techage:ta4_trafficlight2B", { + description = TITLE, + tiles = table.copy(tiles2B), + drawtype = "nodebox", + node_box = node_boxB, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 0, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {cracky=2, crumbly=2, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight1", +}) + +for _,color in ipairs({"green", "amber", "red"}) do + tiles2B[6] = "techage_trafficlight2_" .. color .. '.png' + minetest.register_node("techage:ta4_trafficlight2B_" .. color, { + description = TITLE, + tiles = table.copy(tiles2B), + drawtype = "nodebox", + node_box = node_boxB, + + on_rightclick = on_rightclick, + after_dig_node = after_dig_node, + + paramtype = "light", + use_texture_alpha = techage.CLIP, + light_source = 10, + sunlight_propagates = true, + paramtype2 = "facedir", + groups = {crumbly=0, not_in_creative_inventory=1}, + is_ground_content = false, + sounds = default.node_sound_glass_defaults(), + drop = "techage:ta4_trafficlight2", + }) +end + +minetest.register_craft({ + output = "techage:ta4_trafficlight1", + recipe = { + {"", "dye:black", ""}, + {"", "techage:ta4_signaltower", ""}, + {"", "default:steel_ingot", ""}, + }, +}) + +minetest.register_craft({ + output = "techage:ta4_trafficlight2", + recipe = { + {"", "dye:orange", ""}, + {"", "techage:ta4_signaltower", ""}, + {"", "default:steel_ingot", ""}, + }, +}) + +techage.register_node({ + "techage:ta4_trafficlight1", + "techage:ta4_trafficlight1_green", + "techage:ta4_trafficlight1_amber", + "techage:ta4_trafficlight1_red", + "techage:ta4_trafficlight2", + "techage:ta4_trafficlight2_green", + "techage:ta4_trafficlight2_amber", + "techage:ta4_trafficlight2_red", + "techage:ta4_trafficlight1B", + "techage:ta4_trafficlight1B_green", + "techage:ta4_trafficlight1B_amber", + "techage:ta4_trafficlight1B_red", + "techage:ta4_trafficlight2B", + "techage:ta4_trafficlight2B_green", + "techage:ta4_trafficlight2B_amber", + "techage:ta4_trafficlight2B_red"}, { + on_recv_message = function(pos, src, topic, payload) + if topic == "green" then + switch_on(pos, "green") + elseif topic == "amber" then + switch_on(pos, "amber") + elseif topic == "red" then + switch_on(pos, "red") + elseif topic == "off" then + switch_off(pos) + elseif topic == "state" then + local meta = minetest.get_meta(pos) + return meta:get_string("state") + end + end, + on_beduino_receive_cmnd = function(pos, src, topic, payload) + if topic == 2 then + local color = ({"green", "amber", "red"})[payload[1]] + if color then + switch_on(pos, color) + else + switch_off(pos) + end + return 0 + else + return 2 -- unknown or invalid topic + end + end, + on_beduino_request_data = function(pos, src, topic, payload) + if topic == 130 then + local meta = minetest.get_meta(pos) + local color = ({off = 0, green = 1, amber = 2, red = 3})[meta:get_string("state")] or 1 + return 0, {color} + else + return 2, "" -- unknown or invalid topic + end + end, +}) + +minetest.register_node("techage:trafficlight_pole", { + description = S("TA4 Traffic Light Pole"), + tiles = { + "techage_trafficlight_pole.png", + }, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{ -4/32, -16/32, -4/32, 4/32, 16/32, 4/32}}, + connect_left = {{-16/32, 0/32, -3/32, 3/32, 6/32, 3/32}}, + connect_right = {{ -3/32, 0/32, -3/32, 16/32, 6/32, 3/32}}, + connect_back = {{ -3/32, 0/32, -3/32, 3/32, 6/32, 16/32}}, + connect_front = {{ -3/32, 0/32, -16/32, 3/32, 6/32, 3/32}}, + }, + connects_to = { + "techage:trafficlight_arm", + "techage:trafficlight_connector", + "techage:ta4_trafficlight1", + "techage:ta4_trafficlight1B", + "techage:ta4_trafficlight1_red", + "techage:ta4_trafficlight1_amber", + "techage:ta4_trafficlight1_green", + "techage:ta4_trafficlight1B_red", + "techage:ta4_trafficlight1B_amber", + "techage:ta4_trafficlight1B_green", + "techage:ta4_trafficlight2", + "techage:ta4_trafficlight2B", + "techage:ta4_trafficlight2_red", + "techage:ta4_trafficlight2_amber", + "techage:ta4_trafficlight2_green", + "techage:ta4_trafficlight2B_red", + "techage:ta4_trafficlight2B_amber", + "techage:ta4_trafficlight2B_green", + }, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky=2, crumbly=2, choppy=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("techage:trafficlight_connector", { + description = S("TA4 Traffic Light Connector"), + tiles = { + "techage_trafficlight_pole.png", + }, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "connected", + fixed = {{ -4/32, -4/32, -4/32, 4/32, 10/32, 4/32}}, + connect_left = {{-16/32, 0/32, -3/32, 3/32, 6/32, 3/32}}, + connect_right = {{ -3/32, 0/32, -3/32, 16/32, 6/32, 3/32}}, + connect_back = {{ -3/32, 0/32, -3/32, 3/32, 6/32, 16/32}}, + connect_front = {{ -3/32, 0/32, -16/32, 3/32, 6/32, 3/32}}, + }, + connects_to = { + "techage:trafficlight_arm", + "techage:trafficlight_connector", + "techage:trafficlight_pole", + "techage:ta4_trafficlight1", + "techage:ta4_trafficlight1B", + "techage:ta4_trafficlight1_red", + "techage:ta4_trafficlight1_amber", + "techage:ta4_trafficlight1_green", + "techage:ta4_trafficlight1B_red", + "techage:ta4_trafficlight1B_amber", + "techage:ta4_trafficlight1B_green", + "techage:ta4_trafficlight2", + "techage:ta4_trafficlight2B", + "techage:ta4_trafficlight2_red", + "techage:ta4_trafficlight2_amber", + "techage:ta4_trafficlight2_green", + "techage:ta4_trafficlight2B_red", + "techage:ta4_trafficlight2B_amber", + "techage:ta4_trafficlight2B_green", + }, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky=2, crumbly=2, choppy=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_node("techage:trafficlight_arm", { + description = S("TA4 Traffic Light Arm"), + tiles = { + "techage_trafficlight_pole.png", + }, + + paramtype2 = "facedir", -- important! + drawtype = "nodebox", + node_box = { + type = "fixed", + fixed = {{ -3/32, 0/32, -16/32, 3/32, 6/32, 16/32}}, + }, + paramtype = "light", + sunlight_propagates = true, + is_ground_content = false, + groups = {cracky=2, crumbly=2, choppy=2}, + sounds = default.node_sound_defaults(), +}) + +minetest.register_craft({ + output = "techage:trafficlight_pole", + recipe = { + {"", "basic_materials:steel_bar", ""}, + {"", "basic_materials:steel_bar", "dye:dark_grey"}, + {"", "basic_materials:steel_bar", ""}, + }, +}) + +minetest.register_craft({ + output = "techage:trafficlight_arm", + recipe = { + {"", "dye:dark_grey", ""}, + {"basic_materials:steel_bar", "basic_materials:steel_bar", "basic_materials:steel_bar"}, + {"", "", ""}, + }, +}) + +minetest.register_craft({ + output = "techage:trafficlight_connector", + recipe = { + {"dye:dark_grey", "basic_materials:steel_bar", ""}, + {"basic_materials:steel_bar", "", ""}, + {"", "", ""}, + }, +}) diff --git a/manuals/manual_ta4_DE.md b/manuals/manual_ta4_DE.md index a06cde0..35e5a26 100644 --- a/manuals/manual_ta4_DE.md +++ b/manuals/manual_ta4_DE.md @@ -691,8 +691,18 @@ Die Lampe benötigt 1 ku Strom. [ta4_industriallamp|image] +### TA4 Ampel / TA4 Traffic Light +Die TA4 Ampel gibt es in zwei Ausführungen: in schwarz (europäische Version) und in gelb (amerikanische Version). Zusätzlich gibt es +einen Mast, einen Arm und einen Verbinder-Block. Die Ampel kann auf oder an einen Mast montiert werden. Sie kann aber nicht +an einen Arm montiert werden. Dies hat technische Gründe. Dafür gibt es den Verbinder-Block, der zwischen Arm und Ampel gesetzt wird. +Die Ampel kann über Kommandos wie beim TA4 Signal Tower angesteuert werden. +Wird zusätzlich der TA4 Spieler Detektor eingesetzt, so kann die Ampel auch auf Fußgänger oder Fahrzeuge reagieren. + +Die Ampel benötigt keinen Strom. + +[ta4_trafficlight|image] ## TA4 Flüssigkeitsfilter diff --git a/manuals/manual_ta4_EN.md b/manuals/manual_ta4_EN.md index cfee4c2..ac9481f 100644 --- a/manuals/manual_ta4_EN.md +++ b/manuals/manual_ta4_EN.md @@ -681,7 +681,15 @@ The lamp requires 1 ku of electricity. [ta4_industriallamp|image] +### TA4 traffic light +The TA4 traffic light is available in two versions: black (European version) and yellow (American version). In addition, there is a mast, an arm and a connector block. The traffic light can be mounted on or to a mast. However, it cannot be mounted to an arm. This is for technical reasons. This is why there is the connector block, which is placed between the arm and the traffic light. + +The traffic light can be controlled using commands like the TA4 signal tower. If the TA4 player detector is also used, the traffic light can also react to pedestrians or vehicles. + +The traffic light does not require any electricity. + +[ta4_trafficlight|image] ## TA4 Liquid Filter diff --git a/manuals/nanobasic.md b/manuals/nanobasic.md index 544d281..b671358 100644 --- a/manuals/nanobasic.md +++ b/manuals/nanobasic.md @@ -1458,6 +1458,7 @@ As payload data, these commands may require numeric values or a string value. | Turn on/off | 1 | state | Turn device (lamp, machine, button...) on/off.
`state`: 0 = "off", 1 = "on" | | Turn on/off Signs Bot | 1 | state | Turn device (lamp, machine, button...) on/off.
`state`: 0 = "off", 1 = "on" | | Signal Tower | 2 | color | Set Signal Tower color
`color`: 0 = "off", 1 = "green", 2 = "amber", 3 = "red" | +| Traffic Light | 2 | color | Set Traffic Light color
`color`: 0 = "off", 1 = "green", 2 = "amber", 3 = "red" | | Signal Lamp | 3 | idx, color | Set the lamp color for "TA4 2x" and "TA4 4x" Signal Lamps
`idx` is the lamp number (1..4)
`color`: 0 = "off", 1 = "green", 2 = "amber", 3 = "red" | | Distri. Filter Slot | 4 | idx, state | Enable/disable a Distributor filter slot.
`idx` is the slot number: 1 = "red", 2 = "green", 3 = "blue", 4 = "yellow"
`state`: 0 = "off", 1 = "on" | | Detector Block Countdown | 5 | counter | Set countdown counter of the TA4 Item Detector block to the given value and start countdown mode. | @@ -1504,6 +1505,7 @@ corresponds to the error from previous chapter. | Minecart State (Cart Terminal) | 129 | cart-id | state | Returns 0 = UNKNOWN, 1 = STOPPED, 2 = RUNNING | | Minecart Distance (Cart Terminal)| 130 | cart-id | distance | Returns the distance from the cart to the Cart Terminal in meters | | Signal Tower Color | 130 | - | color | OFF = 0, GREEN = 1, AMBER = 2, RED = 3 | +| Traffic Light Color | 130 | - | color | OFF = 0, GREEN = 1, AMBER = 2, RED = 3 | | Chest State | 131 | - | state | State of a TA3/TA4 chest or Sensor Chest: EMPTY = 0, LOADED = 1, FULL = 2 | | TA3/TA4 Button State | 131 | - | state | OFF = 0, ON = 1 | | Fuel Level | 132 | - | level | Fuel level of a fuel consuming block (0..65535) | diff --git a/manuals/ta4_lua_controller_EN.md b/manuals/ta4_lua_controller_EN.md index 5b1b625..3a6234f 100644 --- a/manuals/ta4_lua_controller_EN.md +++ b/manuals/ta4_lua_controller_EN.md @@ -408,7 +408,7 @@ Please note, that this is not a technical distinction, only a logical. | cmnd | data | comment | | -------------------------------- | ------------ | ------------------------------------------------------------ | | "on", "off" | nil | turn a node on/off (machine, lamp,...) | -| "red, "amber", "green", "off" | nil | set Signal Tower color | +| "red, "amber", "green", "off" | nil | set Signal Tower or Traffic Light color | | "red, "amber", "green", "off" | lamp number (1..4) | Set the signal lamp color. Valid for "TA4 2x Signal Lamp" and "TA4 4x Signal Lamp" | | "port" | string
`=on/off` | Enable/disable a Distributor filter slot..
Example: `"yellow=on"`
colors: red, green, blue, yellow | | "config" | "\ \" | Configure a Distributor filter slot, like: "red default:dirt dye:blue" | diff --git a/textures/techage_trafficlight1.png b/textures/techage_trafficlight1.png new file mode 100644 index 0000000..58cba40 Binary files /dev/null and b/textures/techage_trafficlight1.png differ diff --git a/textures/techage_trafficlight1B.png b/textures/techage_trafficlight1B.png new file mode 100644 index 0000000..ba11207 Binary files /dev/null and b/textures/techage_trafficlight1B.png differ diff --git a/textures/techage_trafficlight1_amber.png b/textures/techage_trafficlight1_amber.png new file mode 100644 index 0000000..7e1fcfa Binary files /dev/null and b/textures/techage_trafficlight1_amber.png differ diff --git a/textures/techage_trafficlight1_green.png b/textures/techage_trafficlight1_green.png new file mode 100644 index 0000000..49a8b03 Binary files /dev/null and b/textures/techage_trafficlight1_green.png differ diff --git a/textures/techage_trafficlight1_off.png b/textures/techage_trafficlight1_off.png new file mode 100644 index 0000000..5dfc3b1 Binary files /dev/null and b/textures/techage_trafficlight1_off.png differ diff --git a/textures/techage_trafficlight1_red.png b/textures/techage_trafficlight1_red.png new file mode 100644 index 0000000..6f89d4a Binary files /dev/null and b/textures/techage_trafficlight1_red.png differ diff --git a/textures/techage_trafficlight2.png b/textures/techage_trafficlight2.png new file mode 100644 index 0000000..43507f7 Binary files /dev/null and b/textures/techage_trafficlight2.png differ diff --git a/textures/techage_trafficlight2B.png b/textures/techage_trafficlight2B.png new file mode 100644 index 0000000..951ba39 Binary files /dev/null and b/textures/techage_trafficlight2B.png differ diff --git a/textures/techage_trafficlight2_amber.png b/textures/techage_trafficlight2_amber.png new file mode 100644 index 0000000..e086384 Binary files /dev/null and b/textures/techage_trafficlight2_amber.png differ diff --git a/textures/techage_trafficlight2_green.png b/textures/techage_trafficlight2_green.png new file mode 100644 index 0000000..7c88f8d Binary files /dev/null and b/textures/techage_trafficlight2_green.png differ diff --git a/textures/techage_trafficlight2_off.png b/textures/techage_trafficlight2_off.png new file mode 100644 index 0000000..a936aa2 Binary files /dev/null and b/textures/techage_trafficlight2_off.png differ diff --git a/textures/techage_trafficlight2_red.png b/textures/techage_trafficlight2_red.png new file mode 100644 index 0000000..30f95c8 Binary files /dev/null and b/textures/techage_trafficlight2_red.png differ diff --git a/textures/techage_trafficlight_pole.png b/textures/techage_trafficlight_pole.png new file mode 100644 index 0000000..fd55f39 Binary files /dev/null and b/textures/techage_trafficlight_pole.png differ