protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); this.FailOn(() => !this.$this.Grave.Accepts(this.$this.Corpse)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, false, false)); yield return(Toils_Haul.CarryHauledThingToContainer()); Toil prepare = Toils_General.Wait(250); prepare.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f); yield return(prepare); yield return(new Toil { initAction = delegate { if (this.$this.pawn.carryTracker.CarriedThing == null) { Log.Error(this.$this.pawn + " tried to place hauled corpse in grave but is not hauling anything."); return; } if (this.$this.Grave.TryAcceptThing(this.$this.Corpse, true)) { this.$this.pawn.carryTracker.innerContainer.Remove(this.$this.Corpse); this.$this.Grave.Notify_CorpseBuried(this.$this.pawn); this.$this.pawn.records.Increment(RecordDefOf.CorpsesBuried); } } }); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(CarryThingIndex); this.FailOnDestroyedNullOrForbidden(DestIndex); this.FailOn(() => Printer.printerStatus != CrafterStatus.Filling); //Reserve yield return(Toils_Reserve.Reserve(CarryThingIndex, 1, -1, null)); yield return(Toils_Reserve.ReserveQueue(CarryThingIndex, 1, -1, null)); yield return(Toils_Reserve.Reserve(DestIndex, 1, -1, null)); yield return(Toils_Reserve.ReserveQueue(DestIndex, 1, -1, null)); //Get to Haul target toil. Toil getToHaulTarget = Toils_Goto.GotoThing(CarryThingIndex, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(CarryThingIndex); yield return(getToHaulTarget); yield return(Toils_Construct.UninstallIfMinifiable(CarryThingIndex).FailOnSomeonePhysicallyInteracting(CarryThingIndex)); yield return(Toils_Haul.StartCarryThing(CarryThingIndex, false, true)); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, CarryThingIndex)); //Carry to haul Container toil. Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer(); yield return(carryToContainer); }
protected override IEnumerable <Toil> MakeNewToils() { var lockThing = TargetThingA as ThingWithComps; var door = TargetThingB as ThingWithComps; if (!door.HasDoorLock(out var doorLock) || !lockThing.IsLock(out var lockComp)) { JobFailReason.Is($"Invalid lock [{lockThing}] and/or door [{door}]"); yield break; } var des = pawn.Map.designationManager; yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); var carry = Toils_Haul.StartCarryThing(TargetIndex.A); carry.AddPreInitAction(delegate { des.TryRemoveDesignationOn(lockThing, DesignationDefOf.InstallDoorLock); }); yield return(carry); yield return(Toils_Haul.CarryHauledThingToContainer()); yield return(Toils_General.WaitWith(TargetIndex.A, 1000, true)); yield return(Toils_General.Do(delegate { doorLock.InstallLock(lockComp); des.TryRemoveDesignationOn(door, DesignationDefOf.UninstallDoorLock); })); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDespawnedOrNull(TargetIndex.B); yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, 1, null)); yield return(Toils_Reserve.ReserveQueue(TargetIndex.A, 1, 1, null)); //yield return Toils_Reserve.Reserve(TargetIndex.B, 10, 1, null); //yield return Toils_Reserve.ReserveQueue(TargetIndex.B, 10, 1, null); Toil toil = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A); //toil.AddFailCondition(() => ShipFull(ship)); toil.tickAction += delegate { if (this.ShipFull(ship)) { this.EndJobWith(JobCondition.Incompletable); } }; yield return(toil); yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); Toil toilPickup = Toils_Haul.StartCarryThing(TargetIndex.A, false, true);//.FailOn(() => this.ShipFull(ship)); yield return(toilPickup); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(toil, TargetIndex.A)); Toil toil2 = Toils_Haul.CarryHauledThingToContainer(); toil2.tickAction += delegate { if (this.ShipFull(ship, false)) { this.EndJobWith(JobCondition.Incompletable); } }; yield return(toil2); yield return(Toils_Goto.MoveOffTargetBlueprint(TargetIndex.B)); yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B)); Toil toil3 = Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C); //toil3.AddFailCondition(() => this.ShipFull(ship)); yield return(toil3); yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(toil2, TargetIndex.C)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { //Clean up any spare blueprints AddFinishAction(delegate { Blueprint blueprint = TargetB.Thing as Blueprint; if (!blueprint?.Destroyed ?? false) { Log.Message($"Cleaning up {blueprint}"); blueprint.Destroy(DestroyMode.Vanish); } }); job.count = 1; Thing bedroll = pawn.CurJob.targetA.Thing; if (bedroll.Spawned) { Log.Message($"{pawn} needs to pick up {bedroll}"); yield return(Toils_Reserve.Reserve(TargetIndex.A)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch)); yield return(Toils_Haul.TakeToInventory(TargetIndex.A, 1)); } yield return(Toils_Misc.TakeItemFromInventoryToCarrier(pawn, TargetIndex.A)); yield return(Toils_Haul.CarryHauledThingToContainer()); yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C)); //yield return Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C);//1.0 game destroys minified thing, but its job still does Deposit? Toil restInBed = new Toil(); restInBed.initAction = delegate { Pawn pawn = restInBed.actor; Job curJob = pawn.jobs.curJob; Building_Bed bed = curJob.targetB.Thing as Building_Bed; pawn.Map.GetComponent <PlacedBedsMapComponent>().placedBeds[pawn] = bed; pawn.ownership?.ClaimBedIfNonMedical(bed); Job restJob = new Job(RimWorld.JobDefOf.LayDown, TargetB); pawn.jobs.StartJob(restJob, JobCondition.Succeeded); }; yield return(restInBed); }
// Token: 0x060002A9 RID: 681 RVA: 0x00018BA8 File Offset: 0x00016FA8 protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedNullOrForbidden(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); this.FailOn(() => !Storage.Accepts(Book)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch) .FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A)); yield return(Toils_Haul.CarryHauledThingToContainer()); var prepare = Toils_General.Wait(250); prepare.WithProgressBarToilDelay(TargetIndex.B); yield return(prepare); yield return(new Toil { initAction = delegate { if (pawn.carryTracker.CarriedThing == null) { Log.Error(pawn + " tried to place hauled corpse in grave but is not hauling anything."); return; } if (!Storage.Accepts(Book)) { return; } if (Book.holdingOwner != null) { Book.holdingOwner.TryTransferToContainer(Book, Storage.TryGetInnerInteractableThingOwner(), Book.stackCount); } else { Storage.TryGetInnerInteractableThingOwner().TryAdd(Book); } Storage.CompStorageGraphic.UpdateGraphics(); pawn.carryTracker.innerContainer.Remove(Book); pawn.records.Increment(RecordDefOf.CorpsesBuried); } }); }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); ShipBase ship = (ShipBase)TargetB; yield return(Toils_Reserve.Reserve(TargetIndex.A, 1)); yield return(Toils_Reserve.ReserveQueue(TargetIndex.A, 1)); yield return(Toils_Reserve.Reserve(TargetIndex.B, 10)); yield return(Toils_Reserve.ReserveQueue(TargetIndex.B, 10)); Toil toil = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A); yield return(toil); yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true)); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(toil, TargetIndex.A)); Toil toil2 = Toils_Haul.CarryHauledThingToContainer(); yield return(toil2); yield return(Toils_Goto.MoveOffTargetBlueprint(TargetIndex.B)); yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B)); Toil finalToil = Toils_Haul.DepositHauledThingInContainer(TargetIndex.B); finalToil.AddFinishAction(delegate { ship.compShip.SubtractFromToLoadList(TargetA.Thing); }); yield return(finalToil); yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(toil2)); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDespawnedOrNull(TargetIndex.B); Toil toil = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A); toil.AddFinishAction(delegate { Log.Message("Finished A"); }); //toil.AddFailCondition(() => ShipFull(ship)); toil.tickAction += delegate { if (this.ShipFull(ship)) { this.EndJobWith(JobCondition.Incompletable); } }; yield return(toil); yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); Toil toilPickup = Toils_Haul.StartCarryThing(TargetIndex.A, false, true);//.FailOn(() => this.ShipFull(ship)); yield return(toilPickup); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(toil, TargetIndex.A)); Toil toil2 = Toils_Haul.CarryHauledThingToContainer(); toil2.tickAction += delegate { if (this.ShipFull(ship, false)) { this.EndJobWith(JobCondition.Incompletable); } }; yield return(toil2); Toil toil3 = Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.None); //toil3.AddFailCondition(() => this.ShipFull(ship)); yield return(toil3); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { // This is mostly the same list of toils as HaulToContainer, except without reserving the container, // and also added some things from JobDriver_PrepareCaravan_GatherItems that handle coordination between // colonists. Many of the toils here seem to be intended for construction jobs and are thus probably not // necessary, but I'm leaving them in just in case. Possibly another mod will assume they're there, who knows. this.FailOnDestroyedOrNull(TargetIndex.A); this.FailOnDestroyedNullOrForbidden(TargetIndex.B); this.FailOn(() => TransporterUtility.WasLoadingCanceled(this.Transporter)); Toil reserve = Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null).FailOnDespawnedOrNull(TargetIndex.A); yield return(reserve); //yield return Toils_Reserve.ReserveQueue(TargetIndex.A, 1, -1, null); Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A); yield return(getToHaulTarget); yield return(DetermineNumToHaul()); yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A)); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true)); yield return(AddCarriedThingToTransferables()); yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None, true, (Thing x) => Transferable.things.Contains(x))); yield return(Toils_Haul.JumpIfAlsoCollectingNextTargetInQueue(getToHaulTarget, TargetIndex.A)); Toil carryToContainer = Toils_Haul.CarryHauledThingToContainer(); yield return(carryToContainer); yield return(Toils_Goto.MoveOffTargetBlueprint(TargetIndex.B)); yield return(Toils_Construct.MakeSolidThingFromBlueprintIfNecessary(TargetIndex.B, TargetIndex.C)); yield return(Toils_Haul.DepositHauledThingInContainer(TargetIndex.B, TargetIndex.C)); yield return(Toils_Haul.JumpToCarryToNextContainerIfPossible(carryToContainer, TargetIndex.C)); }
protected override IEnumerable <Toil> MakeNewToils() { yield return(Toils_Reserve.Reserve(TargetIndex.B, ship.compShip.sProps.maxPassengers)); yield return(Toils_Haul.CarryHauledThingToContainer()); yield return(Toils_Goto.Goto(TargetIndex.B, PathEndMode.ClosestTouch)); Toil leaving = JobDriver_LeaveInShip.EnterShip(this.GetActor(), ship); leaving.AddFinishAction(delegate { if (ship.pilotPresent) { ship.PrepareForLaunchIn(1000); } }); yield return(leaving); yield break; }
protected override IEnumerable <Toil> MakeNewToils() { AddEndCondition(delegate { Thing thing = GetActor().jobs.curJob.GetTarget(TargetIndex.A).Thing; if (thing is Building && !thing.Spawned) { return(JobCondition.Incompletable); } return(JobCondition.Ongoing); }); this.FailOnBurningImmobile(TargetIndex.A); this.FailOn(delegate() { IBillGiver billGiver = job.GetTarget(TargetIndex.A).Thing as IBillGiver; if (billGiver != null) { if (job.bill.DeletedOrDereferenced) { return(true); } if (!billGiver.CurrentlyUsableForBills()) { return(true); } if (project == null) { Log.Warning("[HumanResources] " + pawn + " tried to document a null project."); TryMakePreToilReservations(true); return(true); } if (!techComp.homework.Contains(project)) { return(true); } } return(false); }); Toil gotoBillGiver = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell); yield return(new Toil { initAction = delegate() { if (job.targetQueueB != null && job.targetQueueB.Count == 1) { UnfinishedThing unfinishedThing = job.targetQueueB[0].Thing as UnfinishedThing; if (unfinishedThing != null) { unfinishedThing.BoundBill = (Bill_ProductionWithUft)job.bill; } } } }); yield return(Toils_Jump.JumpIf(gotoBillGiver, () => job.GetTargetQueue(TargetIndex.B).NullOrEmpty <LocalTargetInfo>())); Toil extract = Toils_JobTransforms.ExtractNextTargetFromQueue(TargetIndex.B, true); yield return(extract); Toil getToHaulTarget = Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B); yield return(getToHaulTarget); yield return(Toils_Haul.StartCarryThing(TargetIndex.B, true, false, true)); yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.InteractionCell).FailOnDestroyedOrNull(TargetIndex.B)); Toil findPlaceTarget = Toils_JobTransforms.SetTargetToIngredientPlaceCell(TargetIndex.A, TargetIndex.B, TargetIndex.C); yield return(findPlaceTarget); yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, findPlaceTarget, false, false)); yield return(Toils_Jump.JumpIfHaveTargetInQueue(TargetIndex.B, extract)); extract = null; getToHaulTarget = null; findPlaceTarget = null; yield return(gotoBillGiver); yield return(MakeUnfinishedThingIfNeeded()); yield return(Toils_Recipe.DoRecipeWork().FailOnDespawnedNullOrForbiddenPlacedThings().FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell)); yield return(FinishRecipeAndStartStoringProduct()); if (!job.RecipeDef.products.NullOrEmpty <ThingDefCountClass>() || !job.RecipeDef.specialProducts.NullOrEmpty <SpecialProductType>()) { yield return(Toils_Reserve.Reserve(TargetIndex.B)); //yield return Toils_Reserve.Reserve(TargetIndex.A); yield return(Toils_Haul.StartCarryThing(TargetIndex.A, false, true, false)); findPlaceTarget = Toils_Haul.CarryHauledThingToContainer(); yield return(findPlaceTarget); Toil prepare = Toils_General.Wait(250); prepare.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f); yield return(prepare); yield return(new Toil { initAction = delegate { Building_BookStore shelf = (Building_BookStore)job.GetTarget(TargetIndex.B).Thing; CurToil.FailOn(() => shelf == null); Thing book = pawn.carryTracker.CarriedThing; if (pawn.carryTracker.CarriedThing == null) { Log.Error(pawn + " tried to place a book on shelf but is not hauling anything."); return; } if (shelf.Accepts(book)) { bool flag = false; if (book.holdingOwner != null) { book.holdingOwner.TryTransferToContainer(book, shelf.TryGetInnerInteractableThingOwner(), book.stackCount, true); flag = true; } else { flag = shelf.TryGetInnerInteractableThingOwner().TryAdd(book, true); } pawn.carryTracker.innerContainer.Remove(book); } else { Log.Error(pawn + " tried to place a book in " + shelf + ", but won't accept it."); return; } pawn.jobs.EndCurrentJob(JobCondition.Succeeded, true, true); } }); } yield break; }