From 291ade53c595f564404136c855e71fc4ae3c8f25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Elias=20=C3=85str=C3=B6m?= Date: Sat, 26 Oct 2024 11:11:32 +0200 Subject: [PATCH] Fix observer dupe bug --- mods/ITEMS/REDSTONE/mcl_observers/init.lua | 18 ++++++------------ 1 file changed, 6 insertions(+), 12 deletions(-) diff --git a/mods/ITEMS/REDSTONE/mcl_observers/init.lua b/mods/ITEMS/REDSTONE/mcl_observers/init.lua index 563756ddf..3b229334e 100644 --- a/mods/ITEMS/REDSTONE/mcl_observers/init.lua +++ b/mods/ITEMS/REDSTONE/mcl_observers/init.lua @@ -3,9 +3,10 @@ local S = minetest.get_translator(minetest.get_current_modname()) mcl_observers = {} function mcl_observers.observer_activate(pos) + local oldnode = minetest.get_node(pos) mcl_redstone.after(1, function() local node = minetest.get_node(pos) - if not node then + if oldnode.name ~= node.name or oldnode.param2 ~= node.param2 then return end local ndef = minetest.registered_nodes[node.name] @@ -98,17 +99,10 @@ local commdef_on = table.merge(commdef, { _redstone = table.merge(commdef._redstone, { init = function(pos, node) local ndef = minetest.registered_nodes[node.name] - mcl_redstone.after(2, function() - local node2 = minetest.get_node(pos) - if node2.name ~= node.name and node2.param2 ~= node.param2 then - return - end - - minetest.set_node(pos, { - name = ndef._observer_off, - param2 = node.param2, - }) - end) + return { + name = ndef._observer_off, + param2 = node.param2, + } end, }), })