From 7e14ca6186539a430b192b5ef6bb44a4b6b70966 Mon Sep 17 00:00:00 2001 From: Regalis Date: Sun, 14 Aug 2016 20:13:40 +0300 Subject: [PATCH] Possible to use the same sub as the main submarine and the respawn shuttle, fixed duplicate client names in netlobby if reconnecting before the server has disconnected the client, fixed "end round" button not appearing when joining mid-round --- Subsurface/Source/Networking/GameClient.cs | 27 +++++-------------- Subsurface/Source/Networking/GameServer.cs | 3 +++ .../Source/Networking/RespawnManager.cs | 2 +- 3 files changed, 10 insertions(+), 22 deletions(-) diff --git a/Subsurface/Source/Networking/GameClient.cs b/Subsurface/Source/Networking/GameClient.cs index 52c51220e..a0bbfdbe3 100644 --- a/Subsurface/Source/Networking/GameClient.cs +++ b/Subsurface/Source/Networking/GameClient.cs @@ -386,6 +386,10 @@ namespace Barotrauma.Networking public override void Update(float deltaTime) { +#if DEBUG + if (PlayerInput.GetKeyboardState.IsKeyDown(Microsoft.Xna.Framework.Input.Keys.P)) return; +#endif + base.Update(deltaTime); if (!connected) return; @@ -736,22 +740,6 @@ namespace Barotrauma.Networking crew.Add(newCharacter); } - //int count = inc.ReadByte(); - //for (int n = 0; n < count; n++) - //{ - // byte id = inc.ReadByte(); - // Character newCharacter = ReadCharacterData(inc, id == myID); - - // if (id != myID) - // { - // var characterOwner = otherClients.Find(c => c.ID == id); - // if (characterOwner != null) characterOwner.Character = newCharacter; - // } - - // crew.Add(newCharacter); - - // yield return CoroutineStatus.Running; - //} } gameStarted = true; @@ -1107,11 +1095,6 @@ namespace Barotrauma.Networking character.ID = ID; - //WayPoint spawnPoint = Entity.FindEntityByID(spawnPointID) as WayPoint; - //if (spawnPoint != null) - //{ - // //character.GiveJobItems(spawnPoint); - //} Item.Spawner.ReadNetworkData(inc); @@ -1120,6 +1103,8 @@ namespace Barotrauma.Networking myCharacter = character; Character.Controlled = character; GameMain.LightManager.LosEnabled = true; + + if (endRoundButton != null) endRoundButton.Visible = Voting.AllowEndVoting; } return character; diff --git a/Subsurface/Source/Networking/GameServer.cs b/Subsurface/Source/Networking/GameServer.cs index a11f2f293..00357a32a 100644 --- a/Subsurface/Source/Networking/GameServer.cs +++ b/Subsurface/Source/Networking/GameServer.cs @@ -457,6 +457,7 @@ namespace Barotrauma.Networking { //AssignJobs(); + GameMain.NetLobbyScreen.RemovePlayer(sender.name); GameMain.NetLobbyScreen.AddPlayer(sender.name); // Notify the client that they have logged in @@ -1301,6 +1302,8 @@ namespace Barotrauma.Networking client.Character.Kill(CauseOfDeath.Disconnected, true); } + client.Character = null; + client.inGame = false; if (string.IsNullOrWhiteSpace(msg)) msg = client.name + " has left the server"; if (string.IsNullOrWhiteSpace(targetmsg)) targetmsg = "You have left the server"; diff --git a/Subsurface/Source/Networking/RespawnManager.cs b/Subsurface/Source/Networking/RespawnManager.cs index 978915981..f09b89408 100644 --- a/Subsurface/Source/Networking/RespawnManager.cs +++ b/Subsurface/Source/Networking/RespawnManager.cs @@ -65,7 +65,7 @@ namespace Barotrauma.Networking { this.networkMember = networkMember; - respawnShuttle = shuttle; + respawnShuttle = new Submarine(shuttle.FilePath, shuttle.MD5Hash.Hash, true); respawnShuttle.Load(false); ResetShuttle();