private void OnHandInteract(EntityUid uid, SharedItemComponent component, InteractHandEvent args)
        {
            if (args.Handled || !component.CanPickup)
            {
                return;
            }

            args.Handled = _handsSystem.TryPickup(args.User, uid, animateUser: false);
        }
Пример #2
0
        private void OnHandleState(EntityUid uid, SharedItemComponent component, ref ComponentHandleState args)
        {
            if (args.Current is not ItemComponentState state)
            {
                return;
            }

            component.Size           = state.Size;
            component.EquippedPrefix = state.EquippedPrefix;
        }
Пример #3
0
        private void OnHandInteract(EntityUid uid, SharedItemComponent component, InteractHandEvent args)
        {
            if (args.Handled)
            {
                return;
            }

            if (!TryComp(args.User, out SharedHandsComponent? hands))
            {
                return;
            }

            if (hands.ActiveHand == null)
            {
                return;
            }

            args.Handled = hands.TryPickupEntity(hands.ActiveHand, uid, false, animateUser: false);
        }
Пример #4
0
        private void AddPickupVerb(EntityUid uid, SharedItemComponent component, GetVerbsEvent <InteractionVerb> args)
        {
            if (args.Hands == null ||
                args.Using != null ||
                !args.CanAccess ||
                !args.CanInteract ||
                !args.Hands.CanPickupEntityToActiveHand(args.Target))
            {
                return;
            }

            InteractionVerb verb = new();

            verb.Act         = () => args.Hands.TryPickupEntityToActiveHand(args.Target);
            verb.IconTexture = "/Textures/Interface/VerbIcons/pickup.svg.192dpi.png";

            // if the item already in a container (that is not the same as the user's), then change the text.
            // this occurs when the item is in their inventory or in an open backpack
            args.User.TryGetContainer(out var userContainer);
            if (args.Target.TryGetContainer(out var container) && container != userContainer)
            {
                verb.Text = Loc.GetString("pick-up-verb-get-data-text-inventory");
            }
Пример #5
0
 private void OnGetState(EntityUid uid, SharedItemComponent component, ref ComponentGetState args)
 {
     args.State = new ItemComponentState(component.Size, component.EquippedPrefix);
 }