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,7 +1,6 @@
using Content.Server.Access.Systems;
using Content.Server.Administration;
using Content.Server.Administration.Systems;
using Content.Server.Mind.Components;
using Content.Server.PDA;
using Content.Server.StationRecords.Systems;
using Content.Shared.Access.Components;
@@ -46,16 +45,16 @@ public sealed class RenameCommand : IConsoleCommand
var oldName = metadata.EntityName;
entMan.System<MetaDataSystem>().SetEntityName(entityUid, name, metadata);
var entSysMan = IoCManager.Resolve<IEntitySystemManager>();
var minds = entMan.System<MindSystem>();
if (entMan.TryGetComponent(entityUid, out MindContainerComponent? mind) && mind.Mind != null)
if (minds.TryGetMind(entityUid, out var mindId, out var mind))
{
// Mind
mind.Mind.CharacterName = name;
mind.CharacterName = name;
}
// Id Cards
if (entSysMan.TryGetEntitySystem<IdCardSystem>(out var idCardSystem))
if (entMan.TrySystem<IdCardSystem>(out var idCardSystem))
{
if (idCardSystem.TryFindIdCard(entityUid, out var idCard))
{
@@ -63,7 +62,7 @@ public sealed class RenameCommand : IConsoleCommand
// Records
// This is done here because ID cards are linked to station records
if (entSysMan.TryGetEntitySystem<StationRecordsSystem>(out var recordsSystem)
if (entMan.TrySystem<StationRecordsSystem>(out var recordsSystem)
&& entMan.TryGetComponent(idCard.Owner, out StationRecordKeyStorageComponent? keyStorage)
&& keyStorage.Key != null)
{
@@ -80,7 +79,7 @@ public sealed class RenameCommand : IConsoleCommand
}
// PDAs
if (entSysMan.TryGetEntitySystem<PdaSystem>(out var pdaSystem))
if (entMan.TrySystem<PdaSystem>(out var pdaSystem))
{
var query = entMan.EntityQueryEnumerator<PdaComponent>();
while (query.MoveNext(out var uid, out var pda))
@@ -93,7 +92,7 @@ public sealed class RenameCommand : IConsoleCommand
}
// Admin Overlay
if (entSysMan.TryGetEntitySystem<AdminSystem>(out var adminSystem)
if (entMan.TrySystem<AdminSystem>(out var adminSystem)
&& entMan.TryGetComponent<ActorComponent>(entityUid, out var actorComp))
{
adminSystem.UpdatePlayerList(actorComp.PlayerSession);