]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Replace usages of MobObserver and AdminObserver with GameTicker consts (#21814)
authorDrSmugleaf <DrSmugleaf@users.noreply.github.com>
Tue, 21 Nov 2023 04:27:37 +0000 (20:27 -0800)
committerGitHub <noreply@github.com>
Tue, 21 Nov 2023 04:27:37 +0000 (15:27 +1100)
Content.IntegrationTests/Tests/FollowerSystemTest.cs
Content.IntegrationTests/Tests/Minds/MindTests.EntityDeletion.cs
Content.IntegrationTests/Tests/Minds/MindTests.Helpers.cs
Content.Server/Administration/Commands/AGhost.cs
Content.Server/GameTicking/GameTicker.GamePreset.cs
Content.Server/GameTicking/GameTicker.Spawning.cs
Content.Server/Mapping/MappingCommand.cs
Content.Server/Mind/MindSystem.cs

index ddd5c7a3f024db89c85d5e8e47a40da7a8c8c75a..4d308c6d911f67c0428bc0e988ee3ac22a6ad45a 100644 (file)
@@ -1,3 +1,4 @@
+using Content.Server.GameTicking;
 using Content.Shared.Follower;
 using Robust.Shared.GameObjects;
 using Robust.Shared.Log;
@@ -31,11 +32,11 @@ public sealed class FollowerSystemTest
             var map = mapMan.CreateMap();
 
             // Spawn an observer to be followed.
-            var followed = entMan.SpawnEntity("MobObserver", new MapCoordinates(0, 0, map));
+            var followed = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
             logger.Info($"Spawned followed observer: {entMan.ToPrettyString(followed)}");
 
             // Spawn an observer to follow another observer.
-            var follower = entMan.SpawnEntity("MobObserver", new MapCoordinates(0, 0, map));
+            var follower = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, new MapCoordinates(0, 0, map));
             logger.Info($"Spawned follower observer: {entMan.ToPrettyString(follower)}");
 
             followerSystem.StartFollowingEntity(follower, followed);
index a67a45ecb4c8ec386430757f0ce71ce28d164eff..2ebe750f98de77683469d0838a49d2db0e608af1 100644 (file)
@@ -1,5 +1,5 @@
 using System.Linq;
-using Content.Server.Players;
+using Content.Server.GameTicking;
 using Content.Shared.Ghost;
 using Content.Shared.Mind;
 using Content.Shared.Players;
@@ -173,7 +173,7 @@ public sealed partial class MindTests
         EntityUid ghost = default!;
         await server.WaitAssertion(() =>
         {
-            ghost = entMan.SpawnEntity("MobObserver", MapCoordinates.Nullspace);
+            ghost = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
             mindSystem.Visit(mind.Id, ghost);
         });
 
@@ -224,7 +224,7 @@ public sealed partial class MindTests
         var ghost = await BecomeGhost(pair);
 
         // Player is a normal ghost (not admin ghost).
-        Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.Not.EqualTo("AdminObserver"));
+        Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.Not.EqualTo(GameTicker.AdminObserverPrototypeName));
 
         // Try to become an admin ghost
         await server.WaitAssertion(() => serverConsole.ExecuteCommand(player, "aghost"));
@@ -235,7 +235,7 @@ public sealed partial class MindTests
         {
             Assert.That(player.AttachedEntity, Is.Not.EqualTo(ghost), "Player is still attached to the old ghost");
             Assert.That(entMan.HasComponent<GhostComponent>(player.AttachedEntity), "Player did not become a new ghost");
-            Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.EqualTo("AdminObserver"));
+            Assert.That(entMan.GetComponent<MetaDataComponent>(player.AttachedEntity!.Value).EntityPrototype?.ID, Is.EqualTo(GameTicker.AdminObserverPrototypeName));
         });
 
         var mindId = player.ContentData()?.Mind;
index d6b30d60a0f9e6d5f3ddb424de8e17476f3e7ab3..428380631d7fb19152167605ab49664fe0b8e30f 100644 (file)
@@ -1,7 +1,7 @@
 using System.Linq;
 using Content.IntegrationTests.Pair;
+using Content.Server.GameTicking;
 using Content.Server.Mind;
-using Content.Server.Players;
 using Content.Shared.Ghost;
 using Content.Shared.Mind;
 using Content.Shared.Players;
@@ -78,7 +78,7 @@ public sealed partial class MindTests
         await pair.Server.WaitAssertion(() =>
         {
             var oldUid = player.AttachedEntity;
-            ghostUid = entMan.SpawnEntity("MobObserver", MapCoordinates.Nullspace);
+            ghostUid = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
             mindId = mindSys.GetMind(player.UserId)!.Value;
             Assert.That(mindId, Is.Not.EqualTo(default(EntityUid)));
             mind = entMan.GetComponent<MindComponent>(mindId);
index 2d1a15a0bed00dc78cef48b900414de465df43ff..d541b1c8840a5ea59dd625679ca51e40f655eed6 100644 (file)
@@ -46,7 +46,7 @@ namespace Content.Server.Administration.Commands
             var coordinates = player.AttachedEntity != null
                 ? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
                 : EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
-            var ghost = _entities.SpawnEntity("AdminObserver", coordinates);
+            var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates);
             _entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
 
             if (canReturn)
index 2d7539bd0f119fd90ce56de58566a27b968c1ad5..4ede91babc3602f161be8dd9da0236e9cbc481bf 100644 (file)
@@ -262,7 +262,7 @@ namespace Content.Server.GameTicking
             var xformQuery = GetEntityQuery<TransformComponent>();
             var coords = _transform.GetMoverCoordinates(position, xformQuery);
 
-            var ghost = Spawn("MobObserver", coords);
+            var ghost = Spawn(ObserverPrototypeName, coords);
 
             // Try setting the ghost entity name to either the character name or the player name.
             // If all else fails, it'll default to the default entity prototype name, "observer".
index 81b8c6e5f609e508f998d99e3217767bf94eb5e6..1a86d9fef46122120a17859fee8e548b18e56c13 100644 (file)
@@ -31,6 +31,9 @@ namespace Content.Server.GameTicking
         [ValidatePrototypeId<EntityPrototype>]
         public const string ObserverPrototypeName = "MobObserver";
 
+        [ValidatePrototypeId<EntityPrototype>]
+        public const string AdminObserverPrototypeName = "AdminObserver";
+
         /// <summary>
         /// How many players have joined the round through normal methods.
         /// Useful for game rules to look at. Doesn't count observers, people in lobby, etc.
index d72a5c4178e61a7a61b6d864dc684425c016ff5b..08ba0de83346d4746cb459b4d7fdf62d75c04768 100644 (file)
@@ -3,6 +3,7 @@
 
 using System.Linq;
 using Content.Server.Administration;
+using Content.Server.GameTicking;
 using Content.Shared.Administration;
 using Content.Shared.CCVar;
 using Robust.Server.Player;
@@ -111,7 +112,7 @@ namespace Content.Server.Mapping
 
             // map successfully created. run misc helpful mapping commands
             if (player.AttachedEntity is { Valid: true } playerEntity &&
-                _entities.GetComponent<MetaDataComponent>(playerEntity).EntityPrototype?.ID != "AdminObserver")
+                _entities.GetComponent<MetaDataComponent>(playerEntity).EntityPrototype?.ID != GameTicker.AdminObserverPrototypeName)
             {
                 shell.ExecuteCommand("aghost");
             }
index 23ef89dd86e858353a66375cf7198917d727c464..4623c07052b5876fe48a4cec05be164d32431726 100644 (file)
@@ -250,7 +250,7 @@ public sealed class MindSystem : SharedMindSystem
                 ? _gameTicker.GetObserverSpawnPoint().ToMap(EntityManager, _transform)
                 : Transform(mind.OwnedEntity.Value).MapPosition;
 
-            entity = Spawn("MobObserver", position);
+            entity = Spawn(GameTicker.ObserverPrototypeName, position);
             component = EnsureComp<MindContainerComponent>(entity.Value);
             var ghostComponent = Comp<GhostComponent>(entity.Value);
             _ghosts.SetCanReturnToBody(ghostComponent, false);