Ejemplo n.º 1
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            // Set up fail conditions
            this.FailOn(delegate {
                return(Quarry == null || Quarry.IsForbidden(pawn) || Quarry.Depleted);
            });

            // Go to the quarry
            yield return(Toils_Goto.Goto(CellInd, PathEndMode.OnCell));

            // Mine at the quarry. This is only for the delay
            yield return(Mine());

            // Collect resources from the quarry
            yield return(Collect());

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

            // Reserve the storage cell
            yield return(Toils_Reserve.Reserve(TargetIndex.C));

            // Go to the resource
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch));

            // Pick up the resource
            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

            // Carry the resource to the storage cell, then place it down
            Toil carry = Toils_Haul.CarryHauledThingToCell(TargetIndex.C);

            yield return(carry);

            yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, carry, true));
        }
Ejemplo n.º 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            Toil reserveGenes = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveGenes, TargetIndex.B, TargetIndex.None, true, null));

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

            yield return(Toils_General.Wait(240).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate
                {
                    Building_NewGenePod building_genepod = (Building_NewGenePod)this.job.GetTarget(TargetIndex.A).Thing;
                    building_genepod.TryAcceptThing2(this.job.targetB.Thing, true);
                    building_genepod.PodHasGenes2 = true;
                    building_genepod.SignalInsertGenes2 = false;
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !base.Map.lordManager.lords.Contains(this.job.lord));
            Toil reserve = Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null).FailOnDespawnedOrNull(TargetIndex.A);

            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, false));

            yield return(this.AddCarriedThingToTransferables());

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None, true, (Thing x) => this.Transferable.things.Contains(x)));

            Toil findCarrier = this.FindCarrier();

            yield return(findCarrier);

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

            yield return(Toils_General.Wait(25, TargetIndex.None).JumpIf(() => !JobDriver_PrepareCaravan_GatherItems.IsUsableCarrier(this.Carrier, this.pawn, true), findCarrier).WithProgressBarToilDelay(TargetIndex.B, false, -0.5f));

            yield return(this.PlaceTargetInCarrierInventory());

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(BarrelInd);
            this.FailOnBurningImmobile(BarrelInd);
            AddEndCondition(() => Barrel.SpaceLeftForWort > 0 ? JobCondition.Ongoing : JobCondition.Succeeded);
            yield return(Toils_General.DoAtomic(delegate { job.count = Barrel.SpaceLeftForWort; }));

            var reserveWort = Toils_Reserve.Reserve(WortInd);

            yield return(reserveWort);

            yield return(Toils_Goto.GotoThing(WortInd, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(WortInd)
                         .FailOnSomeonePhysicallyInteracting(WortInd));

            yield return(Toils_Haul.StartCarryThing(WortInd, false, true).FailOnDestroyedNullOrForbidden(WortInd));

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveWort, WortInd, TargetIndex.None, true));

            yield return(Toils_Goto.GotoThing(BarrelInd, PathEndMode.Touch));

            yield return(Toils_General.Wait(Duration).FailOnDestroyedNullOrForbidden(WortInd)
                         .FailOnDestroyedNullOrForbidden(BarrelInd).FailOnCannotTouch(BarrelInd, PathEndMode.Touch)
                         .WithProgressBarToilDelay(BarrelInd));

            yield return(new Toil
            {
                initAction = delegate { Barrel.AddWort(Wort); },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
Ejemplo n.º 5
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            var wait = Toils_General.Wait(50, TargetIndex.A).FailOnNotDiningQueued(TargetIndex.A);

            //this.FailOnNotDining(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnForbidden(TargetIndex.B);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

            yield return(Toils_Waiting.UpdateOrderConsumableTo(TargetIndex.A, TargetIndex.B));

            yield return(Toils_Waiting.FindRandomAdjacentCell(TargetIndex.A, TargetIndex.C)); // A is the patron, C is the spot

            yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.C));

            yield return(wait);

            yield return(Toils_Jump.JumpIf(wait, () => pawn.jobs.curJob?.GetTarget(TargetIndex.A).Pawn?.GetDriver <JobDriver_Dine>() == null)); // Driver not available

            yield return(Toils_Waiting.GetDiningSpot(TargetIndex.A, TargetIndex.C));

            yield return(Toils_Haul.CarryHauledThingToCell(TargetIndex.C));

            yield return(Toils_Jump.JumpIf(wait, () => pawn.jobs.curJob?.GetTarget(TargetIndex.A).Pawn?.GetDriver <JobDriver_Dine>() == null)); // Driver not available

            yield return(Toils_Waiting.ClearOrder(TargetIndex.A, TargetIndex.B));

            yield return(Toils_Waiting.AnnounceServing(TargetIndex.A, TargetIndex.B));
        }
Ejemplo n.º 6
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(CorpseIndex);
            this.FailOnDestroyedOrNull(CryptosleepCasketIndex);
            this.FailOn(() => !CryptosleepCasket.Accepts(Corpse));
            yield return(Toils_Goto
                         .GotoThing(CorpseIndex, PathEndMode.OnCell)
                         .FailOnDestroyedNullOrForbidden(TargetIndex.A)
                         .FailOnDespawnedNullOrForbidden(TargetIndex.B)
                         .FailOn(() => CryptosleepCasket.HasAnyContents)
                         .FailOn(() => !pawn.CanReach(Corpse, PathEndMode.OnCell, Danger.Deadly))
                         .FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(CorpseIndex));

            yield return(Toils_Goto.GotoThing(CryptosleepCasketIndex, PathEndMode.InteractionCell));

            yield return(Toils_General
                         .Wait(500)
                         .FailOnCannotTouch(CryptosleepCasketIndex, PathEndMode.InteractionCell)
                         .WithProgressBarToilDelay(CryptosleepCasketIndex));

            yield return(new Toil
            {
                initAction = () => CryptosleepCasket.TryAcceptThing(Corpse),
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
        // Token: 0x06000028 RID: 40 RVA: 0x000030FC File Offset: 0x000020FC
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null));

            Toil toil = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(toil);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, false, false, false).FailOnDestroyedNullOrForbidden(TargetIndex.B));

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(toil, TargetIndex.B, TargetIndex.None, false, null));

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

            yield return(Toils_General.Wait(200, TargetIndex.None).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    this.Barrel.Addoil(this.sd_luciprod_mechanite_oil);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
Ejemplo n.º 8
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());
        }
Ejemplo n.º 9
0
        // Token: 0x06000373 RID: 883 RVA: 0x0001EF58 File Offset: 0x0001D358
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

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

            Toil gotoCell = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            gotoCell.AddPreTickAction(delegate
            {
                if (base.Map.exitMapGrid.IsExitCell(this.pawn.Position))
                {
                    this.pawn.ExitMap(true, CellRect.WholeMap(base.Map).GetClosestEdge(this.pawn.Position));
                }
            });
            yield return(gotoCell);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    IntVec3 position = this.position;
                    Thing thing;
                    this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Direct, out thing, null);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A));

            Toil toil = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            toil.AddPreTickAction(delegate
            {
                if (base.Map.exitMapGrid.IsExitCell(pawn.Position))
                {
                    pawn.ExitMap(allowedToJoinOrCreateCaravan: true, CellRect.WholeMap(base.Map).GetClosestEdge(pawn.Position));
                }
            });
            toil.FailOn(() => job.failIfCantJoinOrCreateCaravan && !CaravanExitMapUtility.CanExitMapAndJoinOrCreateCaravanNow(pawn));
            yield return(toil);

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                if (pawn.Position.OnEdge(pawn.Map) || pawn.Map.exitMapGrid.IsExitCell(pawn.Position))
                {
                    pawn.ExitMap(allowedToJoinOrCreateCaravan: true, CellRect.WholeMap(base.Map).GetClosestEdge(pawn.Position));
                }
            };
            toil2.FailOn(() => job.failIfCantJoinOrCreateCaravan && !CaravanExitMapUtility.CanExitMapAndJoinOrCreateCaravanNow(pawn));
            toil2.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(toil2);
        }
Ejemplo n.º 11
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            job.count = 1;
            this.FailOnIncapable(PawnCapacityDefOf.Manipulation);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A));

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

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


            Toil toil = Toils_General.Wait(100);

            toil.WithProgressBarToilDelay(TargetIndex.B);
            toil.FailOnDespawnedNullOrForbidden(TargetIndex.B);
            toil.FailOnCannotTouch(TargetIndex.B, PathEndMode.Touch);
            if (job.targetB.IsValid)
            {
                toil.FailOnDespawnedOrNull(TargetIndex.B);
            }
            yield return(toil);

            Toil use = new Toil();

            use.initAction = delegate
            {
                Pawn pawn = job.targetA.Pawn;
                this.Map.GetComponent <ArchotechExtractableAnimals_MapComponent>().RemoveAnimalToCarry(pawn);

                float ParagonOrHybridFactor = 0.5f;

                if (pawn.kindDef.GetModExtension <DefExtension_Hybrid>()?.dominantGenome == pawn.kindDef.GetModExtension <DefExtension_Hybrid>()?.secondaryGenome)
                {
                    ParagonOrHybridFactor = 1f;
                }


                float DNAExtractionFactor = pawn.TryGetComp <CompHybrid>()?.GetDNAExtractionFactor() ?? 0f;

                Building_DNAStorageBank building = (Building_DNAStorageBank)job.targetB.Thing;

                float totalProgress = building.progress + (DNAExtractionFactor * ParagonOrHybridFactor);

                if (totalProgress >= 1)
                {
                    building.progress = 1;
                }
                else
                {
                    building.progress += DNAExtractionFactor * ParagonOrHybridFactor;
                }


                pawn.Destroy();
            };
            use.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(use);

            yield break;
        }
Ejemplo n.º 12
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Log.Message("I am inside the job now, with "+pawn.ToString(), false);


            Toil reserveBees = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveBees, TargetIndex.B, TargetIndex.None, true, null));

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

            yield return(Toils_General.Wait(240).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate
                {
                    Building_Beehouse buildingbeehouse = (Building_Beehouse)this.job.GetTarget(TargetIndex.A).Thing;
                    //buildingbeehouse.queenThing = this.job.targetB.Thing;
                    buildingbeehouse.TryAcceptAnyQueen(this.job.targetB.Thing, true);
                    buildingbeehouse.BeehouseIsExpectingBees = false;

                    //this.job.targetB.Thing.Destroy();
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
Ejemplo n.º 13
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

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

            Toil toil = Toils_General.Wait(1000);

            toil.FailOnDespawnedOrNull(TargetIndex.A);
            toil.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            toil.WithEffect(Building.def.repairEffect, TargetIndex.A);
            toil.WithProgressBarToilDelay(TargetIndex.A);
            toil.activeSkill = () => SkillDefOf.Construction;
            yield return(toil);

            Toil toil2 = new Toil();

            toil2.initAction = delegate
            {
                Components.Destroy();
                if (Rand.Value > pawn.GetStatValue(StatDefOf.FixBrokenDownBuildingSuccessChance))
                {
                    MoteMaker.ThrowText((pawn.DrawPos + Building.DrawPos) / 2f, base.Map, "TextMote_FixBrokenDownBuildingFail".Translate(), 3.65f);
                }
                else
                {
                    Building.GetComp <CompBreakdownable>().Notify_Repaired();
                }
            };
            yield return(toil2);
        }
Ejemplo n.º 14
0
        /// <summary>
        /// Makes the new toils.
        /// </summary>
        /// <returns></returns>
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            yield return(Toils_General.DoAtomic(delegate { job.count = 1; }));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch)
                         .FailOnDespawnedNullOrForbidden(TargetIndex.B)
                         .FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

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

            yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, null, false));

            yield return(Toils_General.Wait(600)
                         .FailOnDestroyedNullOrForbidden(TargetIndex.B)
                         .FailOnDestroyedNullOrForbidden(TargetIndex.A)
                         .FailOnCannotTouch(TargetIndex.A, PathEndMode.InteractionCell)
                         .WithProgressBarToilDelay(TargetIndex.A));

            var toil = new Toil
            {
                initAction          = ApplyGenome,
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            yield return(toil);
        }
Ejemplo n.º 15
0
        public override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnAggroMentalState(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.OnCell).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => !this.pawn.CanReach(this.Takee, PathEndMode.OnCell, Danger.Deadly, false, false, TraverseMode.ByPawn)).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            Toil toil = new Toil();

            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            toil.initAction          = new Action(delegate {
                Takee.jobs.EndCurrentJob(JobCondition.InterruptForced);
                Takee.health.surgeryBills.Clear();
            });
            yield return(toil);

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

            yield return(Toils_Misc.FindRandomAdjacentReachableCell(TargetIndex.B, TargetIndex.C));

            yield return(Toils_Goto.GotoThing(TargetIndex.C, PathEndMode.OnCell));

            //yield return Toils_Haul.CarryHauledThingToCell(TargetIndex.A)
            yield return(new Toil
            {
                initAction = delegate
                {
                    this.pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Direct, out Thing thing, null);
                },
Ejemplo n.º 16
0
        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);
                    }
                }
            });
        }
Ejemplo n.º 17
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            //Commence fail checks!
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);

            yield return(Toils_Reserve.Reserve(ItemAIndex, 1));

            yield return(Toils_Reserve.Reserve(ItemBIndex, 1));

            yield return(Toils_Goto.GotoThing(ItemBIndex, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(ItemBIndex));

            yield return(Toils_Construct.UninstallIfMinifiable(ItemBIndex).FailOnSomeonePhysicallyInteracting(ItemBIndex));

            yield return(Toils_Haul.StartCarryThing(ItemBIndex, false, true));

            yield return(Toils_Goto.GotoThing(ItemAIndex, PathEndMode.Touch));

            Toil chantingTime = new Toil()
            {
                defaultCompleteMode = ToilCompleteMode.Delay,
                defaultDuration     = 1200
            };

            chantingTime.WithProgressBarToilDelay(ItemAIndex, false, -0.5f);
            yield return(chantingTime);

            yield return(new Toil
            {
                initAction = delegate
                {
                    IntVec3 position = this.Thing.Position;
                    this.pawn.carryTracker.TryDropCarriedThing(position, ThingPlaceMode.Near, out Thing thingB, null);
                    CombineItems(thingB, Thing);
                },
Ejemplo n.º 18
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            Toil gotoCorpse = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A);

            yield return(Toils_Jump.JumpIfTargetInvalid(TargetIndex.B, gotoCorpse));

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.InteractionCell).FailOnDespawnedOrNull(TargetIndex.B));

            yield return(Toils_General.Wait(300, TargetIndex.None).WithProgressBarToilDelay(TargetIndex.B, false, -0.5f).FailOnDespawnedOrNull(TargetIndex.B).FailOnCannotTouch(TargetIndex.B, PathEndMode.InteractionCell));

            yield return(Toils_General.Open(TargetIndex.B));

            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1, -1, null));

            yield return(gotoCorpse);

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

            yield return(this.FindCellToDropCorpseToil());

            yield return(Toils_Reserve.Reserve(TargetIndex.C, 1, -1, null));

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

            yield return(Toils_Haul.PlaceHauledThingInCell(TargetIndex.C, null, false));

            yield return(this.ForbidAndNotifyMentalStateToil());

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            AddEndCondition(() => (!RefuelableComp.IsFull) ? JobCondition.Ongoing : JobCondition.Succeeded);
            AddFailCondition(() => !job.playerForced && !RefuelableComp.ShouldAutoRefuelNowIgnoringFuelPct);
            AddFailCondition(() => !RefuelableComp.allowAutoRefuel && !job.playerForced);
            yield return(Toils_General.DoAtomic(delegate
            {
                job.count = RefuelableComp.GetFuelCountToFullyRefuel();
            }));

            Toil reserveFuel = Toils_Reserve.Reserve(TargetIndex.B);

            yield return(reserveFuel);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, putRemainderInQueue: false, subtractNumTakenFromJobCount: true).FailOnDestroyedNullOrForbidden(TargetIndex.B));

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveFuel, TargetIndex.B, TargetIndex.None, takeFromValidStorage: true));

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

            yield return(Toils_General.Wait(240).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A)
                         .FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch)
                         .WithProgressBarToilDelay(TargetIndex.A));

            yield return(Toils_Refuel.FinalizeRefueling(TargetIndex.A, TargetIndex.B));
        }
Ejemplo n.º 20
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            base.AddEndCondition(() => (!this.RefuelableComp.IsFull) ? JobCondition.Ongoing : JobCondition.Succeeded);
            base.AddFailCondition(() => !this.job.playerForced && !this.RefuelableComp.ShouldAutoRefuelNowIgnoringFuelPct);
            yield return(Toils_General.DoAtomic(delegate
            {
                this.job.count = this.RefuelableComp.GetFuelCountToFullyRefuel();
            }));

            Toil reserveFuel = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(reserveFuel);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveFuel, TargetIndex.B, TargetIndex.None, true, null));

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

            yield return(Toils_General.Wait(240, TargetIndex.None).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(Toils_Refuel.FinalizeRefueling(TargetIndex.A, TargetIndex.B));

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.ClosestTouch).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Construct.UninstallIfMinifiable(TargetIndex.A).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

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

            Toil gotoCell = Toils_Goto.GotoCell(TargetIndex.B, PathEndMode.OnCell);

            gotoCell.AddPreTickAction(delegate
            {
                if (this.$this.Map.exitMapGrid.IsExitCell(this.$this.pawn.Position))
                {
                    this.$this.pawn.ExitMap(true);
                }
            });
            yield return(gotoCell);

            yield return(new Toil
            {
                initAction = delegate
                {
                    if (this.$this.pawn.Position.OnEdge(this.$this.pawn.Map) || this.$this.pawn.Map.exitMapGrid.IsExitCell(this.$this.pawn.Position))
                    {
                        this.$this.pawn.ExitMap(true);
                    }
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
Ejemplo n.º 22
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, false, false, false));

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

            Toil repair = Toils_General.Wait(75, TargetIndex.None);

            repair.FailOnDespawnedOrNull(TargetIndex.A);
            repair.FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch);
            repair.WithEffect(Gun.def.repairEffect, TargetIndex.A);
            repair.WithProgressBarToilDelay(TargetIndex.A, false, -0.5f);
            yield return(repair);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    BeamColorThing.BeamColor = pawn.CurJob.maxNumMeleeAttacks;

                    var targetInfo = new TargetInfo(Gun.Position, Map, false);
                    Effecter effecter = EffecterDefOf.Deflect_Metal.Spawn();
                    effecter.Trigger(targetInfo, targetInfo);
                    effecter.Cleanup();
                    this.Prism.Destroy(DestroyMode.Vanish);
                }
            });

            yield break;
        }
Ejemplo n.º 23
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            this.FailOnBurningImmobile(TargetIndex.A);
            base.AddEndCondition(() => (this.Vat.SpaceLeftForInput > 0) ? JobCondition.Ongoing : JobCondition.Succeeded);
            yield return(Toils_General.DoAtomic(delegate
            {
                this.job.count = this.Vat.SpaceLeftForInput;
            }));

            Toil reserveWort = Toils_Reserve.Reserve(TargetIndex.B, 1, -1, null);

            yield return(reserveWort);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

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

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserveWort, TargetIndex.B, TargetIndex.None, true, null));

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

            yield return(Toils_General.Wait(200).FailOnDestroyedNullOrForbidden(TargetIndex.B).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnCannotTouch(TargetIndex.A, PathEndMode.Touch).WithProgressBarToilDelay(TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate
                {
                    this.Vat.AddInput(InputThing);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);
            yield return(Toils_Reserve.Reserve(TargetIndex.B));

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B));

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

            yield return(Toils_General.Wait(1200).WithProgressBarToilDelay(TargetIndex.A).FailOnDestroyedOrNull(TargetIndex.A));

            Toil finish = new Toil
            {
                initAction = delegate
                {
                    if (module != null)
                    {
                        ArmorModuleDef moduleDef = DefDatabase <ArmorModuleDef> .AllDefs.Where(x => x.Item == module.def).FirstOrDefault();

                        if (moduleDef == null)
                        {
                            return;
                        }

                        armor.AddModule(moduleDef, module);
                        pawn.carryTracker.TryDropCarriedThing(pawn.Position, ThingPlaceMode.Near, out Thing t);
                        module.DeSpawn();
                    }
                },
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !base.Map.lordManager.lords.Contains(job.lord));
            Toil reserve = Toils_Reserve.Reserve(TargetIndex.A).FailOnDespawnedOrNull(TargetIndex.A);

            yield return(reserve);

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

            yield return(DetermineNumToHaul());

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

            yield return(AddCarriedThingToTransferables());

            yield return(Toils_Haul.CheckForGetOpportunityDuplicate(reserve, TargetIndex.A, TargetIndex.None, takeFromValidStorage: true, (Thing x) => Transferable.things.Contains(x)));

            Toil findCarrier = FindCarrier();

            yield return(findCarrier);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.Touch).JumpIf(() => !IsUsableCarrier(Carrier, pawn, allowColonists: true), findCarrier));

            yield return(Toils_General.Wait(25).JumpIf(() => !IsUsableCarrier(Carrier, pawn, allowColonists: true), findCarrier).WithProgressBarToilDelay(TargetIndex.B));

            yield return(PlaceTargetInCarrierInventory());
        }
Ejemplo n.º 26
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnAggroMentalState(TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.OnCell).FailOnDestroyedNullOrForbidden(TargetIndex.A)
                         .FailOn(() => !this.pawn.CanReach(this.Takee, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn))
                         .FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    this.pawn.jobs.curJob.count = 1;
                },
            });

            yield return(Toils_General.Wait(100, TargetIndex.A));

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

            yield return(new Toil
            {
                initAction = delegate()
                {
                    this.pawn.jobs.curJob.count = 1;
                    var stickyGoo = (StickyGoo)ThingMaker.MakeThing(PurpleIvyDefOf.PI_StickyGoo);
                    GenSpawn.Spawn(stickyGoo, this.pawn.Position, this.pawn.Map);
                    stickyGoo.TryAcceptThing(Takee);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
        public override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnAggroMentalState(TargetIndex.A);
            //this.FailOn(() => !this.DropPod.Accepts(this.Takee));
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.OnCell).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.HackingTable.GetCurOccupant(Building_HackingTable.SLOTINDEX) != null && this.HackingTable.GetCurOccupant(Building_HackingTable.SLOTINDEX).OnHackingTable()).FailOn(() => !this.pawn.CanReach(this.Takee, PathEndMode.OnCell, Danger.Deadly, false, false, TraverseMode.ByPawn)).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.A));

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.InteractionCell));

            //yield return Toils_Haul.CarryHauledThingToCell(TargetIndex.A)
            yield return(new Toil
            {
                initAction = delegate
                {
                    this.pawn.carryTracker.TryDropCarriedThing(HackingTable.GetSleepingSlotPos(Building_HackingTable.SLOTINDEX), ThingPlaceMode.Direct, out Thing thing, null);
                    this.pawn.ClearAllReservations();
                    HackingTable.TryAddPawnForModification(Takee, WTH_DefOf.WTH_HackMechanoid);
                    Takee.Position = HackingTable.GetSleepingSlotPos(Building_HackingTable.SLOTINDEX);
                    ExtendedPawnData pawnData = Base.Instance.GetExtendedDataStorage().GetExtendedDataFor(Takee);
                    pawnData.isActive = false;
                    pawnData.canWorkNow = false;
                },
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDespawnedNullOrForbidden(TargetIndex.A);

            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1));

            var reserveSeeds = ReserveSeedsIfWillPlantWholeStack();

            yield return(reserveSeeds);

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.ClosestTouch)
                         .FailOnDespawnedNullOrForbidden(TargetIndex.B)
                         .FailOnSomeonePhysicallyInteracting(TargetIndex.B));

            yield return(Toils_Haul.StartCarryThing(TargetIndex.B, false, false)
                         .FailOnDestroyedNullOrForbidden(TargetIndex.B));

            Toils_Haul.CheckForGetOpportunityDuplicate(reserveSeeds, TargetIndex.B, TargetIndex.None, false, null);

            var toil = Toils_Goto.GotoCell(TargetIndex.A, PathEndMode.Touch);

            yield return(toil);

            yield return(SowSeedToil());

            yield return(Toils_Reserve.Release(TargetIndex.A));

            yield return(TryToSetAdditionalPlantingSite());

            yield return(Toils_Reserve.Reserve(TargetIndex.A, 1));

            yield return(Toils_Jump.Jump(toil));
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedOrNull(TargetIndex.A);
            this.FailOnDestroyedOrNull(TargetIndex.B);
            this.FailOnAggroMentalState(TargetIndex.A);
            this.FailOn(() => !this.DropPod.Accepts(this.Takee));
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.OnCell).FailOnDestroyedNullOrForbidden(TargetIndex.A).FailOnDespawnedNullOrForbidden(TargetIndex.B).FailOn(() => this.DropPod.GetDirectlyHeldThings().Count > 0).FailOn(() => !this.Takee.Downed).FailOn(() => !this.pawn.CanReach(this.Takee, PathEndMode.OnCell, Danger.Deadly, false, TraverseMode.ByPawn)).FailOnSomeonePhysicallyInteracting(TargetIndex.A));

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

            yield return(Toils_Goto.GotoThing(TargetIndex.B, PathEndMode.InteractionCell));

            Toil prepare = Toils_General.Wait(500, TargetIndex.None);

            prepare.FailOnCannotTouch(TargetIndex.B, PathEndMode.InteractionCell);
            prepare.WithProgressBarToilDelay(TargetIndex.B, false, -0.5f);
            yield return(prepare);

            yield return(new Toil
            {
                initAction = delegate()
                {
                    this.DropPod.TryAcceptThing(this.Takee, true);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOnDestroyedNullOrForbidden(SlaveInd);
            this.FailOnBurningImmobile(SlaveInd);
            this.FailOn(() =>
            {
                var slave = (Pawn)this.GetActor().CurJob.GetTarget(SlaveInd).Thing;
                return(slave.guest.interactionMode != (PrisonerInteractionMode)Data.PIM_FreeSlave);
            });
            this.FailOnDowned(SlaveInd);
            this.FailOnAggroMentalState(SlaveInd);
            yield return(Toils_Reserve.Reserve(SlaveInd, 1));

            yield return(Toils_Goto.GotoThing(SlaveInd, PathEndMode.ClosestTouch));

            yield return(Toils_Haul.StartCarryThing(SlaveInd));

            var gotoToil = Toils_Goto.GotoCell(ReleaseCellInd, PathEndMode.ClosestTouch);

            yield return(gotoToil);

            yield return(Toils_Haul.PlaceHauledThingInCell(ReleaseCellInd, gotoToil, false));

            yield return(Toils_Reserve.Release(SlaveInd));

            yield return(Toils_Prisoner.FreeSlave(SlaveInd, CollarInd));
        }