// Token: 0x0600567B RID: 22139 RVA: 0x001CE8D0 File Offset: 0x001CCAD0
        public static bool CanUseConsideringQueuedJobs(Pawn pawn, ThingWithComps gear, bool showMessage = true)
        {
            OgsOld_CompTurret compReloadable = gear.TryGetCompFast <OgsOld_CompTurret>();

            if (compReloadable == null)
            {
                return(true);
            }
            string text = null;

            if (!Event.current.shift)
            {
                if (!compReloadable.CanBeUsed)
                {
                    text = compReloadable.DisabledReason(compReloadable.MinAmmoNeeded(false), compReloadable.MaxAmmoNeeded(false));
                }
            }
            else if (OgsOld_CompTurretReloadableUtility.TotalChargesFromQueuedJobs(pawn, gear) + 1 > compReloadable.RemainingCharges)
            {
                text = compReloadable.DisabledReason(compReloadable.MaxAmmoAmount(), compReloadable.MaxAmmoAmount());
            }
            if (text != null)
            {
                if (showMessage)
                {
                    Messages.Message(text, pawn, MessageTypeDefOf.RejectInput, false);
                }
                return(false);
            }
            return(true);
        }
        // Token: 0x06005677 RID: 22135 RVA: 0x001CE7CC File Offset: 0x001CC9CC
        public static List <Thing> FindEnoughAmmo(Pawn pawn, IntVec3 rootCell, OgsOld_CompTurret comp, bool forceReload)
        {
            if (comp == null)
            {
                return(null);
            }
            IntRange desiredQuantity = new IntRange(comp.MinAmmoNeeded(forceReload), comp.MaxAmmoNeeded(forceReload));

            return(RefuelWorkGiverUtility.FindEnoughReservableThings(pawn, rootCell, desiredQuantity, (Thing t) => t.def == comp.AmmoDef));
        }
        // Token: 0x06005679 RID: 22137 RVA: 0x001CE83C File Offset: 0x001CCA3C
        public static Pawn WearerOf(OgsOld_CompTurret comp)
        {
            Pawn_ApparelTracker pawn_ApparelTracker = comp.ParentHolder as Pawn_ApparelTracker;

            if (pawn_ApparelTracker != null)
            {
                return(pawn_ApparelTracker.pawn);
            }
            return(null);
        }
        // Token: 0x0600567A RID: 22138 RVA: 0x001CE860 File Offset: 0x001CCA60
        public static int TotalChargesFromQueuedJobs(Pawn pawn, ThingWithComps gear)
        {
            OgsOld_CompTurret compReloadable = gear.TryGetCompFast <OgsOld_CompTurret>();
            int num = 0;

            if (compReloadable != null && pawn != null)
            {
                foreach (Job job in pawn.jobs.AllJobs())
                {
                    Verb_ShootCompMounted verbToUse = job.verbToUse as Verb_ShootCompMounted;
                    if (verbToUse != null && compReloadable == verbToUse.ReloadableCompSource)
                    {
                        num++;
                    }
                }
            }
            return(num);
        }
        public static IEnumerable <OgsOld_CompTurret> FindSomeReloadableComponents(Pawn pawn, bool allowForcedReload)
        {
            if (pawn.apparel == null)
            {
                yield break;
            }
            List <Apparel> wornApparel = pawn.apparel.WornApparel;

            for (int i = 0; i < wornApparel.Count; i++)
            {
                for (int i2 = 0; i2 < wornApparel[i].AllComps.Count; i2++)
                {
                    OgsOld_CompTurret compReloadable = wornApparel[i].AllComps[i2] as OgsOld_CompTurret;
                    if (compReloadable != null && compReloadable.NeedsReload(allowForcedReload))
                    {
                        yield return(compReloadable);
                    }
                }
            }
        }
        private IEnumerable <Toil> ReloadAsMuchAsPossible(OgsOld_CompTurret comp)
        {
            Toil done = Toils_General.Label();

            yield return(Toils_Jump.JumpIf(done, () => pawn.carryTracker.CarriedThing == null || pawn.carryTracker.CarriedThing.stackCount < comp.MinAmmoNeeded(allowForcedReload: true)));

            yield return(Toils_General.Wait(comp.Props.baseReloadTicks).WithProgressBarToilDelay(TargetIndex.A));

            Toil toil = new Toil();

            toil.initAction = delegate
            {
                Thing carriedThing = pawn.carryTracker.CarriedThing;
                comp.ReloadFrom(carriedThing);
            };
            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil);

            yield return(done);
        }
        // Token: 0x06005678 RID: 22136 RVA: 0x001CE823 File Offset: 0x001CCA23
        public static IEnumerable <Pair <OgsOld_CompTurret, Thing> > FindPotentiallyReloadableGear(Pawn pawn, List <Thing> potentialAmmo)
        {
            if (pawn.apparel == null)
            {
                yield break;
            }
            List <Apparel> worn = pawn.apparel.WornApparel;
            int            num;

            for (int i = 0; i < worn.Count; i = num + 1)
            {
                OgsOld_CompTurret comp = worn[i].TryGetCompFast <OgsOld_CompTurret>();

                if (((comp != null) ? comp.AmmoDef : null) != null)
                {
                    for (int i2 = 0; i2 < worn[i].AllComps.Count; i2++)
                    {
                        OgsOld_CompTurret compReloadable = worn[i].AllComps[i2] as OgsOld_CompTurret;
                        if (((compReloadable != null) ? compReloadable.AmmoDef : null) != null)
                        {
                            for (int j = 0; j < potentialAmmo.Count; j = num + 1)
                            {
                                Thing thing = potentialAmmo[j];
                                if (thing.def == compReloadable.Props.ammoDef)
                                {
                                    yield return(new Pair <OgsOld_CompTurret, Thing>(compReloadable, thing));
                                }
                                num = j;
                            }
                        }
                    }
                }
                num = i;
            }
            yield break;
        }
 public Command_ToggleOgsOld_CompTurret(OgsOld_CompTurret comp)
 {
     this.comp = comp;
 }
 // Token: 0x06005671 RID: 22129 RVA: 0x001CE6CF File Offset: 0x001CC8CF
 public Command_OgsOld_CompTurretReloadable(OgsOld_CompTurret comp)
 {
     this.comp = comp;
 }
 public OgsOld_CompTurretTop(OgsOld_CompTurret ParentTurret)
 {
     this.parentTurret = ParentTurret;
 }