Пример #1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //this.EndOnDespawnedOrNull(TargetIndex.A, JobCondition.Incompletable);

            var reserve = Toils_Reserve.Reserve(TargetIndex.A, 25, Info.feePerColonist);

            yield return(reserve);

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            yield return(this.DetermineNumToHaul());

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true));

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None));


            var findTicketTaker = FindTicketTaker();

            yield return(findTicketTaker);

            //yield return Toils_Reserve.Reserve(TargetIndex.B);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)
                         .JumpIf(() => !JobDriver_PrepareCaravan_GatherItems.IsUsableCarrier(TicketTaker, this.pawn, false), findTicketTaker));

            yield return(GiveSilver());

            yield return(Notify_ColonistPayedEntry());
        }
Пример #2
0
 public static bool TransferablesVehicle(JobDriver_PrepareCaravan_GatherItems __instance, ref List <TransferableOneWay> __result)
 {
     if (__instance.job.lord.LordJob is LordJob_FormAndSendVehicles)
     {
         __result = ((LordJob_FormAndSendVehicles)__instance.job.lord.LordJob).transferables;
         return(false);
     }
     return(true);
 }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(delegate
            {
                return(DestType == HaulLocation.None ||
                       !Info.ShouldHaulTrash ||
                       Info.currentLord != pawn.GetLord() ||
                       !Info.AnyCarriersCanCarry(this.ThingToHaul));
            });

            Toil reserve = Toils_Reserve.Reserve(TargetIndex.A);

            yield return(reserve); // reserve if not already reserved by this pawn

            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            yield return(this.DetermineNumToHaul());

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true));

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None, false, t => Info.thingsToHaul.Contains(t)));

            if (DestType == HaulLocation.ToCarriers)
            {
                Toil findCarrier = FindCarrier();

                yield return(findCarrier);

                //yield return Toils_Reserve.Reserve(TargetIndex.B);

                yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch)
                             .JumpIf(() => !JobDriver_PrepareCaravan_GatherItems.IsUsableCarrier(this.Carrier, this.pawn, false), findCarrier));

                yield return(Toils_General.Wait(PlaceInInventoryDuration).WithProgressBarToilDelay(TargetIndex.B, false, -0.5f));

                yield return(PlaceTargetInCarrierInventory());
            }
            else if (DestType == HaulLocation.ToTrash || DestType == HaulLocation.ToColony)
            {
                Toil findTrashSpot = FindTrashSpot();

                yield return(findTrashSpot);

                yield return(Toils_Reserve.Reserve(TargetIndex.B));

                yield return(Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.Touch));

                yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.B, findTrashSpot, false));
            }

            yield return(RemoveThingToHaulFromInfo());
        }