Пример #1
0
    /// <summary>
    ///     Attempts to move a held item from a hand into a container that is not another hand, without dropping it on the floor in-between.
    /// </summary>
    public bool TryDropIntoContainer(EntityUid uid, EntityUid entity, BaseContainer targetContainer, bool checkActionBlocker = true, SharedHandsComponent?handsComp = null)
    {
        if (!Resolve(uid, ref handsComp))
        {
            return(false);
        }

        if (!IsHolding(uid, entity, out var hand, handsComp))
        {
            return(false);
        }

        if (!CanDropHeld(uid, hand, checkActionBlocker))
        {
            return(false);
        }

        if (!targetContainer.CanInsert(entity, EntityManager))
        {
            return(false);
        }

        DoDrop(uid, hand, false, handsComp);
        targetContainer.Insert(entity);
        return(true);
    }