public override void LordToilTick()
 {
     if (Find.TickManager.TicksGame % 100 == 0)
     {
         GatherAnimalsAndSlavesForCaravanUtility.CheckArrived(this.lord, this.exitSpot, "ReadyToExitMap", (Pawn x) => true, null);
     }
 }
Пример #2
0
 public override void LordToilTick()
 {
     if (Find.TickManager.TicksGame % 100 == 0)
     {
         GatherAnimalsAndSlavesForCaravanUtility.CheckArrived(this.lord, this.lord.ownedPawns, this.meetingPoint, "AllSlavesGathered", (Pawn x) => !x.IsColonist && !x.RaceProps.Animal, new Predicate <Pawn>(GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone));
     }
 }
 public override void LordToilTick()
 {
     if (Find.TickManager.TicksGame % 100 == 0)
     {
         GatherAnimalsAndSlavesForCaravanUtility.CheckArrived(lord, lord.ownedPawns, meetingPoint, "AllAnimalsGathered", (Pawn x) => x.RaceProps.Animal, (Pawn x) => GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(x));
     }
 }
Пример #4
0
        private Toil SetFollowerToil()
        {
            Toil toil = new Toil();

            toil.initAction = delegate
            {
                GatherAnimalsAndSlavesForCaravanUtility.SetFollower(AnimalOrSlave, pawn);
                RestUtility.WakeUp(pawn);
            };
            toil.defaultCompleteMode = ToilCompleteMode.Instant;
            return(toil);
        }
 private Toil SetFollowerToil()
 {
     return(new Toil
     {
         initAction = delegate
         {
             GatherAnimalsAndSlavesForCaravanUtility.SetFollower(this.AnimalOrSlave, this.pawn);
             RestUtility.WakeUp(this.pawn);
         },
         defaultCompleteMode = ToilCompleteMode.Instant
     });
 }
 public override void LordToilTick()
 {
     if (Find.TickManager.TicksGame % 100 == 0)
     {
         Lord             lord   = this.lord;
         IntVec3          intVec = this.meetingPoint;
         string           memo   = "AllAnimalsGathered";
         Predicate <Pawn> shouldCheckIfArrived = (Pawn x) => x.RaceProps.Animal;
         if (LordToil_PrepareCaravan_GatherAnimals.< > f__mg$cache0 == null)
         {
             LordToil_PrepareCaravan_GatherAnimals.< > f__mg$cache0 = new Predicate <Pawn>(GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone);
         }
         GatherAnimalsAndSlavesForCaravanUtility.CheckArrived(lord, intVec, memo, shouldCheckIfArrived, LordToil_PrepareCaravan_GatherAnimals.< > f__mg$cache0);
     }
 }
        private Pawn FindPawn(Pawn pawn)
        {
            Pawn result;

            if (pawn.mindState.duty.pawnsToGather == PawnsToGather.None)
            {
                result = null;
            }
            else
            {
                float num   = 0f;
                Pawn  pawn2 = null;
                Lord  lord  = pawn.GetLord();
                for (int i = 0; i < lord.ownedPawns.Count; i++)
                {
                    Pawn pawn3 = lord.ownedPawns[i];
                    if (pawn3 != pawn)
                    {
                        if (!pawn3.IsColonist)
                        {
                            if (pawn.mindState.duty.pawnsToGather != PawnsToGather.Slaves || !pawn3.RaceProps.Animal)
                            {
                                if (pawn.mindState.duty.pawnsToGather != PawnsToGather.Animals || pawn3.RaceProps.Animal)
                                {
                                    if (!GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(pawn3))
                                    {
                                        float num2 = (float)pawn.Position.DistanceToSquared(pawn3.Position);
                                        if (pawn2 == null || num2 < num)
                                        {
                                            if (pawn.CanReserveAndReach(pawn3, PathEndMode.Touch, Danger.Deadly, 1, -1, null, false))
                                            {
                                                pawn2 = pawn3;
                                                num   = num2;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
                result = pawn2;
            }
            return(result);
        }
Пример #8
0
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002b: stateMachine*/)._0024this.Map.lordManager.lords.Contains(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_002b: stateMachine*/)._0024this.job.lord));
            this.FailOn(() => ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0043: stateMachine*/)._0024this.AnimalOrSlave == null || ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0043: stateMachine*/)._0024this.AnimalOrSlave.GetLord() != ((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0043: stateMachine*/)._0024this.job.lord);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A).FailOn(() => GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(((_003CMakeNewToils_003Ec__Iterator0) /*Error near IL_0063: stateMachine*/)._0024this.AnimalOrSlave)));

            /*Error: Unable to find new state assignment for yield return*/;
        }
        protected override IEnumerable <Toil> MakeNewToils()
        {
            this.FailOn(() => !this.$this.Map.lordManager.lords.Contains(this.$this.job.lord));
            this.FailOn(() => this.$this.AnimalOrSlave == null || this.$this.AnimalOrSlave.GetLord() != this.$this.job.lord);
            yield return(Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A).FailOn(() => GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(this.$this.AnimalOrSlave)));

            yield return(this.SetFollowerToil());
        }
Пример #10
0
            public bool MoveNext()
            {
                uint num = (uint)this.$PC;

                this.$PC = -1;
                switch (num)
                {
                case 0u:
                    this.FailOn(() => !base.Map.lordManager.lords.Contains(this.job.lord));
                    this.FailOn(() => base.AnimalOrSlave == null || base.AnimalOrSlave.GetLord() != this.job.lord);
                    this.$current = Toils_Goto.GotoThing(TargetIndex.A, PathEndMode.Touch).FailOnDespawnedOrNull(TargetIndex.A).FailOn(() => GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(base.AnimalOrSlave));
                    if (!this.$disposing)
                    {
                        this.$PC = 1;
                    }
                    return(true);

                case 1u:
                    this.$current = base.SetFollowerToil();
                    if (!this.$disposing)
                    {
                        this.$PC = 2;
                    }
                    return(true);

                case 2u:
                    this.$PC = -1;
                    break;
                }
                return(false);
            }
Пример #11
0
 private void <SetFollowerToil> m__0()
 {
     GatherAnimalsAndSlavesForCaravanUtility.SetFollower(this.AnimalOrSlave, this.pawn);
     RestUtility.WakeUp(this.pawn);
 }
Пример #12
0
 private static bool <LordToilTick> m__1(Pawn x)
 {
     return(GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(x));
 }