From 52648d1a0e5a305d83502e66aeb058a073ce3e18 Mon Sep 17 00:00:00 2001 From: Evil Factory <36804725+evilfactory@users.noreply.github.com> Date: Mon, 28 Jun 2021 22:40:21 -0300 Subject: [PATCH] Update WifiComponent.cs --- .../Items/Components/Signal/WifiComponent.cs | 52 +++++++++++++++---- 1 file changed, 41 insertions(+), 11 deletions(-) diff --git a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/WifiComponent.cs b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/WifiComponent.cs index 260434448..79c26f871 100644 --- a/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/WifiComponent.cs +++ b/Barotrauma/BarotraumaShared/SharedSource/Items/Components/Signal/WifiComponent.cs @@ -58,14 +58,41 @@ namespace Barotrauma.Items.Components set; } - [ConditionallyEditable(ConditionallyEditable.ConditionType.AllowLinkingWifiToChat)] - [Serialize(false, false, description: "If enabled, any signals received from another chat-linked wifi component are displayed " + - "as chat messages in the chatbox of the player holding the item.", alwaysUseInstanceValues: true)] - public bool LinkToChat - { - get; - set; - } + [ConditionallyEditable(ConditionallyEditable.ConditionType.AllowLinkingWifiToChat)] + [Serialize(false, false, description: "If enabled, any signals received from another chat-linked wifi component are displayed " + + "as chat messages in the chatbox of the player holding the item.", alwaysUseInstanceValues: true)] + public bool LinkToChat + { + get + { +#if SERVER + return GameMain.Lua.game.allowWifiChat; +#endif +#if CLIENT + return true; +#endif + } + set + { + + } + } + +// [Editable, Serialize(false, false, description: "If enabled, any signals received from another chat-linked wifi component are displayed " + +// "as chat messages in the chatbox of the player holding the item.", alwaysUseInstanceValues: true)] +// public bool LinkToChat +// { +// get +// { +//#if SERVER +// return GameMain.Lua.game.allowWifiChat; +//#endif +//#if CLIENT +// return true; +//#endif +// } +// set { } +// } [Editable, Serialize(1.0f, true, description: "How many seconds have to pass between signals for a message to be displayed in the chatbox. " + "Setting this to a very low value is not recommended, because it may cause an excessive amount of chat messages to be created " + @@ -168,9 +195,12 @@ namespace Barotrauma.Items.Components //signal strength diminishes by distance float sentSignalStrength = signal.strength * MathHelper.Clamp(1.0f - (Vector2.Distance(item.WorldPosition, wifiComp.item.WorldPosition) / wifiComp.range), 0.0f, 1.0f); - Signal s = new Signal(signal.value, signal.stepsTaken, sender: signal.sender, source: signal.source, - power: 0.0f, strength: sentSignalStrength); - wifiComp.item.SendSignal(s, "signal_out"); + + //Signal s = new Signal(signal.value, signal.stepsTaken, sender: signal.sender, source: signal.source, power: 0.0f, strength: sentSignalStrength); + + signal.source = null; + + wifiComp.item.SendSignal(signal, "signal_out"); if (signal.source != null) {