fixes ghost duplication on aghosting (#3235)
Co-authored-by: Injazz <injazza@gmail.com>
This commit is contained in:
@@ -33,32 +33,29 @@ namespace Content.Server.Administration.Commands
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (mind.VisitingEntity != null && mind.VisitingEntity.Prototype?.ID == "AdminObserver")
|
if (mind.VisitingEntity != null && mind.VisitingEntity.HasComponent<GhostComponent>())
|
||||||
{
|
{
|
||||||
var visiting = mind.VisitingEntity;
|
shell.WriteLine("Aren't you a ghost already?");
|
||||||
mind.UnVisit();
|
return;
|
||||||
visiting.Delete();
|
}
|
||||||
|
|
||||||
|
var canReturn = mind.CurrentEntity != null;
|
||||||
|
var ghost = IoCManager.Resolve<IEntityManager>()
|
||||||
|
.SpawnEntity("AdminObserver", player.AttachedEntity?.Transform.Coordinates
|
||||||
|
?? IoCManager.Resolve<IGameTicker>().GetObserverSpawnPoint());
|
||||||
|
|
||||||
|
if (canReturn)
|
||||||
|
{
|
||||||
|
ghost.Name = mind.CharacterName;
|
||||||
|
mind.Visit(ghost);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var canReturn = mind.CurrentEntity != null;
|
ghost.Name = player.Name;
|
||||||
var ghost = IoCManager.Resolve<IEntityManager>()
|
mind.TransferTo(ghost);
|
||||||
.SpawnEntity("AdminObserver", player.AttachedEntity?.Transform.Coordinates
|
|
||||||
?? IoCManager.Resolve<IGameTicker>().GetObserverSpawnPoint());
|
|
||||||
|
|
||||||
if (canReturn)
|
|
||||||
{
|
|
||||||
ghost.Name = mind.CharacterName;
|
|
||||||
mind.Visit(ghost);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ghost.Name = player.Name;
|
|
||||||
mind.TransferTo(ghost);
|
|
||||||
}
|
|
||||||
|
|
||||||
ghost.GetComponent<GhostComponent>().CanReturnToBody = canReturn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
ghost.GetComponent<GhostComponent>().CanReturnToBody = canReturn;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user