Refactor minds to be entities with components, make roles components (#19591)

Co-authored-by: ShadowCommander <10494922+ShadowCommander@users.noreply.github.com>
Co-authored-by: DrSmugleaf <DrSmugleaf@users.noreply.github.com>
This commit is contained in:
DrSmugleaf
2023-08-28 16:53:24 -07:00
committed by GitHub
parent e0ee397af7
commit 15c0211fb2
119 changed files with 1445 additions and 1289 deletions

View File

@@ -1,5 +1,5 @@
using Content.Server.GameTicking;
using Content.Server.Players;
using Content.Server.Mind;
using Content.Shared.Administration;
using Robust.Server.Player;
using Robust.Shared.Console;
@@ -9,6 +9,8 @@ namespace Content.Server.Ghost
[AnyCommand]
public sealed class Ghost : IConsoleCommand
{
[Dependency] private readonly IEntityManager _entities = default!;
public string Command => "ghost";
public string Description => "Give up on life and become a ghost.";
public string Help => "ghost";
@@ -22,14 +24,14 @@ namespace Content.Server.Ghost
return;
}
var mind = player.ContentData()?.Mind;
if (mind == null)
var minds = _entities.System<MindSystem>();
if (!minds.TryGetMind(player, out var mindId, out var mind))
{
shell.WriteLine("You have no Mind, you can't ghost.");
return;
}
if (!EntitySystem.Get<GameTicker>().OnGhostAttempt(mind, true, viaCommand:true))
if (!EntitySystem.Get<GameTicker>().OnGhostAttempt(mindId, true, true, mind))
{
shell.WriteLine("You can't ghost right now.");
}