Пример #1
0
        public static List <ChargeableItem> GetChargeables(this EntityInventoryItems inventory)
        {
            var list = new List <ChargeableItem>();

            for (var i = 0; i < inventory.Slots.Length; i++)
            {
                var stack = inventory.GetItemStack(i);

                if (!stack.IsNull())
                {
                    if (stack.Item != Item.NullItem)
                    {
                        var item = stack.SingularItem();

                        if (item is ChargeableItem chargeable)
                        {
                            if (chargeable is BatteryItem == false && chargeable is CapacitorItem == false)
                            {
                                list.Add(chargeable);
                            }
                        }
                    }
                }
            }

            return(list);
        }
Пример #2
0
        public static List <BatteryItem> GetBatteries(this EntityInventoryItems inventory)
        {
            var list = new List <BatteryItem>();

            for (var i = 0; i < inventory.Slots.Length; i++)
            {
                var stack = inventory.GetItemStack(i);

                if (!stack.IsNull())
                {
                    if (stack.Item != Item.NullItem)
                    {
                        var item = stack.SingularItem();

                        if (item is BatteryItem battery)
                        {
                            list.Add(battery);
                        }
                    }
                }
            }

            return(list);
        }