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);
        }
Example #2
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*/;
        }
 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));
     }
 }
        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());
        }
Example #5
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);
            }
Example #6
0
 private static bool <LordToilTick> m__1(Pawn x)
 {
     return(GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(x));
 }
 public override void LordToilTick()
 {
     if (Find.TickManager.TicksGame % 100 == 0)
     {
         GatherAnimalsAndSlavesForCaravanUtility.CheckArrived(this.lord, this.meetingPoint, "AllSlavesGathered", (Pawn x) => !x.IsColonist && !x.RaceProps.Animal, (Pawn x) => GatherAnimalsAndSlavesForCaravanUtility.IsFollowingAnyone(x));
     }
 }