From 61b8c132ebda082665e831a34354f79b9331237e Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Thu, 24 Mar 2022 13:33:01 -0300 Subject: [PATCH] fix signalReceived hook not working correctly --- .../SharedSource/Items/Components/ItemComponent.cs | 12 ------------ .../Items/Components/Signal/Connection.cs | 4 ++++ 2 files changed, 4 insertions(+), 12 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs index a1bb06f5f..de5722b28 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/ItemComponent.cs @@ -473,20 +473,8 @@ namespace Barotrauma.Items.Components //called then the item is dropped or dragged out of a "limbslot" public virtual void Unequip(Character character) { } - - Dictionary lastSignal = new Dictionary(); public virtual void ReceiveSignal(Signal signal, Connection connection) { -#if SERVER - if (!lastSignal.ContainsValue(connection.Name) || lastSignal[connection.Name] != signal.value) - { - object[] obj = new object[] { signal, connection }; - GameMain.Lua.hook.Call("signalReceived", obj); - GameMain.Lua.hook.Call("signalReceived." + item.prefab.Identifier, obj); - - lastSignal[connection.Name] = signal.value; - } -#endif switch (connection.Name) { case "activate": diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs index 185d8a158..b4f688c54 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/Connection.cs @@ -267,6 +267,10 @@ namespace Barotrauma.Items.Components Connection connection = recipient; + object[] obj = new object[] { signal, connection }; + GameMain.Lua.hook.Call("signalReceived", obj); + GameMain.Lua.hook.Call("signalReceived." + recipient.item.prefab.Identifier, obj); + foreach (ItemComponent ic in recipient.item.Components) { ic.ReceiveSignal(signal, connection);