Ejemplo n.º 1
0
        //===============================================================================\\

        public override void TickRare()
        {
            base.TickRare();

            List <Apparel> apparel = new List <Apparel>();
            List <Thing>   weapons = new List <Thing>();

            if (_nano.CmpPowerTrader.PowerOn && _nano.CmpRefuelable.HasFuel)
            {
                foreach (Pawn occupant in new List <Pawn>(this.CurOccupants).Where(x => x != null))
                {
                    if (occupant.apparel != null && occupant.apparel.WornApparel != null)
                    {
                        apparel.AddRange(new List <Apparel>(occupant.apparel.WornApparel).Where(x => x != null && x.def != null));
                    }

                    if (NanoRepair.IsWeaponResearchComplete())
                    {
                        if (occupant.equipment != null && occupant.equipment.GetDirectlyHeldThings() != null)
                        {
                            weapons.AddRange(new List <Thing>(occupant.equipment.GetDirectlyHeldThings()).Where(x =>
                            {
                                return((x != null) &&
                                       (x.def != null) &&
                                       (x.def.IsRangedWeapon || x.def.IsMeleeWeapon));
                            }));
                        }
                    }
                }
            }

            _nano.ProcessTick(apparel, weapons, this);
        }
Ejemplo n.º 2
0
        //===============================================================================\\

        public override void TickRare()
        {
            base.TickRare();

            List <Apparel> apparel = new List <Apparel>();
            List <Thing>   weapons = new List <Thing>();

            if (_nano.CmpPowerTrader.PowerOn && _nano.CmpRefuelable.HasFuel)
            {
                SlotGroup group = base.GetSlotGroup();
                if (group != null && group.HeldThings != null)
                {
                    bool weaponsComplete = NanoRepair.IsWeaponResearchComplete();
                    foreach (Thing thing in group.HeldThings)
                    {
                        if (thing.def != null && thing.def.stackLimit == 1 && !thing.def.Minifiable)
                        {
                            if (thing.def.IsApparel)
                            {
                                apparel.Add((Apparel)thing);
                            }
                            else if (weaponsComplete && (thing.def.IsMeleeWeapon || thing.def.IsRangedWeapon))
                            {
                                weapons.Add(thing);
                            }
                        }
                    }
                }
            }

            _nano.ProcessTick(apparel, weapons, this);
        }