diff --git a/Subsurface/Source/GameMain.cs b/Subsurface/Source/GameMain.cs index 9ce4ad132..fc7ce8017 100644 --- a/Subsurface/Source/GameMain.cs +++ b/Subsurface/Source/GameMain.cs @@ -351,14 +351,14 @@ namespace Barotrauma } static bool waitForKeyHit = true; - public static CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) - { - waitForKeyHit = waitKeyHit; - titleScreenOpen = true; - TitleScreen.LoadState = null; - return CoroutineManager.StartCoroutine(TitleScreen.DoLoading(loader)); - } - + public static CoroutineHandle ShowLoading(IEnumerable loader, bool waitKeyHit = true) + { + waitForKeyHit = waitKeyHit; + titleScreenOpen = true; + TitleScreen.LoadState = null; + return CoroutineManager.StartCoroutine(TitleScreen.DoLoading(loader)); + } + protected override void OnExiting(object sender, EventArgs args) { if (NetworkMember != null) NetworkMember.Disconnect(); diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index f7cb530a2..b0eff72ff 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -199,7 +199,7 @@ namespace Barotrauma.Networking bool CanStart = false; DateTime timeOut = DateTime.Now + new TimeSpan(0,0,20); - DateTime reqAuthTime = DateTime.Now + new TimeSpan(0, 0, 1); + DateTime reqAuthTime = DateTime.Now + new TimeSpan(0, 0, 0, 0, 200); // Loop until we are approved while (!CanStart && !connectCancelled) @@ -288,6 +288,7 @@ namespace Barotrauma.Networking else { requiresPw = false; + reqAuthTime = DateTime.Now + new TimeSpan(0, 0, 0, 0, 200); } needAuth = false; //got auth! } diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index 78001e38d..3b2367894 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -354,22 +354,6 @@ namespace Barotrauma.Networking foreach (Client c in connectedClients) { - if (gameStarted) - { - if (c.inGame) - { - ClientWriteIngame(c); - } - else - { - - } - } - else - { - ClientWriteLobby(c); - } - //slowly reset spam timers c.ChatSpamTimer = Math.Max(0.0f, c.ChatSpamTimer - deltaTime); c.ChatSpamSpeed = Math.Max(0.0f, c.ChatSpamSpeed - deltaTime); @@ -457,7 +441,7 @@ namespace Barotrauma.Networking // if 30ms has passed if (updateTimer < DateTime.Now) { - if (gameStarted) + /*if (gameStarted) { float ignoreDistance = FarseerPhysics.ConvertUnits.ToDisplayUnits(NetConfig.CharacterIgnoreDistance); @@ -478,14 +462,32 @@ namespace Barotrauma.Networking //if (FarseerPhysics.ConvertUnits.ToSimUnits(diff.Length()) > NetConfig.CharacterIgnoreDistance) continue; } - } + }*/ if (server.ConnectionsCount > 0) { - if (sparseUpdateTimer < DateTime.Now) SparseUpdate(); - + if (sparseUpdateTimer < DateTime.Now) SparseUpdate(); + + foreach (Client c in ConnectedClients) + { + if (gameStarted) + { + if (c.inGame) + { + ClientWriteIngame(c); + } + else + { + ClientWriteLobby(c); + } + } + else + { + ClientWriteLobby(c); + } + } } - + updateTimer = DateTime.Now + updateInterval; } diff --git a/Subsurface/Source/Networking/GameServerLogin.cs b/Subsurface/Source/Networking/GameServerLogin.cs index 1f78cdd12..00032472c 100644 --- a/Subsurface/Source/Networking/GameServerLogin.cs +++ b/Subsurface/Source/Networking/GameServerLogin.cs @@ -187,6 +187,7 @@ namespace Barotrauma.Networking //new client Client newClient = new Client(clName, GetNewClientID()); + newClient.lastRecvChatMsgID = ChatMessage.LastID; newClient.Connection = unauthClient.Connection; unauthenticatedClients.Remove(unauthClient); unauthClient = null;