]> git.deb.at Git - rhonda/impostor.git/commitdiff
Set player to death when disconnected
authorAeonLucid <aeonlucid@outlook.com>
Fri, 23 Oct 2020 22:35:54 +0000 (00:35 +0200)
committerAeonLucid <aeonlucid@outlook.com>
Fri, 23 Oct 2020 22:35:54 +0000 (00:35 +0200)
src/Impostor.Server/Net/State/Game.State.cs

index 147a833bc3a1fa514317038201ffb05fe61799f5..f62f60b2f0f7a505edc882efeebc0ec7a965a122 100644 (file)
@@ -39,6 +39,15 @@ namespace Impostor.Server.Net.State
 
             _logger.LogInformation("{0} - Player {1} ({2}) has left.", Code, player.Client.Name, playerId);
 
+            if (GameState == GameStates.Started)
+            {
+                if (player.Character?.PlayerInfo != null)
+                {
+                    player.Character.PlayerInfo.Disconnected = true;
+                    player.Character.PlayerInfo.LastDeathReason = DeathReason.Disconnect;
+                }
+            }
+
             player.Client.Player = null;
 
             // Game is empty, remove it.