diff --git a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs index b41983e5d..b675e5ea1 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Lua/LuaClasses.cs @@ -403,6 +403,34 @@ namespace Barotrauma { return File.Exists(path); } + + public static string[] DirSearch(string sDir) + { + List files = new List(); + + try + { + foreach (string f in Directory.GetFiles(sDir)) + { + files.Add(f); + } + + foreach (string d in Directory.GetDirectories(sDir)) + { + foreach (string f in Directory.GetFiles(d)) + { + files.Add(f); + } + DirSearch(d); + } + } + catch (System.Exception excpt) + { + Console.WriteLine(excpt.Message); + } + + return files.ToArray(); + } } private class LuaNetworking diff --git a/Barotrauma/BarotraumaServer/ServerSource/Networking/Voip/VoipServer.cs b/Barotrauma/BarotraumaServer/ServerSource/Networking/Voip/VoipServer.cs index c94e8cb1c..0267d5375 100644 --- a/Barotrauma/BarotraumaServer/ServerSource/Networking/Voip/VoipServer.cs +++ b/Barotrauma/BarotraumaServer/ServerSource/Networking/Voip/VoipServer.cs @@ -107,8 +107,19 @@ namespace Barotrauma.Networking if (recipientRadio.CanReceive(senderRadio)) { return true; } } + var should2 = GameMain.Lua.hook.Call("changeLocalVoiceRange", new object[] { sender, recipient }); + float range = 1.0f; + + if (should2 != null) + { + if (should2 is DynValue dyn) + { + range = (float)dyn.CastToNumber(); + } + } + //otherwise do a distance check - return ChatMessage.GetGarbleAmount(recipient.Character, sender.Character, ChatMessage.SpeakRange) < 1.0f; + return ChatMessage.GetGarbleAmount(recipient.Character, sender.Character, ChatMessage.SpeakRange) < range; } } }