From 019e4a8e38e1718a9c3eff7fb4892aa31064ac58 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sun, 17 Nov 2024 15:37:25 +0100 Subject: [PATCH] Add toggling between cross and dot for wires --- mods/ITEMS/REDSTONE/mcl_redstone/wire.lua | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/mods/ITEMS/REDSTONE/mcl_redstone/wire.lua b/mods/ITEMS/REDSTONE/mcl_redstone/wire.lua index 32c9864a7..4572b3e5f 100644 --- a/mods/ITEMS/REDSTONE/mcl_redstone/wire.lua +++ b/mods/ITEMS/REDSTONE/mcl_redstone/wire.lua @@ -213,6 +213,24 @@ do doc.add_entry_alias("nodes", "mcl_redstone:redstone", "nodes", "mcl_redstone:wire_"..wireid) end + -- Toggle between cross and dot using rightclick + local on_rightclick + if wire == 0 then + on_rightclick = function(pos) + minetest.swap_node(pos, { + name = "mcl_redstone:wire_0f", + param2 = minetest.get_node(pos).param2, + }) + end + elseif bit.band(wire, 0xf) == 0xf then + on_rightclick = function(pos) + minetest.swap_node(pos, { + name = "mcl_redstone:redstone", + param2 = minetest.get_node(pos).param2, + }) + end + end + local name = wireflags_to_name(wire) minetest.register_node(name, { drawtype = "nodebox", @@ -242,6 +260,7 @@ do after_destruct = function(pos, oldnode) update_wire_connections(pos) end, + on_rightclick = on_rightclick, }) wireflag_tab[name] = wire end