Increase muffling effects with obstruction for spoken speech (barely affects radio chat and wifi components, however it does add extra 100f range to the distance)

Decreased required muffling to 0.3f
Added an "obstructionmult" to intensify speaking obstruction effects
This commit is contained in:
Alex Noir
2017-12-17 14:55:35 +03:00
parent 828bde6f04
commit d5e409bfff
2 changed files with 4 additions and 4 deletions

View File

@@ -105,18 +105,18 @@ namespace Barotrauma.Networking
return ApplyDistanceEffect(listener, Sender, Text, SpeakRange);
}
public static string ApplyDistanceEffect(Entity listener, Entity Sender, string text, float range)
public static string ApplyDistanceEffect(Entity listener, Entity Sender, string text, float range, float obstructionmult = 2.0f)
{
if (listener.WorldPosition == Sender.WorldPosition) return text;
float dist = Vector2.Distance(listener.WorldPosition, Sender.WorldPosition);
if (dist > range) return "";
if (Submarine.CheckVisibility(listener.SimPosition, Sender.SimPosition) != null) dist *= 2.0f;
if (Submarine.CheckVisibility(listener.SimPosition, Sender.SimPosition) != null) dist = (dist + 100f) * obstructionmult;
if (dist > range) return "";
float garbleAmount = dist / range;
if (garbleAmount < 0.5f) return text;
if (garbleAmount < 0.3f) return text;
int startIndex = Math.Max(text.IndexOf(':') + 1, 1);

View File

@@ -1848,7 +1848,7 @@ namespace Barotrauma.Networking
case ChatMessageType.Default:
if (!receiver.IsDead)
{
return ChatMessage.ApplyDistanceEffect(receiver, sender, message, ChatMessage.SpeakRange);
return ChatMessage.ApplyDistanceEffect(receiver, sender, message, ChatMessage.SpeakRange, 3.0f);
}
break;
case ChatMessageType.Radio: