fix signalReceived hook not working correctly
This commit is contained in:
@@ -473,20 +473,8 @@ namespace Barotrauma.Items.Components
|
|||||||
//called then the item is dropped or dragged out of a "limbslot"
|
//called then the item is dropped or dragged out of a "limbslot"
|
||||||
public virtual void Unequip(Character character) { }
|
public virtual void Unequip(Character character) { }
|
||||||
|
|
||||||
|
|
||||||
Dictionary<string, string> lastSignal = new Dictionary<string, string>();
|
|
||||||
public virtual void ReceiveSignal(Signal signal, Connection connection)
|
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)
|
switch (connection.Name)
|
||||||
{
|
{
|
||||||
case "activate":
|
case "activate":
|
||||||
|
|||||||
@@ -267,6 +267,10 @@ namespace Barotrauma.Items.Components
|
|||||||
|
|
||||||
Connection connection = recipient;
|
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)
|
foreach (ItemComponent ic in recipient.item.Components)
|
||||||
{
|
{
|
||||||
ic.ReceiveSignal(signal, connection);
|
ic.ReceiveSignal(signal, connection);
|
||||||
|
|||||||
Reference in New Issue
Block a user