From 9212f261eac13e8c6393b49bd1d67df2c4d95846 Mon Sep 17 00:00:00 2001 From: ScarKy0 <106310278+ScarKy0@users.noreply.github.com> Date: Wed, 24 Dec 2025 07:34:10 +0100 Subject: [PATCH] [HOTFIX] Fix MMI mind transfer (#41941) --- .../Borgs/Components/MMILinkedComponent.cs | 18 ----------- .../Silicons/Borgs/SharedBorgSystem.MMI.cs | 31 +++++-------------- 2 files changed, 7 insertions(+), 42 deletions(-) delete mode 100644 Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs diff --git a/Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs b/Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs deleted file mode 100644 index cebbc9b746..0000000000 --- a/Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs +++ /dev/null @@ -1,18 +0,0 @@ -using Robust.Shared.GameStates; - -namespace Content.Shared.Silicons.Borgs.Components; - -/// -/// This is used for an entity that is linked to an MMI, usually a brain. -/// Mostly for receiving events. -/// -[RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem))] -[AutoGenerateComponentState] -public sealed partial class MMILinkedComponent : Component -{ - /// - /// The MMI this entity is linked to. - /// - [DataField, AutoNetworkedField] - public EntityUid? LinkedMMI; -} diff --git a/Content.Shared/Silicons/Borgs/SharedBorgSystem.MMI.cs b/Content.Shared/Silicons/Borgs/SharedBorgSystem.MMI.cs index efcd5a378c..3d33c6af4e 100644 --- a/Content.Shared/Silicons/Borgs/SharedBorgSystem.MMI.cs +++ b/Content.Shared/Silicons/Borgs/SharedBorgSystem.MMI.cs @@ -17,8 +17,7 @@ public abstract partial class SharedBorgSystem SubscribeLocalEvent(OnMMIMindAdded); SubscribeLocalEvent(OnMMIMindRemoved); - SubscribeLocalEvent(OnMMILinkedMindAdded); - SubscribeLocalEvent(OnMMILinkedRemoved); + SubscribeLocalEvent(OnMMILinkedRemoved); } private void OnMMIInit(Entity ent, ref ComponentInit args) @@ -35,9 +34,6 @@ public abstract partial class SharedBorgSystem return; var brain = args.Entity; - var linked = EnsureComp(brain); - linked.LinkedMMI = ent.Owner; - Dirty(brain, linked); if (_mind.TryGetMind(brain, out var mindId, out var mindComp)) { @@ -60,35 +56,22 @@ public abstract partial class SharedBorgSystem _appearance.SetData(ent.Owner, MMIVisuals.HasMind, false); } - private void OnMMILinkedMindAdded(Entity ent, ref MindAddedMessage args) - { - if (ent.Comp.LinkedMMI == null || !_mind.TryGetMind(ent.Owner, out var mindId, out var mindComp)) - return; - - _mind.TransferTo(mindId, ent.Comp.LinkedMMI, true, mind: mindComp); - } - - private void OnMMILinkedRemoved(Entity ent, ref EntGotRemovedFromContainerMessage args) + private void OnMMILinkedRemoved(Entity ent, ref EntRemovedFromContainerMessage args) { if (_timing.ApplyingState) return; // The changes are already networked with the same game state - if (Terminating(ent.Owner)) - return; - - if (ent.Comp.LinkedMMI is not { } linked) + if (args.Container.ID != ent.Comp.BrainSlotId) return; - RemCompDeferred(ent.Owner); - - if (_mind.TryGetMind(linked, out var mindId, out var mindComp)) + if (_mind.TryGetMind(ent, out var mindId, out var mindComp)) { + _mind.TransferTo(mindId, args.Entity, true, mind: mindComp); + if (_roles.MindHasRole(mindId)) _roles.MindRemoveRole(mindId); - - _mind.TransferTo(mindId, ent.Owner, true, mind: mindComp); } - _appearance.SetData(linked, MMIVisuals.BrainPresent, false); + _appearance.SetData(ent, MMIVisuals.BrainPresent, false); } } -- 2.52.0