Mind ECS (#16826)
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using Content.Server.GameTicking;
|
||||
using Content.Server.Ghost.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Players;
|
||||
using Content.Shared.Administration;
|
||||
using Content.Shared.Ghost;
|
||||
@@ -33,11 +34,15 @@ namespace Content.Server.Administration.Commands
|
||||
shell.WriteLine("You can't ghost here!");
|
||||
return;
|
||||
}
|
||||
|
||||
var mindSystem = _entities.System<MindSystem>();
|
||||
|
||||
if (mind.VisitingEntity != default && _entities.HasComponent<GhostComponent>(mind.VisitingEntity))
|
||||
if (mind.VisitingEntity != default && _entities.TryGetComponent<GhostComponent>(mind.VisitingEntity, out var oldGhostComponent))
|
||||
{
|
||||
player.ContentData()!.Mind?.UnVisit();
|
||||
return;
|
||||
mindSystem.UnVisit(mind);
|
||||
// If already an admin ghost, then return to body.
|
||||
if (oldGhostComponent.CanGhostInteract)
|
||||
return;
|
||||
}
|
||||
|
||||
var canReturn = mind.CurrentEntity != null
|
||||
@@ -56,12 +61,12 @@ namespace Content.Server.Administration.Commands
|
||||
else if (!string.IsNullOrWhiteSpace(mind.Session?.Name))
|
||||
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = mind.Session.Name;
|
||||
|
||||
mind.Visit(ghost);
|
||||
mindSystem.Visit(mind, ghost);
|
||||
}
|
||||
else
|
||||
{
|
||||
_entities.GetComponent<MetaDataComponent>(ghost).EntityName = player.Name;
|
||||
mind.TransferTo(ghost);
|
||||
mindSystem.TransferTo(mind, ghost);
|
||||
}
|
||||
|
||||
var comp = _entities.GetComponent<GhostComponent>(ghost);
|
||||
|
||||
Reference in New Issue
Block a user