/// <summary> /// Update the In-Hand sprites /// </summary> public virtual void UpdateHandVisuals(EntityUid uid, SharedHandsComponent?handComp = null, AppearanceComponent?appearance = null) { if (!Resolve(uid, ref handComp, ref appearance, false)) { return; } var handsVisuals = new List <HandVisualState>(); foreach (var hand in handComp.Hands) { if (hand.HeldEntity == null) { continue; } if (!TryComp(hand.HeldEntity.Value, out SharedItemComponent? item) || item.RsiPath == null) { continue; } var handState = new HandVisualState(item.RsiPath, item.EquippedPrefix, hand.Location, item.Color); handsVisuals.Add(handState); } appearance.SetData(HandsVisuals.VisualState, new HandsVisualState(handsVisuals)); }
private HandsVisualState GetHandsVisualState() { var hands = new List <HandVisualState>(); foreach (var hand in ReadOnlyHands) { if (hand.HeldEntity == null) { continue; } if (!hand.HeldEntity.TryGetComponent(out SharedItemComponent? item) || item.RsiPath == null) { continue; } var handState = new HandVisualState(item.RsiPath, item.EquippedPrefix, hand.Location, item.Color); hands.Add(handState); } return(new(hands)); }