Exemplo n.º 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, 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 = OgsOld_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_ReloadOgsOld_CompTurret.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);
            }
        }
Exemplo n.º 2
0
 // Token: 0x0600313B RID: 12603 RVA: 0x00114110 File Offset: 0x00112310
 public override Job TryGiveJob(Pawn pawn)
 {
     foreach (OgsOld_CompTurretGun compReloadable in OgsOld_CompTurretReloadableUtility.FindSomeReloadableComponents(pawn, false))
     {
         if (compReloadable == null)
         {
             continue;
         }
         List <Thing> list = OgsOld_CompTurretReloadableUtility.FindEnoughAmmo(pawn, pawn.Position, compReloadable, false);
         if (list == null)
         {
             continue;
         }
         return(JobGiver_ReloadOgsOld_CompTurret.MakeReloadJob(compReloadable, list));
     }
     return(null);
 }