]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
[HOTFIX] Fix MMI mind transfer (#41941)
authorScarKy0 <106310278+ScarKy0@users.noreply.github.com>
Wed, 24 Dec 2025 06:34:10 +0000 (07:34 +0100)
committerGitHub <noreply@github.com>
Wed, 24 Dec 2025 06:34:10 +0000 (22:34 -0800)
Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs [deleted file]
Content.Shared/Silicons/Borgs/SharedBorgSystem.MMI.cs

diff --git a/Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs b/Content.Shared/Silicons/Borgs/Components/MMILinkedComponent.cs
deleted file mode 100644 (file)
index cebbc9b..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-using Robust.Shared.GameStates;
-
-namespace Content.Shared.Silicons.Borgs.Components;
-
-/// <summary>
-/// This is used for an entity that is linked to an MMI, usually a brain.
-/// Mostly for receiving events.
-/// </summary>
-[RegisterComponent, NetworkedComponent, Access(typeof(SharedBorgSystem))]
-[AutoGenerateComponentState]
-public sealed partial class MMILinkedComponent : Component
-{
-    /// <summary>
-    /// The MMI this entity is linked to.
-    /// </summary>
-    [DataField, AutoNetworkedField]
-    public EntityUid? LinkedMMI;
-}
index efcd5a378c1d6168b13d07287232f5232d30d3ec..3d33c6af4e5c592e9537d9266a2e1e565a18883c 100644 (file)
@@ -17,8 +17,7 @@ public abstract partial class SharedBorgSystem
         SubscribeLocalEvent<MMIComponent, MindAddedMessage>(OnMMIMindAdded);
         SubscribeLocalEvent<MMIComponent, MindRemovedMessage>(OnMMIMindRemoved);
 
-        SubscribeLocalEvent<MMILinkedComponent, MindAddedMessage>(OnMMILinkedMindAdded);
-        SubscribeLocalEvent<MMILinkedComponent, EntGotRemovedFromContainerMessage>(OnMMILinkedRemoved);
+        SubscribeLocalEvent<MMIComponent, EntRemovedFromContainerMessage>(OnMMILinkedRemoved);
     }
 
     private void OnMMIInit(Entity<MMIComponent> ent, ref ComponentInit args)
@@ -35,9 +34,6 @@ public abstract partial class SharedBorgSystem
             return;
 
         var brain = args.Entity;
-        var linked = EnsureComp<MMILinkedComponent>(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<MMILinkedComponent> 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<MMILinkedComponent> ent, ref EntGotRemovedFromContainerMessage args)
+    private void OnMMILinkedRemoved(Entity<MMIComponent> 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<MMILinkedComponent>(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<SiliconBrainRoleComponent>(mindId))
                 _roles.MindRemoveRole<SiliconBrainRoleComponent>(mindId);
-
-            _mind.TransferTo(mindId, ent.Owner, true, mind: mindComp);
         }
 
-        _appearance.SetData(linked, MMIVisuals.BrainPresent, false);
+        _appearance.SetData(ent, MMIVisuals.BrainPresent, false);
     }
 }