From 84725df37b7967bdf631a9796139ea4f849da22d Mon Sep 17 00:00:00 2001 From: teknomunk Date: Sun, 28 Apr 2024 14:03:04 +0000 Subject: [PATCH] Change redstone trail color based on power level --- mods/ITEMS/REDSTONE/mesecons_wires/init.lua | 15 +++++++++++---- mods/ITEMS/REDSTONE/vl_redstone/init.lua | 2 +- textures/redstone-palette.png | Bin 0 -> 145 bytes 3 files changed, 12 insertions(+), 5 deletions(-) create mode 100644 textures/redstone-palette.png diff --git a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua index 0f2febc44..ba7becaf0 100644 --- a/mods/ITEMS/REDSTONE/mesecons_wires/init.lua +++ b/mods/ITEMS/REDSTONE/mesecons_wires/init.lua @@ -214,6 +214,11 @@ local function register_wires() local dot_off = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_off local dot_on = "redstone_redstone_dust_dot.png^[colorize:#FF0000:"..ratio_on + local crossing = "(redstone_redstone_dust_dot.png^redstone_redstone_dust_line0.png^(redstone_redstone_dust_line1.png^[transformR90))" + local straight0 = "redstone_redstone_dust_line0.png" + local straight1 = "redstone_redstone_dust_line0.png" + local dot = "redstone_redstone_dust_dot.png" + local tiles_off, tiles_on local wirehelp, tt, longdesc, usagehelp, img, desc_off, desc_on @@ -221,8 +226,8 @@ local function register_wires() -- Non-connected redstone wire nodebox.fixed = {-8/16, -.5, -8/16, 8/16, -.5+1/64, 8/16} -- “Dot” texture - tiles_off = { dot_off, dot_off, "blank.png", "blank.png", "blank.png", "blank.png" } - tiles_on = { dot_on, dot_on, "blank.png", "blank.png", "blank.png", "blank.png" } + tiles_off = { dot, dot, "blank.png", "blank.png", "blank.png", "blank.png" } + tiles_on = { dot, dot, "blank.png", "blank.png", "blank.png", "blank.png" } tt = S("Transmits redstone power, powers mechanisms") longdesc = S("Redstone is a versatile conductive mineral which transmits redstone power. It can be placed on the ground as a trail.").."\n".. @@ -237,8 +242,8 @@ S("Read the help entries on the other redstone components to learn how redstone else -- Connected redstone wire table.insert(nodebox, box_center) - tiles_off = { crossing_off, crossing_off, straight0_off, straight1_off, straight0_off, straight1_off } - tiles_on = { crossing_on, crossing_on, straight0_on, straight1_on, straight0_on, straight1_on } + tiles_off = { crossing, crossing, straight0, straight1, straight0, straight1 } + tiles_on = { crossing, crossing, straight0, straight1, straight0, straight1 } wirehelp = false desc_off = S("Redstone Trail (@1)", nodeid) desc_on = S("Powered Redstone Trail (@1)", nodeid) @@ -247,6 +252,8 @@ S("Read the help entries on the other redstone components to learn how redstone mesecon.register_node(":mesecons:wire_"..nodeid, { drawtype = "nodebox", paramtype = "light", + paramtype2 = "color4dir", + palette = "redstone-palette.png", use_texture_alpha = minetest.features.use_texture_alpha_string_modes and "clip" or true, sunlight_propagates = true, selection_box = selectionbox, diff --git a/mods/ITEMS/REDSTONE/vl_redstone/init.lua b/mods/ITEMS/REDSTONE/vl_redstone/init.lua index cd604d080..65e6ea4da 100644 --- a/mods/ITEMS/REDSTONE/vl_redstone/init.lua +++ b/mods/ITEMS/REDSTONE/vl_redstone/init.lua @@ -245,7 +245,7 @@ local function update_node(pos, node) ",conductor.offstate="..tostring(conductor.offstate) ) --]] - node.param2 = strength + node.param2 = strength * 4 node.name = new_node_name minetest_swap_node(pos, node) end diff --git a/textures/redstone-palette.png b/textures/redstone-palette.png new file mode 100644 index 0000000000000000000000000000000000000000..26db719e9cdcd4e3e904cb9cfd0d39cda2e0841c GIT binary patch literal 145 zcmeAS@N?(olHy`uVBq!ia0vp^0wB!61|;P_|4#%`Y)RhkE)4%caKYZ?lYt^`o-U3d z7N?W{{Qv*Io-O6WKU-$a8nHIpY6-S049EVvxh<)Dc$nRUSwbR!Cm|&vAw|OELA^V> p@L>%Fr3L@~KVN#KVWQk6h72#wdy|r4@_{BYc)I$ztaD0e0swG#F@695 literal 0 HcmV?d00001