]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
fix observer ghost spawn error (#35253)
authorErrant <35878406+Errant-4@users.noreply.github.com>
Tue, 18 Feb 2025 12:28:54 +0000 (13:28 +0100)
committerGitHub <noreply@github.com>
Tue, 18 Feb 2025 12:28:54 +0000 (23:28 +1100)
Content.Server/GameTicking/GameTicker.Spawning.cs

index ed1246f78951eba7ba155592a3dd29324dfcc69b..a103a197337bea783e4ebc56df361ede8b7db4b7 100644 (file)
@@ -359,6 +359,7 @@ namespace Content.Server.GameTicking
             if (DummyTicker)
                 return;
 
+            var makeObserver = false;
             Entity<MindComponent?>? mind = player.GetMind();
             if (mind == null)
             {
@@ -366,10 +367,13 @@ namespace Content.Server.GameTicking
                 var (mindId, mindComp) = _mind.CreateMind(player.UserId, name);
                 mind = (mindId, mindComp);
                 _mind.SetUserId(mind.Value, player.UserId);
-                _roles.MindAddRole(mind.Value, "MindRoleObserver");
+                makeObserver = true;
             }
 
             var ghost = _ghost.SpawnGhost(mind.Value);
+            if (makeObserver)
+                _roles.MindAddRole(mind.Value, "MindRoleObserver");
+
             _adminLogger.Add(LogType.LateJoin,
                 LogImpact.Low,
                 $"{player.Name} late joined the round as an Observer with {ToPrettyString(ghost):entity}.");