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:
@@ -40,8 +40,8 @@ public sealed partial class BorgSystem
|
||||
linked.LinkedMMI = uid;
|
||||
Dirty(uid, component);
|
||||
|
||||
if (_mind.TryGetMind(ent, out var mind))
|
||||
_mind.TransferTo(mind, uid, true);
|
||||
if (_mind.TryGetMind(ent, out var mindId, out var mind))
|
||||
_mind.TransferTo(mindId, uid, true, mind: mind);
|
||||
|
||||
_appearance.SetData(uid, MMIVisuals.BrainPresent, true);
|
||||
}
|
||||
@@ -58,9 +58,11 @@ public sealed partial class BorgSystem
|
||||
|
||||
private void OnMMILinkedMindAdded(EntityUid uid, MMILinkedComponent component, MindAddedMessage args)
|
||||
{
|
||||
if (!_mind.TryGetMind(uid, out var mind) || component.LinkedMMI == null)
|
||||
if (!_mind.TryGetMind(uid, out var mindId, out var mind) ||
|
||||
component.LinkedMMI == null)
|
||||
return;
|
||||
_mind.TransferTo(mind, component.LinkedMMI, true);
|
||||
|
||||
_mind.TransferTo(mindId, component.LinkedMMI, true, mind: mind);
|
||||
}
|
||||
|
||||
private void OnMMILinkedRemoved(EntityUid uid, MMILinkedComponent component, EntGotRemovedFromContainerMessage args)
|
||||
@@ -72,8 +74,8 @@ public sealed partial class BorgSystem
|
||||
return;
|
||||
RemComp(uid, component);
|
||||
|
||||
if (_mind.TryGetMind(linked, out var mind))
|
||||
_mind.TransferTo(mind, uid, true);
|
||||
if (_mind.TryGetMind(linked, out var mindId, out var mind))
|
||||
_mind.TransferTo(mindId, uid, true, mind: mind);
|
||||
|
||||
_appearance.SetData(linked, MMIVisuals.BrainPresent, false);
|
||||
}
|
||||
|
||||
@@ -96,7 +96,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
brain != null &&
|
||||
component.BrainWhitelist?.IsValid(used) != false)
|
||||
{
|
||||
if (_mind.TryGetMind(used, out var mind) && mind.Session != null)
|
||||
if (_mind.TryGetMind(used, out _, out var mind) && mind.Session != null)
|
||||
{
|
||||
if (!CanPlayerBeBorgged(mind.Session))
|
||||
{
|
||||
@@ -127,9 +127,9 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
{
|
||||
base.OnInserted(uid, component, args);
|
||||
|
||||
if (HasComp<BorgBrainComponent>(args.Entity) && _mind.TryGetMind(args.Entity, out var mind))
|
||||
if (HasComp<BorgBrainComponent>(args.Entity) && _mind.TryGetMind(args.Entity, out var mindId, out var mind))
|
||||
{
|
||||
_mind.TransferTo(mind, uid);
|
||||
_mind.TransferTo(mindId, uid, mind: mind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -137,9 +137,10 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
{
|
||||
base.OnRemoved(uid, component, args);
|
||||
|
||||
if (HasComp<BorgBrainComponent>(args.Entity) && _mind.TryGetMind(uid, out var mind))
|
||||
if (HasComp<BorgBrainComponent>(args.Entity) &
|
||||
_mind.TryGetMind(uid, out var mindId, out var mind))
|
||||
{
|
||||
_mind.TransferTo(mind, args.Entity);
|
||||
_mind.TransferTo(mindId, args.Entity, mind: mind);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -171,7 +172,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
if (_powerCell.HasDrawCharge(uid, draw))
|
||||
{
|
||||
// only reenable the powerdraw if a player has the role.
|
||||
if (!draw.Drawing && _mind.TryGetMind(uid, out _))
|
||||
if (!draw.Drawing && _mind.TryGetMind(uid, out _, out _))
|
||||
_powerCell.SetPowerCellDrawEnabled(uid, true);
|
||||
|
||||
EnableBorgAbilities(uid, component);
|
||||
@@ -209,7 +210,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
container.ID != chassisComponent.BrainContainerId)
|
||||
return;
|
||||
|
||||
if (!_mind.TryGetMind(uid, out var mind) || mind.Session == null)
|
||||
if (!_mind.TryGetMind(uid, out var mindId, out var mind) || mind.Session == null)
|
||||
return;
|
||||
|
||||
if (!CanPlayerBeBorgged(mind.Session))
|
||||
@@ -220,7 +221,7 @@ public sealed partial class BorgSystem : SharedBorgSystem
|
||||
return;
|
||||
}
|
||||
|
||||
_mind.TransferTo(mind, containerEnt);
|
||||
_mind.TransferTo(mindId, containerEnt, mind: mind);
|
||||
}
|
||||
|
||||
private void UpdateBatteryAlert(EntityUid uid, PowerCellSlotComponent? slotComponent = null)
|
||||
|
||||
Reference in New Issue
Block a user