Unstable v0.15.17.0 (Hex is out of town edition)

This commit is contained in:
Juan Pablo Arce
2021-12-03 13:31:10 -03:00
parent cd5c8f3e13
commit 617d9ede88
245 changed files with 8088 additions and 5842 deletions
@@ -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;