Fix aghost (#272)
This commit is contained in:
@@ -3,6 +3,7 @@ using Content.Shared.Administration;
|
|||||||
using Content.Shared.Ghost;
|
using Content.Shared.Ghost;
|
||||||
using Content.Shared.Mind;
|
using Content.Shared.Mind;
|
||||||
using Robust.Shared.Console;
|
using Robust.Shared.Console;
|
||||||
|
using Robust.Shared.Map;
|
||||||
|
|
||||||
namespace Content.Server.Administration.Commands
|
namespace Content.Server.Administration.Commands
|
||||||
{
|
{
|
||||||
@@ -33,6 +34,10 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
var metaDataSystem = _entities.System<MetaDataSystem>();
|
var metaDataSystem = _entities.System<MetaDataSystem>();
|
||||||
|
|
||||||
|
EntityCoordinates? coordinates = null;
|
||||||
|
if (player.AttachedEntity != null)
|
||||||
|
coordinates = _entities.GetComponent<TransformComponent>(player.AttachedEntity.Value).Coordinates;
|
||||||
|
|
||||||
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
|
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
|
||||||
{
|
{
|
||||||
mindSystem.UnVisit(mindId, mind);
|
mindSystem.UnVisit(mindId, mind);
|
||||||
@@ -43,10 +48,10 @@ namespace Content.Server.Administration.Commands
|
|||||||
|
|
||||||
var canReturn = mind.CurrentEntity != null
|
var canReturn = mind.CurrentEntity != null
|
||||||
&& !_entities.HasComponent<GhostComponent>(mind.CurrentEntity);
|
&& !_entities.HasComponent<GhostComponent>(mind.CurrentEntity);
|
||||||
var coordinates = player.AttachedEntity != null
|
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(GameTicker.AdminObserverPrototypeName, coordinates);
|
var ghost = _entities.SpawnEntity(GameTicker.AdminObserverPrototypeName, coordinates.Value);
|
||||||
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
_entities.GetComponent<TransformComponent>(ghost).AttachToGridOrMap();
|
||||||
|
|
||||||
if (canReturn)
|
if (canReturn)
|
||||||
|
|||||||
Reference in New Issue
Block a user