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:
@@ -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);
|
||||
|
||||
|
||||
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user