From d5e409bfff929556c48f5f2f15263ba361e40597 Mon Sep 17 00:00:00 2001 From: Alex Noir Date: Sun, 17 Dec 2017 14:55:35 +0300 Subject: [PATCH] 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 --- .../BarotraumaShared/Source/Networking/ChatMessage.cs | 6 +++--- Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs b/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs index 6b7a2333f..e69dbf80f 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/ChatMessage.cs @@ -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); diff --git a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs index cec645624..b40f789c1 100644 --- a/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs +++ b/Barotrauma/BarotraumaShared/Source/Networking/GameServer.cs @@ -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: