Update WifiComponent.cs
This commit is contained in:
@@ -58,14 +58,41 @@ namespace Barotrauma.Items.Components
|
|||||||
set;
|
set;
|
||||||
}
|
}
|
||||||
|
|
||||||
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowLinkingWifiToChat)]
|
[ConditionallyEditable(ConditionallyEditable.ConditionType.AllowLinkingWifiToChat)]
|
||||||
[Serialize(false, false, description: "If enabled, any signals received from another chat-linked wifi component are displayed " +
|
[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)]
|
"as chat messages in the chatbox of the player holding the item.", alwaysUseInstanceValues: true)]
|
||||||
public bool LinkToChat
|
public bool LinkToChat
|
||||||
{
|
{
|
||||||
get;
|
get
|
||||||
set;
|
{
|
||||||
}
|
#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. " +
|
[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 " +
|
"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
|
//signal strength diminishes by distance
|
||||||
float sentSignalStrength = signal.strength *
|
float sentSignalStrength = signal.strength *
|
||||||
MathHelper.Clamp(1.0f - (Vector2.Distance(item.WorldPosition, wifiComp.item.WorldPosition) / wifiComp.range), 0.0f, 1.0f);
|
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);
|
//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.source = null;
|
||||||
|
|
||||||
|
wifiComp.item.SendSignal(signal, "signal_out");
|
||||||
|
|
||||||
if (signal.source != null)
|
if (signal.source != null)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user