示例#1
0
        public override IEnumerable <FloatMenuOption> CompFloatMenuOptions(Pawn selPawn)
        {
            string       text4 = "Reload".Translate(this.parent.Named("GEAR"), this.AmmoDef.Named("AMMO")) + " (" + this.LabelRemaining + ")";
            List <Thing> chosenAmmo;

            if (!selPawn.CanReach(Operator, PathEndMode.ClosestTouch, Danger.Deadly, false, TraverseMode.ByPawn))
            {
                yield return(new FloatMenuOption(text4 + ": " + "NoPath".Translate().CapitalizeFirst(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            else if (!this.NeedsReload(true))
            {
                yield return(new FloatMenuOption(text4 + ": " + "ReloadFull".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            else if ((chosenAmmo = CompTurretReloadableUtility.FindEnoughAmmo(selPawn, Operator.Position, this, true)) == null)
            {
                yield return(new FloatMenuOption(text4 + ": " + "ReloadNotEnough".Translate(), null, MenuOptionPriority.Default, null, null, 0f, null, null));
            }
            else
            {
                Action action4 = delegate()
                {
                    selPawn.jobs.TryTakeOrderedJob(JobGiver_ReloadCompTurret.MakeReloadJob(this, chosenAmmo), JobTag.Misc);
                };
                yield return(FloatMenuUtility.DecoratePrioritizedTask(new FloatMenuOption(text4, action4, MenuOptionPriority.Default, null, null, 0f, null, null), selPawn, Operator, "ReservedBy"));
            }
            foreach (var item in base.CompFloatMenuOptions(selPawn))
            {
                yield return(item);
            }
        }
示例#2
0
 // Token: 0x0600313B RID: 12603 RVA: 0x00114110 File Offset: 0x00112310
 protected override Job TryGiveJob(Pawn pawn)
 {
     foreach (CompTurretGun compReloadable in CompTurretReloadableUtility.FindSomeReloadableComponents(pawn, false))
     {
         if (compReloadable == null)
         {
             continue;
         }
         List <Thing> list = CompTurretReloadableUtility.FindEnoughAmmo(pawn, pawn.Position, compReloadable, false);
         if (list == null)
         {
             continue;
         }
         return(JobGiver_ReloadCompTurret.MakeReloadJob(compReloadable, list));
     }
     return(null);
 }