// Token: 0x06003EF3 RID: 16115 RVA: 0x001D7E89 File Offset: 0x001D6289
        protected override IntVec3 GetWanderRoot(Pawn pawn)
        {
            bool anyPotentialHosts = !pawn.Map.ViableHosts().NullOrEmpty();

            if (anyPotentialHosts)
            {
                bool anyReachablePotentialHosts = pawn.Map.ViableHosts().Any(x => pawn.CanReach(x, PathEndMode.ClosestTouch, Danger.Deadly, false, TraverseMode.NoPassClosedDoors));
                if (anyReachablePotentialHosts)
                {
                    Pawn potentialHost = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.ClosestTouch, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Some), float.MaxValue, (x => ((Pawn)x).isPotentialHost())) ?? null;
                    if (potentialHost != null)
                    {
                        Predicate <IntVec3> validator = delegate(IntVec3 y)
                        {
                            return(XenomorphUtil.DistanceBetween(y, potentialHost.Position) < XenomorphUtil.DistanceBetween(y, pawn.Position));
                        };
                        if (RCellFinder.TryFindRandomCellNearWith(pawn.Position, validator, pawn.Map, out IntVec3 lc, 6, (int)wanderRadius))
                        {
                            return(lc);
                        }
                    }
                }
            }
            return(pawn.Position);
        }
コード例 #2
0
 public static List <Pawn> SpawnedFacehuggerPawns(Map map, int radius, Pawn pawn)
 {
     return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x) && XenomorphUtil.DistanceBetween(x.Position, pawn.Position) < radius && x.CanReach(pawn, PathEndMode.ClosestTouch, Danger.Deadly)));
 }
コード例 #3
0
 public static List <Pawn> SpawnedFacehuggerPawns(Map map, int radius, IntVec3 position, IntVec3 otherposition)
 {
     return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x) && XenomorphUtil.DistanceBetween(otherposition, position) < radius));
 }
コード例 #4
0
 public static List <Pawn> SpawnedInfectablePawns(Map map, int radius, IntVec3 position, IntVec3 otherposition)
 {
     return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.isInfectablePawn(x) && XenomorphUtil.DistanceBetween(otherposition, position) < radius));
 }
コード例 #5
0
        // Token: 0x060005DA RID: 1498 RVA: 0x000393CC File Offset: 0x000377CC
        private static bool HaulablePlaceValidator(Thing haulable, Pawn worker, IntVec3 c, IntVec3 center, int radius)
        {
            if (!worker.CanReserveAndReach(c, PathEndMode.OnCell, worker.NormalMaxDanger(), 1, -1, null, false))
            {
                return(false);
            }
            if (GenPlace.HaulPlaceBlockerIn(haulable, c, worker.Map, true) != null)
            {
                return(false);
            }
            if (!c.Standable(worker.Map))
            {
                return(false);
            }
            if (c == haulable.Position && haulable.Spawned)
            {
                return(false);
            }
            if (c.ContainsStaticFire(worker.Map))
            {
                return(false);
            }
            if (XenomorphUtil.DistanceBetween(c, center) <= radius)
            {
                return(false);
            }

            /*
             * if (XenomorphUtil.DistanceBetween(c, center) > radius*2)
             * {
             *  return false;
             * }
             */
            /*
             * if (c.AdjacentTo8Way(center))
             * {
             *  return false;
             * }
             */
            if (haulable != null && haulable.def.BlockPlanting)
            {
                Zone zone = worker.Map.zoneManager.ZoneAt(c);
                if (zone is Zone_Growing)
                {
                    return(false);
                }
            }
            if (haulable.def.passability != Traversability.Standable)
            {
                for (int i = 0; i < 8; i++)
                {
                    IntVec3 c2 = c + GenAdj.AdjacentCells[i];
                    if (worker.Map.designationManager.DesignationAt(c2, DesignationDefOf.Mine) != null)
                    {
                        return(false);
                    }
                }
            }
            Building edifice = c.GetEdifice(worker.Map);

            if (edifice != null)
            {
                Building_Trap building_Trap = edifice as Building_Trap;
                if (building_Trap != null)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #6
0
 public static List <Pawn> SpawnedInfectablePawns(Map map, int radius, IntVec3 position)
 {
     return(map.mapPawns.AllPawnsSpawned.FindAll(x => x.isPotentialHost() && XenomorphUtil.DistanceBetween(x.Position, position) < radius));
 }