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:
@@ -1,32 +1,32 @@
|
||||
using System.Numerics;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Throwing;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Database;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Body.Components;
|
||||
using Content.Server.Climbing;
|
||||
using Content.Server.Construction;
|
||||
using Content.Server.Fluids.EntitySystems;
|
||||
using Content.Server.Materials;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Power.Components;
|
||||
using Content.Shared.Administration.Logs;
|
||||
using Content.Shared.Audio;
|
||||
using Content.Shared.CCVar;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
using Content.Shared.Construction.Components;
|
||||
using Content.Shared.Database;
|
||||
using Content.Shared.DoAfter;
|
||||
using Content.Shared.Humanoid;
|
||||
using Content.Shared.Interaction;
|
||||
using Content.Shared.Interaction.Events;
|
||||
using Content.Shared.Jittering;
|
||||
using Content.Shared.Medical;
|
||||
using Content.Shared.Mobs.Components;
|
||||
using Content.Shared.Mobs.Systems;
|
||||
using Content.Shared.Nutrition.Components;
|
||||
using Content.Shared.Popups;
|
||||
using Robust.Shared.Random;
|
||||
using Robust.Shared.Configuration;
|
||||
using Content.Shared.Throwing;
|
||||
using Robust.Server.Player;
|
||||
using Robust.Shared.Configuration;
|
||||
using Robust.Shared.Physics.Components;
|
||||
using Content.Shared.Medical;
|
||||
using Robust.Shared.Random;
|
||||
|
||||
namespace Content.Server.Medical.BiomassReclaimer
|
||||
{
|
||||
@@ -45,6 +45,7 @@ namespace Content.Server.Medical.BiomassReclaimer
|
||||
[Dependency] private readonly SharedDoAfterSystem _doAfterSystem = default!;
|
||||
[Dependency] private readonly IPlayerManager _playerManager = default!;
|
||||
[Dependency] private readonly MaterialStorageSystem _material = default!;
|
||||
[Dependency] private readonly MindSystem _minds = default!;
|
||||
|
||||
public override void Update(float frameTime)
|
||||
{
|
||||
@@ -244,9 +245,9 @@ namespace Content.Server.Medical.BiomassReclaimer
|
||||
// Reject souled bodies in easy mode.
|
||||
if (_configManager.GetCVar(CCVars.BiomassEasyMode) &&
|
||||
HasComp<HumanoidAppearanceComponent>(dragged) &&
|
||||
TryComp<MindContainerComponent>(dragged, out var mindComp))
|
||||
_minds.TryGetMind(dragged, out _, out var mind))
|
||||
{
|
||||
if (mindComp.Mind?.UserId != null && _playerManager.TryGetSessionById(mindComp.Mind.UserId.Value, out _))
|
||||
if (mind.UserId != null && _playerManager.TryGetSessionById(mind.UserId.Value, out _))
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -5,7 +5,6 @@ using Content.Server.Electrocution;
|
||||
using Content.Server.EUI;
|
||||
using Content.Server.Ghost;
|
||||
using Content.Server.Mind;
|
||||
using Content.Server.Mind.Components;
|
||||
using Content.Server.Popups;
|
||||
using Content.Server.PowerCell;
|
||||
using Content.Shared.Damage;
|
||||
@@ -224,16 +223,16 @@ public sealed class DefibrillatorSystem : EntitySystem
|
||||
_mobState.ChangeMobState(target, MobState.Critical, mob, uid);
|
||||
_mobThreshold.SetAllowRevives(target, false, thresholds);
|
||||
|
||||
if (TryComp<MindContainerComponent>(target, out var mindComp) &&
|
||||
mindComp.Mind?.Session is { } playerSession)
|
||||
if (_mind.TryGetMind(target, out var mindId, out var mind) &&
|
||||
mind.Session is { } playerSession)
|
||||
{
|
||||
session = playerSession;
|
||||
// notify them they're being revived.
|
||||
if (mindComp.Mind.CurrentEntity != target)
|
||||
if (mind.CurrentEntity != target)
|
||||
{
|
||||
_chatManager.TrySendInGameICMessage(uid, Loc.GetString("defibrillator-ghosted"),
|
||||
InGameICChatType.Speak, true);
|
||||
_euiManager.OpenEui(new ReturnToBodyEui(mindComp.Mind, _mind), session);
|
||||
_euiManager.OpenEui(new ReturnToBodyEui(mind, _mind), session);
|
||||
}
|
||||
}
|
||||
else
|
||||
|
||||
Reference in New Issue
Block a user