Esempio n. 1
0
        // Token: 0x06000002 RID: 2 RVA: 0x00002072 File Offset: 0x00000272
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDespawnedOrNull <JobDriver_RearmTrap>(this, TargetIndex.A);
            ToilFailConditions.FailOnThingMissingDesignation <JobDriver_RearmTrap>(this, TargetIndex.A, YautjaDefOf.RRY_RearmTrap);
            Toil toil = new Toil();

            toil.initAction = delegate()
            {
                this.pawn.pather.StartPath(base.TargetThingA, PathEndMode.Touch);
            };
            toil.defaultCompleteMode = ToilCompleteMode.PatherArrival;
            ToilFailConditions.FailOnDespawnedNullOrForbidden <Toil>(toil, TargetIndex.A);
            yield return(toil);

            yield return(ToilEffects.WithProgressBarToilDelay(Toils_General.Wait(1125, 0), TargetIndex.A, false, -0.5f));

            yield return(new Toil
            {
                initAction = delegate()
                {
                    Thing thing = this.job.targetA.Thing;
                    Designation designation = base.Map.designationManager.DesignationOn(thing, YautjaDefOf.RRY_RearmTrap);
                    if (designation != null)
                    {
                        designation.Delete();
                    }
                    (thing as Building_TrapRearmable).Rearm();
                    this.pawn.records.Increment(YautjaDefOf.RRY_TrapsRearmed);
                },
                defaultCompleteMode = ToilCompleteMode.Instant
            });

            yield break;
        }
Esempio n. 2
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            yield return(ToilFailConditions.FailOnDespawnedOrNull <Toil> (this.GotoThing(this.TargetA.Cell, this.Map, PathEndMode.OnCell), TargetIndex.A));

            yield return(this.DespawnIntoContainer());

            yield break;
        }
Esempio n. 3
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDespawnedOrNull(this, TargetIndex.A);
            ToilFailConditions.FailOnDowned(this, TargetIndex.A);
            Pawn target = this.TargetA.Thing as Pawn;

            yield return(JobDriver_Abuse.ReachTarget(target));

            yield return(JobDriver_Abuse.AbuseTarget(target));

            yield break;
        }
Esempio n. 4
0
        /*
         * //maybe change?
         * protected abstract int GatherResourcesIntervalDays
         * {
         *      get;
         * }
         *
         * //add breastsize modifier?
         * protected abstract int ResourceAmount
         * {
         *      get;
         * }
         * //add more  milks?
         * protected abstract ThingDef ResourceDef
         * {
         *      get;
         * }
         */

        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDespawnedNullOrForbidden <JobDriver_GatherHumanBodyResources>(this, TargetIndex.A);
            ToilFailConditions.FailOnNotCasualInterruptible <JobDriver_GatherHumanBodyResources>(this, TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil wait = new Toil();

            wait.initAction = delegate
            {
                Pawn            milker  = base.pawn;
                LocalTargetInfo target  = base.job.GetTarget(TargetIndex.A);
                Pawn            target2 = (Pawn)target.Thing;
                milker.pather.StopDead();
                PawnUtility.ForceWait(target2, 15000, null, true);
            };
            wait.tickAction = delegate
            {
                Pawn milker = base.pawn;
                milker.skills.Learn(SkillDefOf.Animals, 0.13f, false);
                gatherProgress += StatExtension.GetStatValue(milker, StatDefOf.AnimalGatherSpeed, true);
                if (gatherProgress >= WorkTotal)
                {
                    GetComp((Pawn)base.job.GetTarget(TargetIndex.A)).Gathered(base.pawn);
                    milker.jobs.EndCurrentJob(JobCondition.Succeeded, true);
                }
            };
            wait.AddFinishAction((Action) delegate
            {
                Pawn milker            = base.pawn;
                LocalTargetInfo target = base.job.GetTarget(TargetIndex.A);
                Pawn target2           = (Pawn)target.Thing;
                if (target2 != null && target2.CurJobDef == JobDefOf.Wait_MaintainPosture)
                {
                    milker.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                }
            });
            ToilFailConditions.FailOnDespawnedOrNull <Toil>(wait, TargetIndex.A);
            ToilFailConditions.FailOnCannotTouch <Toil>(wait, TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition((Func <JobCondition>) delegate
            {
                if (GetComp((Pawn)base.job.GetTarget(TargetIndex.A)).ActiveAndFull)
                {
                    return(JobCondition.Ongoing);
                }
                return(JobCondition.Incompletable);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            ToilEffects.WithProgressBar(wait, TargetIndex.A, (Func <float>)(() => gatherProgress / WorkTotal), false, -0.5f);
            wait.activeSkill = (() => SkillDefOf.Animals);
            yield return(wait);
        }
Esempio n. 5
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDespawnedNullOrForbidden(this, TargetIndex.A);
            ToilFailConditions.FailOnNotCasualInterruptible(this, TargetIndex.A);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch));

            Toil wait = new Toil();

            wait.initAction = delegate()
            {
                Pawn actor = wait.actor;
                Pawn pawn  = (Pawn)job.GetTarget(TargetIndex.A).Thing;
                actor.pather.StopDead();
                PawnUtility.ForceWait(pawn, 15000, null, true);
            };
            wait.tickAction = delegate()
            {
                Pawn actor = wait.actor;
                actor.skills.Learn(SkillDefOf.Animals, 0.13f, false);
                gatherProgress += StatExtension.GetStatValue(actor, StatDefOf.AnimalGatherSpeed, true);
                if (gatherProgress >= WorkTotal)
                {
                    GetComp((Pawn)((Thing)job.GetTarget(TargetIndex.A))).Gathered(this.pawn);
                    actor.jobs.EndCurrentJob(JobCondition.Succeeded, true);
                }
            };
            wait.AddFinishAction(delegate()
            {
                Pawn pawn = (Pawn)job.GetTarget(TargetIndex.A).Thing;
                if (pawn != null && pawn.CurJobDef == JobDefOf.Wait_MaintainPosture)
                {
                    pawn.jobs.EndCurrentJob(JobCondition.InterruptForced, true);
                }
            });
            ToilFailConditions.FailOnDespawnedOrNull <Toil>(wait, TargetIndex.A);
            ToilFailConditions.FailOnCannotTouch <Toil>(wait, TargetIndex.A, PathEndMode.Touch);
            wait.AddEndCondition(delegate()
            {
                if (!GetComp((Pawn)((Thing)this.job.GetTarget(TargetIndex.A))).ActiveAndFull)
                {
                    return(JobCondition.Incompletable);
                }
                return(JobCondition.Ongoing);
            });
            wait.defaultCompleteMode = ToilCompleteMode.Never;
            ToilEffects.WithProgressBar(wait, TargetIndex.A, () => this.gatherProgress / this.WorkTotal, false, -0.5f);
            wait.activeSkill = (() => SkillDefOf.Animals);
            yield return(wait);

            yield break;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDestroyedOrNull <JobDriver_Segmentation>(this, TargetIndex.A);
            ToilFailConditions.FailOnDespawnedOrNull <JobDriver_Segmentation>(this, TargetIndex.A);
            ToilFailConditions.FailOn <JobDriver_Segmentation>(this, new Func <bool>(this.eaterIsKilled));
            Toil resCorpse = new Toil();

            resCorpse.initAction = delegate()
            {
                Pawn  actor = resCorpse.actor;
                Thing thing = resCorpse.actor.CurJob.GetTarget(TargetIndex.A).Thing;
                bool  flag  = !thing.Spawned || !this.Map.reservationManager.CanReserve(actor, thing, 1);
                bool  flag2 = flag;
                if (flag2)
                {
                    actor.jobs.EndCurrentJob(JobCondition.Incompletable, true);
                }
                else
                {
                    this.Map.reservationManager.Reserve(actor, actor.CurJob, thing, 1);
                }
            };
            resCorpse.defaultCompleteMode = ToilCompleteMode.Instant;
            yield return(resCorpse);

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

            yield return(Toils_General.Wait(400));

            Toil toil = new Toil
            {
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            toil.initAction = new Action(this.doStripCorpse);
            yield return(toil);

            yield return(Toils_General.Wait(60));

            Toil toil2 = new Toil
            {
                defaultCompleteMode = ToilCompleteMode.Instant
            };

            toil2.initAction = new Action(this.doChewCorpse);
            ToilEffects.WithEffect(toil2, EffecterDefOf.EatMeat, TargetIndex.A);
            ToilFailConditions.EndOnDespawnedOrNull <Toil>(toil2, TargetIndex.A, JobCondition.Incompletable);
            yield return(toil2);

            yield break;
        }
Esempio n. 7
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            ToilFailConditions.FailOnDespawnedOrNull(this, TargetIndex.A);
            Pawn prey = this.TargetA.Thing as Pawn;

            if (prey.Dead)
            {
                this.EndJobWith(JobCondition.Succeeded);
            }
            yield return(Toils_Combat.TrySetJobToUseAttackVerb(TargetIndex.A));

            yield return(Toils_Combat.GotoCastPosition(TargetIndex.A, true));

            yield return(Toils_Combat.CastVerb(TargetIndex.A));

            yield break;
        }