Unstable v0.15.17.0 (Hex is out of town edition)
This commit is contained in:
@@ -36,9 +36,9 @@ namespace Barotrauma.Items.Components
|
||||
if (UseHSV)
|
||||
{
|
||||
Color hsvColor = ToolBox.HSVToRGB(signalR, signalG, signalB);
|
||||
signalR = hsvColor.R / (float) byte.MaxValue;
|
||||
signalG = hsvColor.G / (float) byte.MaxValue;
|
||||
signalB = hsvColor.B / (float) byte.MaxValue;
|
||||
signalR = hsvColor.R;
|
||||
signalG = hsvColor.G;
|
||||
signalB = hsvColor.B;
|
||||
}
|
||||
|
||||
output = signalR.ToString("G", CultureInfo.InvariantCulture);
|
||||
|
||||
@@ -36,9 +36,17 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
case FunctionType.Round:
|
||||
value = MathF.Round(value);
|
||||
if (value == -0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
break;
|
||||
case FunctionType.Ceil:
|
||||
value = MathF.Ceiling(value);
|
||||
if (value == -0)
|
||||
{
|
||||
value = 0;
|
||||
}
|
||||
break;
|
||||
case FunctionType.Floor:
|
||||
value = MathF.Floor(value);
|
||||
|
||||
@@ -105,7 +105,7 @@ namespace Barotrauma.Items.Components
|
||||
switch (connection.Name)
|
||||
{
|
||||
case "set_text":
|
||||
|
||||
case "signal_in":
|
||||
if (signal.value.Length > MaxMessageLength)
|
||||
{
|
||||
signal.value = signal.value.Substring(0, MaxMessageLength);
|
||||
@@ -128,6 +128,8 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
history.ClearChildren();
|
||||
}
|
||||
|
||||
CreateFillerBlock();
|
||||
#endif
|
||||
break;
|
||||
}
|
||||
|
||||
@@ -100,7 +100,12 @@ namespace Barotrauma.Items.Components
|
||||
|
||||
if (item.CurrentHull != null)
|
||||
{
|
||||
int waterPercentage = MathHelper.Clamp((int)Math.Ceiling(item.CurrentHull.WaterPercentage), 0, 100);
|
||||
int waterPercentage = 0;
|
||||
//ignore minuscule amounts of water
|
||||
if (item.CurrentHull.WaterVolume < 1.0f)
|
||||
{
|
||||
waterPercentage = MathHelper.Clamp((int)Math.Ceiling(item.CurrentHull.WaterPercentage), 0, 100);
|
||||
}
|
||||
item.SendSignal(waterPercentage.ToString(), "water_%");
|
||||
}
|
||||
string highPressureOut = (item.CurrentHull == null || item.CurrentHull.LethalPressure > 5.0f) ? "1" : "0";
|
||||
|
||||
@@ -112,7 +112,10 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
return HasRequiredContainedItems(user: null, addMessage: false);
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Returns the wifi components that can receive signals from this one
|
||||
/// </summary>
|
||||
public IEnumerable<WifiComponent> GetReceiversInRange()
|
||||
{
|
||||
return list.Where(w => w != this && w.CanReceive(this));
|
||||
@@ -121,11 +124,7 @@ namespace Barotrauma.Items.Components
|
||||
public bool CanReceive(WifiComponent sender)
|
||||
{
|
||||
if (sender == null || sender.channel != channel) { return false; }
|
||||
|
||||
if (sender.TeamID != TeamID && !AllowCrossTeamCommunication)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (sender.TeamID != TeamID && !AllowCrossTeamCommunication) { return false; }
|
||||
|
||||
//if the component is not linked to chat and has nothing connected to the output, sending a signal to it does nothing
|
||||
// = no point in receiving
|
||||
@@ -142,6 +141,21 @@ namespace Barotrauma.Items.Components
|
||||
return HasRequiredContainedItems(user: null, addMessage: false);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Returns the wifi components that can transmit signals to this one
|
||||
/// </summary>
|
||||
public IEnumerable<WifiComponent> GetTransmittersInRange()
|
||||
{
|
||||
return list.Where(w => w != this && w.CanTransmit(this));
|
||||
}
|
||||
|
||||
public bool CanTransmit(WifiComponent sender)
|
||||
{
|
||||
if (sender == null || sender.channel != channel) { return false; }
|
||||
if (sender.TeamID != TeamID && !AllowCrossTeamCommunication) { return false; }
|
||||
if (Vector2.DistanceSquared(item.WorldPosition, sender.item.WorldPosition) > sender.range * sender.range) { return false; }
|
||||
return HasRequiredContainedItems(user: null, addMessage: false);
|
||||
}
|
||||
public override void Update(float deltaTime, Camera cam)
|
||||
{
|
||||
chatMsgCooldown -= deltaTime;
|
||||
|
||||
@@ -756,14 +756,17 @@ namespace Barotrauma.Items.Components
|
||||
{
|
||||
if (item.ParentInventory != null) { return; }
|
||||
#if CLIENT
|
||||
if (!relativeToSub && Screen.Selected != GameMain.SubEditorScreen) { return; }
|
||||
if (!relativeToSub)
|
||||
{
|
||||
if (Screen.Selected != GameMain.SubEditorScreen || (item.Submarine?.Loading ?? false)) { return; }
|
||||
}
|
||||
#else
|
||||
if (!relativeToSub) { return; }
|
||||
#endif
|
||||
|
||||
Vector2 refPos = item.Submarine == null ?
|
||||
Vector2.Zero :
|
||||
item.Position - item.Submarine.HiddenSubPosition;
|
||||
item.Position - item.Submarine.HiddenSubPosition;
|
||||
|
||||
for (int i = 0; i < nodes.Count; i++)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user