3d76e16...b52f40e

commit b52f40e6bb736069c945dd0028b39f39722ad0f5
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Mar 19 11:33:57 2019 +0200

    Fixed non-radio chat/VOIP having an unlimited distance. Closes #1291

commit 5e3bafed4528d36dd05968300aa01531377355f8
Author: Joonas Rikkonen <poe.regalis@gmail.com>
Date:   Tue Mar 19 00:19:11 2019 +0200

    Modifications to the private->public merge script
This commit is contained in:
Joonas Rikkonen
2019-03-19 11:40:19 +02:00
parent ab06d6fd6e
commit bfa6a093c4
3 changed files with 22 additions and 9 deletions
@@ -78,6 +78,7 @@ namespace Barotrauma.Networking
bool senderSpectating = sender.Character == null || sender.Character.IsDead;
//spectators cannot speak with in-game players or vice versa
//TODO: allow spectators to hear the voice chat if close enough to the speaker?
if (recipientSpectating != senderSpectating) { return false; }
//both spectating, no need to do radio/distance checks
@@ -129,10 +129,10 @@ namespace Barotrauma.Networking
if (listener.WorldPosition == sender.WorldPosition) { return 0.0f; }
float dist = Vector2.Distance(listener.WorldPosition, sender.WorldPosition);
if (dist > range) { return 0.0f; }
if (dist > range) { return 1.0f; }
if (Submarine.CheckVisibility(listener.SimPosition, sender.SimPosition) != null) dist = (dist + 100f) * obstructionmult;
if (dist > range) { return 0.0f; }
if (dist > range) { return 1.0f; }
return dist / range;
}
@@ -152,7 +152,7 @@ namespace Barotrauma.Networking
public static string ApplyDistanceEffect(string text, float garbleAmount)
{
if (garbleAmount < 0.3f) return text;
if (garbleAmount > 1.0f) return "";
if (garbleAmount >= 1.0f) return "";
int startIndex = Math.Max(text.IndexOf(':') + 1, 1);