コード例 #1
0
        public static Pawn PawnBlockingPathAt(IntVec3 c, Pawn forPawn, bool actAsIfHadCollideWithPawnsJob = false, bool collideOnlyWithStandingPawns = false, bool forPathFinder = false)
        {
            List <Thing> thingList = c.GetThingList(forPawn.Map);
            Pawn         result;

            if (thingList.Count == 0)
            {
                result = null;
            }
            else
            {
                bool flag = false;
                if (actAsIfHadCollideWithPawnsJob)
                {
                    flag = true;
                }
                else
                {
                    Job curJob = forPawn.CurJob;
                    if (curJob != null && (curJob.collideWithPawns || curJob.def.collideWithPawns || forPawn.jobs.curDriver.collideWithPawns))
                    {
                        flag = true;
                    }
                    else if (!forPawn.Drafted || forPawn.pather.Moving)
                    {
                    }
                }
                for (int i = 0; i < thingList.Count; i++)
                {
                    Pawn pawn = thingList[i] as Pawn;
                    if (pawn != null && pawn != forPawn && !pawn.Downed)
                    {
                        if (collideOnlyWithStandingPawns)
                        {
                            if (pawn.pather.MovingNow)
                            {
                                goto IL_1BA;
                            }
                            if (pawn.pather.Moving && pawn.pather.MovedRecently(60))
                            {
                                goto IL_1BA;
                            }
                        }
                        if (!PawnUtility.PawnsCanShareCellBecauseOfBodySize(pawn, forPawn))
                        {
                            if (pawn.HostileTo(forPawn))
                            {
                                return(pawn);
                            }
                            if (flag)
                            {
                                if (forPathFinder || !forPawn.Drafted || !pawn.RaceProps.Animal)
                                {
                                    Job curJob2 = pawn.CurJob;
                                    if (curJob2 != null && (curJob2.collideWithPawns || curJob2.def.collideWithPawns || pawn.jobs.curDriver.collideWithPawns))
                                    {
                                        return(pawn);
                                    }
                                }
                            }
                        }
                    }
                    IL_1BA :;
                }
                result = null;
            }
            return(result);
        }
コード例 #2
0
        public static Pawn PawnBlockingPathAt(IntVec3 c, Pawn forPawn, bool actAsIfHadCollideWithPawnsJob = false, bool collideOnlyWithStandingPawns = false)
        {
            List <Thing> thingList = c.GetThingList(forPawn.Map);

            if (thingList.Count == 0)
            {
                return(null);
            }
            bool flag = false;

            if (actAsIfHadCollideWithPawnsJob)
            {
                flag = true;
            }
            else
            {
                Job curJob = forPawn.CurJob;
                if (curJob != null && (curJob.collideWithPawns || curJob.def.collideWithPawns))
                {
                    flag = true;
                }
                else if (forPawn.Drafted && forPawn.pather.Moving)
                {
                    flag = true;
                }
            }
            for (int i = 0; i < thingList.Count; i++)
            {
                Pawn pawn = thingList[i] as Pawn;
                if (pawn != null && pawn != forPawn && !pawn.Downed && (!collideOnlyWithStandingPawns || (!pawn.pather.MovingNow && (!pawn.pather.Moving || !pawn.pather.MovedRecently(60)))) && !PawnUtility.PawnsCanShareCellBecauseOfBodySize(pawn, forPawn))
                {
                    if (pawn.HostileTo(forPawn))
                    {
                        return(pawn);
                    }
                    if (flag)
                    {
                        Job curJob2 = pawn.CurJob;
                        if (curJob2 != null && (curJob2.collideWithPawns || curJob2.def.collideWithPawns))
                        {
                            return(pawn);
                        }
                    }
                }
            }
            return(null);
        }