Replace usages of MobObserver and AdminObserver with GameTicker consts (#21814)
This commit is contained in:
@@ -1,3 +1,4 @@
|
|||||||
|
using Content.Server.GameTicking;
|
||||||
using Content.Shared.Follower;
|
using Content.Shared.Follower;
|
||||||
using Robust.Shared.GameObjects;
|
using Robust.Shared.GameObjects;
|
||||||
using Robust.Shared.Log;
|
using Robust.Shared.Log;
|
||||||
@@ -31,11 +32,11 @@ public sealed class FollowerSystemTest
|
|||||||
var map = mapMan.CreateMap();
|
var map = mapMan.CreateMap();
|
||||||
|
|
||||||
// Spawn an observer to be followed.
|
// 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)}");
|
logger.Info($"Spawned followed observer: {entMan.ToPrettyString(followed)}");
|
||||||
|
|
||||||
// Spawn an observer to follow another observer.
|
// 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)}");
|
logger.Info($"Spawned follower observer: {entMan.ToPrettyString(follower)}");
|
||||||
|
|
||||||
followerSystem.StartFollowingEntity(follower, followed);
|
followerSystem.StartFollowingEntity(follower, followed);
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Players;
|
using Content.Server.GameTicking;
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
@@ -173,7 +173,7 @@ public sealed partial class MindTests
|
|||||||
EntityUid ghost = default!;
|
EntityUid ghost = default!;
|
||||||
await server.WaitAssertion(() =>
|
await server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
ghost = entMan.SpawnEntity("MobObserver", MapCoordinates.Nullspace);
|
ghost = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
|
||||||
mindSystem.Visit(mind.Id, ghost);
|
mindSystem.Visit(mind.Id, ghost);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -224,7 +224,7 @@ public sealed partial class MindTests
|
|||||||
var ghost = await BecomeGhost(pair);
|
var ghost = await BecomeGhost(pair);
|
||||||
|
|
||||||
// Player is a normal ghost (not admin ghost).
|
// 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
|
// Try to become an admin ghost
|
||||||
await server.WaitAssertion(() => serverConsole.ExecuteCommand(player, "aghost"));
|
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(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.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;
|
var mindId = player.ContentData()?.Mind;
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.IntegrationTests.Pair;
|
using Content.IntegrationTests.Pair;
|
||||||
|
using Content.Server.GameTicking;
|
||||||
using Content.Server.Mind;
|
using Content.Server.Mind;
|
||||||
using Content.Server.Players;
|
|
||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Content.Shared.Players;
|
using Content.Shared.Players;
|
||||||
@@ -78,7 +78,7 @@ public sealed partial class MindTests
|
|||||||
await pair.Server.WaitAssertion(() =>
|
await pair.Server.WaitAssertion(() =>
|
||||||
{
|
{
|
||||||
var oldUid = player.AttachedEntity;
|
var oldUid = player.AttachedEntity;
|
||||||
ghostUid = entMan.SpawnEntity("MobObserver", MapCoordinates.Nullspace);
|
ghostUid = entMan.SpawnEntity(GameTicker.ObserverPrototypeName, MapCoordinates.Nullspace);
|
||||||
mindId = mindSys.GetMind(player.UserId)!.Value;
|
mindId = mindSys.GetMind(player.UserId)!.Value;
|
||||||
Assert.That(mindId, Is.Not.EqualTo(default(EntityUid)));
|
Assert.That(mindId, Is.Not.EqualTo(default(EntityUid)));
|
||||||
mind = entMan.GetComponent<MindComponent>(mindId);
|
mind = entMan.GetComponent<MindComponent>(mindId);
|
||||||
|
|||||||
@@ -46,7 +46,7 @@ namespace Content.Server.Administration.Commands
|
|||||||
var coordinates = player.AttachedEntity != null
|
var coordinates = player.AttachedEntity != null
|
||||||
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
? _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates
|
||||||
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
: EntitySystem.Get<GameTicker>().GetObserverSpawnPoint();
|
||||||
var ghost = _entities.SpawnEntity("AdminObserver", coordinates);
|
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates);
|
||||||
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
||||||
|
|
||||||
if (canReturn)
|
if (canReturn)
|
||||||
|
|||||||
@@ -262,7 +262,7 @@ namespace Content.Server.GameTicking
|
|||||||
var xformQuery = GetEntityQuery<TransformComponent>();
|
var xformQuery = GetEntityQuery<TransformComponent>();
|
||||||
var coords = _transform.GetMoverCoordinates(position, xformQuery);
|
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.
|
// 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".
|
// If all else fails, it'll default to the default entity prototype name, "observer".
|
||||||
|
|||||||
@@ -31,6 +31,9 @@ namespace Content.Server.GameTicking
|
|||||||
[ValidatePrototypeId<EntityPrototype>]
|
[ValidatePrototypeId<EntityPrototype>]
|
||||||
public const string ObserverPrototypeName = "MobObserver";
|
public const string ObserverPrototypeName = "MobObserver";
|
||||||
|
|
||||||
|
[ValidatePrototypeId<EntityPrototype>]
|
||||||
|
public const string AdminObserverPrototypeName = "AdminObserver";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// How many players have joined the round through normal methods.
|
/// 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.
|
/// Useful for game rules to look at. Doesn't count observers, people in lobby, etc.
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
|
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Content.Server.Administration;
|
using Content.Server.Administration;
|
||||||
|
using Content.Server.GameTicking;
|
||||||
using Content.Shared.Administration;
|
using Content.Shared.Administration;
|
||||||
using Content.Shared.CCVar;
|
using Content.Shared.CCVar;
|
||||||
using Robust.Server.Player;
|
using Robust.Server.Player;
|
||||||
@@ -111,7 +112,7 @@ namespace Content.Server.Mapping
|
|||||||
|
|
||||||
// map successfully created. run misc helpful mapping commands
|
// map successfully created. run misc helpful mapping commands
|
||||||
if (player.AttachedEntity is { Valid: true } playerEntity &&
|
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");
|
shell.ExecuteCommand("aghost");
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -250,7 +250,7 @@ public sealed class MindSystem : SharedMindSystem
|
|||||||
? _gameTicker.GetObserverSpawnPoint().ToMap(EntityManager, _transform)
|
? _gameTicker.GetObserverSpawnPoint().ToMap(EntityManager, _transform)
|
||||||
: Transform(mind.OwnedEntity.Value).MapPosition;
|
: Transform(mind.OwnedEntity.Value).MapPosition;
|
||||||
|
|
||||||
entity = Spawn("MobObserver", position);
|
entity = Spawn(GameTicker.ObserverPrototypeName, position);
|
||||||
component = EnsureComp<MindContainerComponent>(entity.Value);
|
component = EnsureComp<MindContainerComponent>(entity.Value);
|
||||||
var ghostComponent = Comp<GhostComponent>(entity.Value);
|
var ghostComponent = Comp<GhostComponent>(entity.Value);
|
||||||
_ghosts.SetCanReturnToBody(ghostComponent, false);
|
_ghosts.SetCanReturnToBody(ghostComponent, false);
|
||||||
|
|||||||
Reference in New Issue
Block a user