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

@@ -2,17 +2,15 @@ using System.Linq;
using Content.Server.Administration.Logs;
using Content.Server.Administration.Managers;
using Content.Server.Administration.Systems;
using Content.Server.Mind.Components;
using Content.Server.Mind;
using Content.Server.MoMMI;
using Content.Server.Preferences.Managers;
using Content.Server.Station.Systems;
using Content.Shared.Administration;
using Content.Shared.CCVar;
using Content.Shared.Chat;
using Content.Shared.Database;
using Robust.Server.Player;
using Robust.Shared.Configuration;
using Robust.Shared.Map;
using Robust.Shared.Network;
using Robust.Shared.Player;
using Robust.Shared.Replays;
@@ -116,19 +114,19 @@ namespace Content.Server.Chat.Managers
ChatMessageToMany(ChatChannel.AdminAlert, message, wrappedMessage, default, false, true, clients);
}
public void SendAdminAlert(EntityUid player, string message, MindContainerComponent? mindContainerComponent = null)
public void SendAdminAlert(EntityUid player, string message)
{
if ((mindContainerComponent == null && !_entityManager.TryGetComponent(player, out mindContainerComponent)) || !mindContainerComponent.HasMind)
var mindSystem = _entityManager.System<MindSystem>();
if (!mindSystem.TryGetMind(player, out var mindId, out var mind))
{
SendAdminAlert(message);
return;
}
var adminSystem = _entityManager.System<AdminSystem>();
var antag = mindContainerComponent.Mind!.UserId != null
&& (adminSystem.GetCachedPlayerInfo(mindContainerComponent.Mind!.UserId.Value)?.Antag ?? false);
var antag = mind.UserId != null && (adminSystem.GetCachedPlayerInfo(mind.UserId.Value)?.Antag ?? false);
SendAdminAlert($"{mindContainerComponent.Mind!.Session?.Name}{(antag ? " (ANTAG)" : "")} {message}");
SendAdminAlert($"{mind.Session?.Name}{(antag ? " (ANTAG)" : "")} {message}");
}
public void SendHookOOC(string sender, string message)