Microwaved pais get scrambled name + randomly bricked (#19982)

Co-authored-by: deltanedas <@deltanedas:kde.org>
This commit is contained in:
deltanedas
2023-09-16 07:07:36 +01:00
committed by GitHub
parent 8aba52d796
commit e8c58d1574
4 changed files with 166 additions and 75 deletions

View File

@@ -124,6 +124,7 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem
{
if (component.Deleted || !HasComp<GhostTakeoverAvailableComponent>(uid))
return;
RemCompDeferred<GhostTakeoverAvailableComponent>(uid);
RemCompDeferred<GhostRoleComponent>(uid);
_popup.PopupEntity(Loc.GetString(component.StopSearchVerbPopup), uid, args.User);
@@ -133,4 +134,26 @@ public sealed class ToggleableGhostRoleSystem : EntitySystem
args.Verbs.Add(verb);
}
}
/// <summary>
/// If there is a player present, kicks it out.
/// If not, prevents future ghosts taking it.
/// No popups are made, but appearance is updated.
/// </summary>
public void Wipe(EntityUid uid)
{
if (TryComp<MindContainerComponent>(uid, out var mindContainer) &&
mindContainer.HasMind &&
_mind.TryGetMind(uid, out var mindId, out var mind))
{
_mind.TransferTo(mindId, null, mind: mind);
}
if (!HasComp<GhostTakeoverAvailableComponent>(uid))
return;
RemCompDeferred<GhostTakeoverAvailableComponent>(uid);
RemCompDeferred<GhostRoleComponent>(uid);
UpdateAppearance(uid, ToggleableGhostRoleStatus.Off);
}
}