]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Maybe fix hand test failures (#21157)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 22 Oct 2023 05:55:10 +0000 (16:55 +1100)
committerGitHub <noreply@github.com>
Sun, 22 Oct 2023 05:55:10 +0000 (16:55 +1100)
Content.Client/Hands/Systems/HandsSystem.cs
Content.Shared/Hands/Components/HandsComponent.cs
Content.Shared/Hands/EntitySystems/SharedHandsSystem.cs

index f44bc1ec97985d4bdfa0bdee6bebaf57839a49cc..ed40589f7fd4eb7c430a4bc9b537adc3bce3ecbe 100644 (file)
@@ -95,7 +95,8 @@ namespace Content.Client.Hands.Systems
                     }
                 }
 
-                component.SortedHands = new(state.HandNames);
+                component.SortedHands.Clear();
+                component.SortedHands.AddRange(state.HandNames);
                 var sorted = addedHands.OrderBy(hand => component.SortedHands.IndexOf(hand.Name));
 
                 foreach (var hand in sorted)
index c1664289ce99d70d5fcfbd7a169e8f449dd797c8..0bece1d141ab528d1638bd83184d19e3a32e6c2f 100644 (file)
@@ -97,8 +97,9 @@ public sealed class HandsComponentState : ComponentState
 
     public HandsComponentState(HandsComponent handComp)
     {
+        // cloning lists because of test networking.
         Hands = new(handComp.Hands.Values);
-        HandNames = handComp.SortedHands;
+        HandNames = new(handComp.SortedHands);
         ActiveHand = handComp.ActiveHand?.Name;
     }
 }
index e1de636969b833573291befa7744317467465de0..6b786fdfaa83227db132b2715097460bd3aeedd3 100644 (file)
@@ -69,9 +69,9 @@ public abstract partial class SharedHandsSystem
         if (!handsComp.Hands.Remove(handName, out var hand))
             return;
 
+        handsComp.SortedHands.Remove(hand.Name);
         TryDrop(uid, hand, null, false, true, handsComp);
         hand.Container?.Shutdown();
-        handsComp.SortedHands.Remove(hand.Name);
 
         if (handsComp.ActiveHand == hand)
             TrySetActiveHand(uid, handsComp.SortedHands.FirstOrDefault(), handsComp);