From cd930365b0ffa3ea969e0628b9c548692711f11e Mon Sep 17 00:00:00 2001 From: the-real-herowl Date: Mon, 1 Jan 2024 02:07:06 +0100 Subject: [PATCH 1/2] Added colored redstone lamps --- .../REDSTONE/mesecons_lightstone/init.lua | 82 +++++++++++++++--- textures/mcl_lightstone_mask.png | Bin 0 -> 151 bytes 2 files changed, 72 insertions(+), 10 deletions(-) create mode 100644 textures/mcl_lightstone_mask.png diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua index 0e517e4dc..0e0235642 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/init.lua @@ -2,7 +2,24 @@ local S = minetest.get_translator(minetest.get_current_modname()) local light = minetest.LIGHT_MAX -minetest.register_node("mesecons_lightstone:lightstone_off", { +local function generate_action_on(color) + local n = "mesecons_lightstone:lightstone_on" + if color then n = n .. "_" .. color end + return function(pos, node) + minetest.swap_node(pos, {name=n, param2 = node.param2}) + end +end + +local function generate_action_off(color) + local n = "mesecons_lightstone:lightstone_off" + if color then n = n .. "_" .. color end + return function(pos, node) + minetest.swap_node(pos, {name=n, param2 = node.param2}) + end +end + +local ls_off_name = "mesecons_lightstone:lightstone_off" +local ls_off_def = { tiles = {"jeija_lightstone_gray_off.png"}, groups = {handy=1, mesecon_effector_off = 1, mesecon = 2}, is_ground_content = false, @@ -11,16 +28,16 @@ minetest.register_node("mesecons_lightstone:lightstone_off", { _doc_items_longdesc = S("Redstone lamps are simple redstone components which glow brightly (light level @1) when they receive redstone power.", light), sounds = mcl_sounds.node_sound_glass_defaults(), mesecons = {effector = { - action_on = function(pos, node) - minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_on", param2 = node.param2}) - end, + action_on = generate_action_on(), rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, -}) +} +minetest.register_node(ls_off_name, ls_off_def) -minetest.register_node("mesecons_lightstone:lightstone_on", { +local ls_on_name = "mesecons_lightstone:lightstone_on" +local ls_on_def = { tiles = {"jeija_lightstone_gray_on.png"}, groups = {handy=1, not_in_creative_inventory=1, mesecon = 2, opaque = 1}, drop = "node mesecons_lightstone:lightstone_off", @@ -29,14 +46,59 @@ minetest.register_node("mesecons_lightstone:lightstone_on", { light_source = light, sounds = mcl_sounds.node_sound_glass_defaults(), mesecons = {effector = { - action_off = function(pos, node) - minetest.swap_node(pos, {name="mesecons_lightstone:lightstone_off", param2 = node.param2}) - end, + action_off = generate_action_off(), rules = mesecon.rules.alldirs, }}, _mcl_blast_resistance = 0.3, _mcl_hardness = 0.3, -}) +} +minetest.register_node(ls_on_name, ls_on_def) + +local colored_lamps = { + {"white", S("White Redstone Lamp"), "white"}, + {"grey", S("Grey Redstone Lamp"), "dark_grey"}, + {"silver", S("Light Grey Redstone Lamp"), "grey"}, + {"black", S("Black Redstone Lamp"), "black"}, + {"red", S("Red Redstone Lamp"), "red"}, + {"yellow", S("Yellow Redstone Lamp"), "yellow"}, + {"green", S("Green Redstone Lamp"), "dark_green"}, + {"cyan", S("Cyan Redstone Lamp"), "cyan"}, + {"blue", S("Blue Redstone Lamp"), "blue"}, + {"magenta", S("Magenta Redstone Lamp"), "magenta"}, + {"orange", S("Orange Redstone Lamp"), "orange"}, + {"purple", S("Purple Redstone Lamp"), "violet"}, + {"brown", S("Brown Redstone Lamp"), "brown"}, + {"pink", S("Pink Redstone Lamp"), "pink"}, + {"lime", S("Lime Redstone Lamp"), "green"}, + {"lightblue", S("Light Blue Redstone Lamp"), "lightblue"}, +} +for _, row in ipairs(colored_lamps) do + local name = row[1] + local desc = row[2] + local dye = row[3] + local mask = "^[hsl:0:-100^(mcl_lightstone_mask.png^[multiply:" .. name .. "^[opacity:100)" + if name == "lightblue" then + mask = "^[hsl:0:-100^(mcl_lightstone_mask.png^[multiply:" .. name .. "^[hsl:0:200^[opacity:100)" + end + local name_off = ls_off_name .. "_" .. name + local def_off = table.copy(ls_off_def) + def_off.description = desc + def_off._doc_items_longdesc = nil + def_off._doc_items_create_entry = false + def_off.mesecons.effector.action_on = generate_action_on(name) + def_off.tiles[1] = def_off.tiles[1] .. mask + local def_on = table.copy(ls_on_def) + def_on.drop = name_off + def_on.tiles[1] = def_on.tiles[1] .. mask + def_on.mesecons.effector.action_off = generate_action_off(name) + minetest.register_node(name_off, def_off) + minetest.register_node(ls_on_name.."_"..name, def_on) + minetest.register_craft({ + type = "shapeless", + output = name_off, + recipe = {ls_off_name, "mcl_dye:" .. dye} + }) +end minetest.register_craft({ output = "mesecons_lightstone:lightstone_off", diff --git a/textures/mcl_lightstone_mask.png b/textures/mcl_lightstone_mask.png new file mode 100644 index 0000000000000000000000000000000000000000..caf35b44d409500dc6240a7cefe78f4fa6959de4 GIT binary patch literal 151 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!60wlNoGJgf6;yhg(Lo_D#PBi2@V8Fqg|D1K+ z&;Qad8#qcbxI6-Tcs6qWaqlU(%+2kP5?CS@X}OT&ZuoP>lKXQ+A8u2vv3 Date: Mon, 1 Jan 2024 02:18:01 +0100 Subject: [PATCH 2/2] Updated translation files --- .../locale/mesecons_lightstone.de.tr | 16 ++++++++++++++++ .../locale/mesecons_lightstone.pl.tr | 16 ++++++++++++++++ .../mesecons_lightstone/locale/template.txt | 16 ++++++++++++++++ mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr | 2 +- 4 files changed, 49 insertions(+), 1 deletion(-) diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.de.tr b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.de.tr index a0cfc2213..1b0407d1a 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.de.tr +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.de.tr @@ -2,3 +2,19 @@ Redstone Lamp=Redstonelampe Redstone lamps are simple redstone components which glow brightly (light level @1) when they receive redstone power.=Redstonelampen sind einfache Redstonekomponenten, die hell aufleuchten (Helligkeitspegel von @1), wenn sie Redstoneenergie erhalten. Glows when powered by redstone power=Leuchtet, wenn mit Redstoneenergie versorgt +White Redstone Lamp=Weiße Redstonelampe +Grey Redstone Lamp=Graue Redstonelampe +Light Grey Redstone Lamp=Hellgraue Redstonelampe +Black Redstone Lamp=Schwartze Redstonelampe +Red Redstone Lamp=Rote Redstonelampe +Yellow Redstone Lamp=Gelbe Redstonelampe +Green Redstone Lamp=Grüne Redstonelampe +Cyan Redstone Lamp=Türkise Redstonelampe +Blue Redstone Lamp=Blaue Redstonelampe +Magenta Redstone Lamp=Magenta Redstonelampe +Orange Redstone Lamp=Orange Redstonelampe +Purple Redstone Lamp=Violette Redstonelampe +Brown Redstone Lamp=Braune Redstonelampe +Pink Redstone Lamp=Rosa Redstonelampe +Lime Redstone Lamp=Lindgrüne Redstonelampe +Light Blue Redstone Lamp=Hellblaue Redstonelampe diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.pl.tr b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.pl.tr index cd2f755c9..99d01bb07 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.pl.tr +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/mesecons_lightstone.pl.tr @@ -2,3 +2,19 @@ Redstone Lamp=Lampa czerwienitowa Redstone lamps are simple redstone components which glow brightly (light level @1) when they receive redstone power.=Lampy czerwienitowe to mechanizmy czerwienitowe, które jasno świecą (poziom światła @1), gdy są zasilone energią czerwienitową. Glows when powered by redstone power=Świeci gdy zasilana czerwienitem +White Redstone Lamp=Biała lampa czerwienitowa +Grey Redstone Lamp=Szara lampa czerwienitowa +Light Grey Redstone Lamp=Jasnoszara lampa czerwienitowa +Black Redstone Lamp=Czarna lampa czerwienitowa +Red Redstone Lamp=Czerwona lampa czerwienitowa +Yellow Redstone Lamp=Żółta lampa czerwienitowa +Green Redstone Lamp=Zielona lampa czerwienitowa +Cyan Redstone Lamp=Błękitna lampa czerwienitowa +Blue Redstone Lamp=Niebieska lampa czerwienitowa +Magenta Redstone Lamp=Karmazynowa lampa czerwienitowa +Orange Redstone Lamp=Pomarańczowa lampa czerwienitowa +Purple Redstone Lamp=Fioletowa lampa czerwienitowa +Brown Redstone Lamp=Brązowa lampa czerwienitowa +Pink Redstone Lamp=Różowa lampa czerwienitowa +Lime Redstone Lamp=Jasnozielona lampa czerwienitowa +Light Blue Redstone Lamp=Jasnoniebieska lampa czerwienitowa diff --git a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/template.txt b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/template.txt index 2d2cc419f..0d743daa4 100644 --- a/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/template.txt +++ b/mods/ITEMS/REDSTONE/mesecons_lightstone/locale/template.txt @@ -2,3 +2,19 @@ Redstone Lamp= Redstone lamps are simple redstone components which glow brightly (light level @1) when they receive redstone power.= Glows when powered by redstone power= +White Redstone Lamp= +Grey Redstone Lamp= +Light Grey Redstone Lamp= +Black Redstone Lamp= +Red Redstone Lamp= +Yellow Redstone Lamp= +Green Redstone Lamp= +Cyan Redstone Lamp= +Blue Redstone Lamp= +Magenta Redstone Lamp= +Orange Redstone Lamp= +Purple Redstone Lamp= +Brown Redstone Lamp= +Pink Redstone Lamp= +Lime Redstone Lamp= +Light Blue Redstone Lamp= diff --git a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr index 921983ec0..85e5b9605 100644 --- a/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr +++ b/mods/ITEMS/mcl_dye/locale/mcl_dye.pl.tr @@ -1,5 +1,5 @@ # textdomain: mcl_dye -White Dye=Biały farba +White Dye=Biała farba Light Grey Dye=Jasnoszara farba Grey Dye=Szara farba Black Dye=Czarny farba