Maybe fix hand test failures (#21157)
This commit is contained in:
@@ -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));
|
var sorted = addedHands.OrderBy(hand => component.SortedHands.IndexOf(hand.Name));
|
||||||
|
|
||||||
foreach (var hand in sorted)
|
foreach (var hand in sorted)
|
||||||
|
|||||||
@@ -97,8 +97,9 @@ public sealed class HandsComponentState : ComponentState
|
|||||||
|
|
||||||
public HandsComponentState(HandsComponent handComp)
|
public HandsComponentState(HandsComponent handComp)
|
||||||
{
|
{
|
||||||
|
// cloning lists because of test networking.
|
||||||
Hands = new(handComp.Hands.Values);
|
Hands = new(handComp.Hands.Values);
|
||||||
HandNames = handComp.SortedHands;
|
HandNames = new(handComp.SortedHands);
|
||||||
ActiveHand = handComp.ActiveHand?.Name;
|
ActiveHand = handComp.ActiveHand?.Name;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -69,9 +69,9 @@ public abstract partial class SharedHandsSystem
|
|||||||
if (!handsComp.Hands.Remove(handName, out var hand))
|
if (!handsComp.Hands.Remove(handName, out var hand))
|
||||||
return;
|
return;
|
||||||
|
|
||||||
|
handsComp.SortedHands.Remove(hand.Name);
|
||||||
TryDrop(uid, hand, null, false, true, handsComp);
|
TryDrop(uid, hand, null, false, true, handsComp);
|
||||||
hand.Container?.Shutdown();
|
hand.Container?.Shutdown();
|
||||||
handsComp.SortedHands.Remove(hand.Name);
|
|
||||||
|
|
||||||
if (handsComp.ActiveHand == hand)
|
if (handsComp.ActiveHand == hand)
|
||||||
TrySetActiveHand(uid, handsComp.SortedHands.FirstOrDefault(), handsComp);
|
TrySetActiveHand(uid, handsComp.SortedHands.FirstOrDefault(), handsComp);
|
||||||
|
|||||||
Reference in New Issue
Block a user