Esempio n. 1
0
        /// <summary>
        /// Use item in the inventory, if its useable
        /// </summary>
        /// <param name="resultSet">Result</param>
        /// <param name="item">Item to use</param>
        /// <param name="useParams">Usage parameters</param>
        public void UseItem(ResultSet resultSet, EntityID item, Item.UseParams useParams)
        {
            var itemComp = item.e.item;

            // Not an item
            if (itemComp == null)
            {
                return;
            }

            var targetingReady = useParams.bool1;

            if (itemComp.targeting && !targetingReady && item.e.equippable == null)
            {
                resultSet.AddTargeting(item);
            }
            else
            {
                if (itemComp.useFunction == ItemFunction.NONE)
                {
                    if (item.e.equippable != null)
                    {
                        resultSet.AddEquip(owner, item);
                    }
                    else
                    {
                        resultSet.AddMessage(C.FSTR.Set("The ").Append(C.STR_COLOR_NAME).Append(item.e.name).Append("@- cannot be used"));
                    }
                }
                else
                {
                    itemComp.Use(resultSet, owner, useParams);
                }
            }
        }