Fix ControlMob not deleting ghosts

This commit is contained in:
zumorica
2020-04-17 19:28:08 +02:00
parent a4110799b8
commit a408cdad0a
2 changed files with 11 additions and 0 deletions

View File

@@ -1,4 +1,5 @@
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Observer;
using Content.Server.Mobs; using Content.Server.Mobs;
using Content.Server.Players; using Content.Server.Players;
using Robust.Server.Interfaces.Console; using Robust.Server.Interfaces.Console;
@@ -55,9 +56,14 @@ namespace Content.Server.Administration
return; return;
} }
var oldEntity = mind.CurrentEntity;
mindComponent.Mind?.TransferTo(null); mindComponent.Mind?.TransferTo(null);
mind.TransferTo(target); mind.TransferTo(target);
if(oldEntity.HasComponent<GhostComponent>())
oldEntity.Delete();
} }
} }
} }

View File

@@ -1,6 +1,7 @@
using Content.Server.GameObjects; using Content.Server.GameObjects;
using Content.Server.GameObjects.Components.Mobs; using Content.Server.GameObjects.Components.Mobs;
using Content.Server.GameObjects.Components.Nutrition; using Content.Server.GameObjects.Components.Nutrition;
using Content.Server.GameObjects.Components.Observer;
using Content.Server.Players; using Content.Server.Players;
using Content.Shared.GameObjects; using Content.Shared.GameObjects;
using Robust.Server.Console; using Robust.Server.Console;
@@ -41,9 +42,13 @@ namespace Content.Server.GlobalVerbs
{ {
var userMind = user.GetComponent<IActorComponent>().playerSession.ContentData().Mind; var userMind = user.GetComponent<IActorComponent>().playerSession.ContentData().Mind;
var targetMind = target.GetComponent<MindComponent>(); var targetMind = target.GetComponent<MindComponent>();
var oldEntity = userMind.CurrentEntity;
targetMind.Mind?.TransferTo(null); targetMind.Mind?.TransferTo(null);
userMind.TransferTo(target); userMind.TransferTo(target);
if(oldEntity.HasComponent<GhostComponent>())
oldEntity.Delete();
} }
} }
} }