// Token: 0x060004D2 RID: 1234 RVA: 0x00031074 File Offset: 0x0002F474
        public static bool TryFindGoodKidnapVictim(Pawn kidnapper, float maxDist, out Pawn victim, List <Thing> disallowed = null)
        {
            if (!kidnapper.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) || !kidnapper.Map.reachability.CanReachMapEdge(kidnapper.Position, TraverseParms.For(kidnapper, Danger.Some, TraverseMode.ByPawn, false)))
            {
                victim = null;
                return(false);
            }
            Predicate <Thing> validator = delegate(Thing t)
            {
                Pawn pawn = t as Pawn;
                return(XenomorphUtil.isInfectablePawn(pawn) && pawn.RaceProps.Humanlike && pawn.Downed && pawn.Faction == Faction.OfPlayer && pawn.Faction.HostileTo(kidnapper.Faction) && kidnapper.CanReserve(pawn, 1, -1, null, false) && (disallowed == null || !disallowed.Contains(pawn)));
            };

            victim = (Pawn)GenClosest.ClosestThingReachable(kidnapper.Position, kidnapper.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Some, false), maxDist, validator, null, 0, -1, false, RegionType.Set_Passable, false);
            return(victim != null);
        }
예제 #2
0
        // Token: 0x060015AA RID: 5546 RVA: 0x000A92C8 File Offset: 0x000A76C8
        public override void Arrive(List <Pawn> pawns, IncidentParms parms)
        {
            Map map = (Map)parms.target;
            List <Pair <List <Pawn>, IntVec3> > list = PawnsArrivalModeWorkerUtility.SplitIntoRandomGroupsNearMapEdge(pawns, map, false);

            PawnsArrivalModeWorkerUtility.SetPawnGroupsInfo(parms, list);
            for (int i = 0; i < list.Count; i++)
            {
                for (int j = 0; j < list[i].First.Count; j++)
                {
                    IntVec3 dropCenter = XenomorphUtil.SpawnedChildHivelikes(map).RandomElement().Position;
                    IntVec3 loc        = CellFinder.RandomClosewalkCellNear(dropCenter, map, 8, null);
                    GenSpawn.Spawn(list[i].First[j], loc, map, parms.spawnRotation, WipeMode.Vanish, false);
                }
            }
        }
예제 #3
0
        public static bool IsAcceptablePreyFor(Pawn predator, Pawn prey)
        {
            bool XenoInfection = XenomorphUtil.IsInfectedPawn(prey);
            bool IsXenos       = XenomorphUtil.IsXenomorph(prey);

            //    Log.Message(string.Format("{0} hunting {1}? XenoInfection:{2} IsXenos:{3}", predator.Label, prey.Label, XenoInfection, IsXenos));
            if (XenoInfection)
            {
                //    Log.Message(string.Format("{0} cant hunt {1} cause XenoInfection:{2}", predator.Label, prey.Label, XenoInfection));
                return(false);
            }
            if (IsXenos)
            {
                //    Log.Message(string.Format("{0} cant hunt {1} cause IsXenos:{2}", predator.Label, prey.Label, IsXenos));
                return(false);
            }
            if (!prey.RaceProps.IsFlesh)
            {
                return(false);
            }
            if (prey.BodySize > predator.RaceProps.maxPreyBodySize)
            {
                return(false);
            }
            if (prey.BodySize < 0.7f)
            {
                return(false);
            }

            /*
             * if (!prey.Downed)
             * {
             *  if (prey.kindDef.combatPower > 2f * predator.kindDef.combatPower)
             *  {
             *      return false;
             *  }
             *  float num = prey.kindDef.combatPower * prey.health.summaryHealth.SummaryHealthPercent * prey.ageTracker.CurLifeStage.bodySizeFactor;
             *  float num2 = predator.kindDef.combatPower * predator.health.summaryHealth.SummaryHealthPercent * predator.ageTracker.CurLifeStage.bodySizeFactor;
             *  if (num >= num2)
             *  {
             *      return false;
             *  }
             * }
             */
            //Log.Message(string.Format("{0}@{1} can hunt {2}@{3}", predator.Label, predator.Position, prey.Label, prey.Position));
            return((predator.Faction == null || prey.Faction == null || predator.HostileTo(prey)) && (predator.Faction == null || prey.HostFaction == null || predator.HostileTo(prey)) && (predator.Faction != Faction.OfPlayer || prey.Faction != Faction.OfPlayer) && (!predator.RaceProps.herdAnimal || predator.def != prey.def) && (!prey.health.hediffSet.HasHediff(XenomorphDefOf.RRY_FaceHuggerInfection) && !prey.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenXenomorphImpregnation) && !prey.health.hediffSet.HasHediff(XenomorphDefOf.RRY_XenomorphImpregnation)));
        }
예제 #4
0
 public static bool isPotentialHost(this Pawn p, out string FailReason, bool setDefaults = false, bool allowImpreg = false, bool allowHugged = true)
 {
     if (!p.health.hediffSet.HasHead)
     {
         FailReason = "HasHead";
         return(false);
     }
     if (p.Dead)
     {
         FailReason = "Dead";
         return(false);
     }
     if (!p.health.capacities.CapableOf(PawnCapacityDefOf.Breathing) || !p.health.capacities.CapableOf(PawnCapacityDefOf.Eating))
     {
         FailReason = "Doesnt Eat or Breath";
         return(false);
     }
     if (p.isHost())
     {
         FailReason = "Host";
         if (p.isNeoHost())
         {
             FailReason = "Neo " + FailReason;
         }
         if (p.isXenoHost() && !allowImpreg)
         {
             FailReason = "Xeno " + FailReason;
         }
         return(false);
     }
     if (XenomorphUtil.IsXenomorphFaction(p))
     {
         FailReason = "Xenomorph Faction Member";
         return(false);
     }
     if (p.BodySize < 0.65f && !p.RaceProps.Humanlike)
     {
         FailReason = "NonhumanlikeTooSmall";
         return(false);
     }
     if (!p.def.isPotentialHost(out FailReason, setDefaults))
     {
         return(false);
     }
     return(true);
 }
예제 #5
0
        // Token: 0x06000524 RID: 1316 RVA: 0x0003381C File Offset: 0x00031C1C
        protected override Job TryGiveJob(Pawn pawn)
        {
            Predicate <Thing> validator = delegate(Thing t)
            {
                Pawn  pawn3   = (Pawn)t;
                float eggDist = 9999f;
                Thing egg     = XenomorphUtil.ClosestReachableEgg(pawn3);
                if (egg != null)
                {
                    eggDist = XenomorphUtil.DistanceBetween(pawn3.Position, egg.Position);
                }
                else
                {
                    return(false);
                }
                if (eggDist == 9999f || eggDist <= 5)
                {
                    return(false);
                }
                return(pawn3.Downed && pawn3.Faction != pawn.Faction && XenomorphUtil.isInfectablePawn(pawn3) && pawn.CanReserve(pawn3, 1, -1, null, false) && !pawn3.IsForbidden(pawn) && !GenAI.EnemyIsNear(pawn3, 25f));
            };
            Pawn pawn2 = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), this.radius, validator, null, 0, -1, false, RegionType.Set_Passable, false);

            if (pawn2 == null)
            {
                return(null);
            }
            Thing thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(XenomorphDefOf.RRY_EggXenomorphFertilized), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 9999f, null, null, 0, -1, false, RegionType.Set_Passable, false);

            if (thing == null)
            {
                return(null);

                thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForDef(XenomorphDefOf.RRY_EggXenomorphFertilized), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 9999f, null, null, 0, -1, false, RegionType.Set_Passable, false);
                if (thing == null)
                {
                    return(null);
                }
            }
            return(new Job(XenomorphDefOf.RRY_Job_XenomorphKidnap, pawn2, thing)
            {
                count = 1
            });
        }
예제 #6
0
        // Token: 0x060009B3 RID: 2483 RVA: 0x0004DFD8 File Offset: 0x0004C3D8
        protected override bool Satisfied(Pawn pawn)
        {
            bool result;

            if (pawn.Spawned && XenomorphUtil.IsXenomorph(pawn) && pawn.Map.mapPawns.AllPawns.Any((Pawn x) => x.Downed && x.isPotentialHost() && pawn.CanReach(x, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)))
            {
                List <Pawn> list = pawn.Map.mapPawns.AllPawns.Where((Pawn x) => x.Downed && x.isPotentialHost() && pawn.CanReach(x, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)).ToList();
                result = !list.NullOrEmpty() ? list.Any <Pawn>(x => x.Spawned) : false;
            }
            else
            {
                result = false;
            }
            if (pawn.jobs.debugLog)
            {
                pawn.jobs.DebugLogEvent(string.Format("{0} Result: {1}", this, result));
            }
            return(result);
        }
        // Token: 0x060009B3 RID: 2483 RVA: 0x0004DFD8 File Offset: 0x0004C3D8
        protected override bool Satisfied(Pawn pawn)
        {
            bool result;

            if (pawn.Spawned && XenomorphUtil.IsXenomorph(pawn))
            {
                List <Pawn> list = pawn.Map.mapPawns.AllPawns.Where((Pawn x) => x.RaceProps.FleshType != XenomorphRacesDefOf.RRY_Xenomorph && x.RaceProps.FleshType != XenomorphRacesDefOf.RRY_Neomorph && !x.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned) && x.Downed && XenomorphUtil.isInfectablePawn(x) && pawn.CanReach(x, PathEndMode.InteractionCell, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)).ToList();
                result = !list.NullOrEmpty() ? list.Any <Pawn>(x => x.Spawned) : false;
            }
            else
            {
                result = false;
            }
            if (Find.Selector.SelectedObjects.Contains(pawn))
            {
                Log.Message(string.Format("{0} Result: {1}", this, result));
            }
            return(result);
        }
예제 #8
0
        // Token: 0x060005B7 RID: 1463 RVA: 0x00037A28 File Offset: 0x00035E28
        protected override Job TryGiveJob(Pawn pawn)
        {
            Comp_Facehugger _Facehugger = pawn.TryGetComp <Comp_Facehugger>();
            bool            selected    = Find.Selector.SingleSelectedThing == pawn;

            if (pawn.TryGetAttackVerb(null, false) == null)
            {
                return(null);
            }
            Pawn pawn2 = FindPawnTarget(pawn);

            //    Pawn pawn2 = BestPawnToHuntForPredator(pawn, forceScanWholeMap);
            if (pawn2 != null && !pawn2.Dead && _Facehugger.Impregnations < _Facehugger.maxImpregnations && XenomorphUtil.isInfectablePawn(pawn2) && pawn.CanReach(pawn2, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn))
            {
#if DEBUG
                //    if (selected) Log.Message(string.Format("{0}@{1} hunting {2}@{3}", pawn.Label, pawn.Position, pawn2.Label, pawn2.Position));
#endif
                return(this.MeleeAttackJob(pawn, pawn2));
            }
            if (pawn2 != null && XenomorphUtil.isInfectablePawn(pawn2))
            {
                using (PawnPath pawnPath = pawn.Map.pathFinder.FindPath(pawn.Position, pawn2.Position, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassDoors, false), PathEndMode.OnCell))
                {
                    if (!pawnPath.Found)
                    {
                        return(null);
                    }
                    if (!pawnPath.TryFindLastCellBeforeBlockingDoor(pawn, out IntVec3 loc))
                    {
                        //    Log.Error(pawn + " did TryFindLastCellBeforeDoor but found none when it should have been one. Target: " + pawn2.LabelCap, false);
                        return(null);
                    }
                    IntVec3 randomCell = CellFinder.RandomRegionNear(loc.GetRegion(pawn.Map, RegionType.Set_Passable), 9, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.ByPawn, false), null, null, RegionType.Set_Passable).RandomCell;
                    if (randomCell == pawn.Position)
                    {
                        return(new Job(JobDefOf.Wait, 30, false));
                    }
                    return(new Job(JobDefOf.Goto, randomCell));
                }
            }
            return(null);
        }
예제 #9
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }
            IntVec3 hiveCell;

            if (!XenomorphUtil.ClosestReachableParentHivelike(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableParentHivelike(pawn).Position;
            }
            else if (!XenomorphUtil.ClosestReachableHiveSlime(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableHiveSlime(pawn).Position;
            }
            else
            {
                hiveCell = pawn.mindState.duty.focus.Cell;
            }
            for (int i = 0; i < 40; i++)
            {
                IntVec3 randomCell = region.RandomCell;

                for (int j = 0; j < 8; j++)
                {
                    IntVec3 c = randomCell + GenAdj.AdjacentCellsAround[j];
                    if (c.InBounds(pawn.Map))
                    {
                        Thing thing = c.GetFirstHaulable(pawn.Map);
                        //    Log.Message(string.Format("thing: {0}", thing));
                        if (thing != null && (thing.def.passability == Traversability.Impassable || thing.def.IsDoor) && thing.def.size == IntVec2.One && thing.def != ThingDefOf.CollapsedRocks && pawn.CanReserve(thing, 1, -1, null, false) && XenomorphUtil.DistanceBetween(thing.Position, pawn.mindState.duty.focus.Cell) >= minClearingRange && XenomorphUtil.DistanceBetween(thing.Position, pawn.mindState.duty.focus.Cell) <= maxClearingRange)
                        {
                            return(XenomorphUtil.HaulAsideJobFor(pawn, thing, hiveCell, maxClearingRange));
                        }
                    }
                }
            }
            return(null);
        }
 // Token: 0x060009B3 RID: 2483 RVA: 0x0004DFD8 File Offset: 0x0004C3D8
 protected override bool Satisfied(Pawn pawn)
 {
     if (pawn.Spawned && pawn.isXenomorph())
     {
         List <Pawn> list = pawn.Map.mapPawns.AllPawns.Where(x => !x.Downed && x.isPotentialHost() && pawn.CanReach(x, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)).ToList();
         if (!list.NullOrEmpty())
         {
             if (pawn.jobs.debugLog)
             {
                 pawn.jobs.DebugLogEvent(string.Format("List is {0} long", list.Count));
             }
             flagSpawned   = list.Any <Pawn>(x => x.Spawned);
             flagLOS       = (this.NeedsLOS && list.Any <Pawn>(x => pawn.CanSee(x))) || (!this.NeedsLOS);
             flagPawnRange = list.Any <Pawn>(x => XenomorphUtil.DistanceBetween(pawn.Position, x.Position) <= this.RangePawn);
             if (Tunnel(pawn) != null)
             {
                 IntVec3 vec3 = Tunnel(pawn).Position;
                 flagHiveRange = list.Any <Pawn>(x => XenomorphUtil.DistanceBetween(vec3, x.Position) <= this.RangeHive);
             }
             flagRange = flagPawnRange || flagHiveRange;
             result    = (flagSpawned && flagLOS && flagRange);
         }
         else
         {
             if (pawn.jobs.debugLog)
             {
                 pawn.jobs.DebugLogEvent(string.Format("List is null or empty"));
             }
         }
     }
     if (pawn.jobs.debugLog)
     {
         pawn.jobs.DebugLogEvent(string.Format("{0} Result: {1}, flagSpawned: {2}, flagLOS: {3}, flagPawnRange: {4}, flagHiveRange: {5}, flagRange: {6}", this, result, flagSpawned, flagLOS, flagPawnRange, flagHiveRange, flagRange));
     }
     return(result);
 }
예제 #11
0
 // Token: 0x060009B9 RID: 2489 RVA: 0x0004E0A3 File Offset: 0x0004C4A3
 protected override bool Satisfied(Pawn pawn)
 {
     if (Find.Selector.SelectedObjects.Contains(pawn))
     {
         Log.Message(string.Format("{0} needs > {2}, Found: {3} Result: {1}", this, pawn.Map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x)).Count < this.victimCount || pawn.Map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x)).NullOrEmpty(), victimCount, pawn.Map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x)).Count));
     }
     return(pawn.Map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x)).Count > this.victimCount || pawn.Map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x)).NullOrEmpty());
 }
예제 #12
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            List <IntVec3> HiveStruct = new List <IntVec3>()
            {
                // Support Collums
                // Cardinals
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z + 3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z - 3
                },
                // Corners
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                }
            };
            List <IntVec3> HiveWalls = new List <IntVec3>()
            {
                // Exterior Walls
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + 1
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + 3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + 4
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + -1
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + -2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 6,
                    z = pawn.mindState.duty.focus.Cell.z + -3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + -4
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + 1
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + 3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + 4
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + -1
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + -2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + -3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -6,
                    z = pawn.mindState.duty.focus.Cell.z + -4
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 1,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 3,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 4,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -1,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -2,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -3,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -4,
                    z = pawn.mindState.duty.focus.Cell.z + 6
                },
                //
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 1,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 3,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 4,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -1,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -2,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -3,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + -4,
                    z = pawn.mindState.duty.focus.Cell.z + -6
                },
                //
            };
            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }
            if (pawn.mindState.duty.focus.Cell == pawn.InteractionCell)
            {
                return(null);
            }
            bool flag1 = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_XenomorphHive) != null;
            bool flag2 = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_XenomorphHive_Child) != null;
            bool flag3 = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Hive_Slime) != null;

            if (pawn.GetLord() is Lord L && L != null)
            {
                if ((L.CurLordToil is LordToil_DefendAndExpandHiveLike || L.CurLordToil is LordToil_DefendHiveLikeAggressively) && L.CurLordToil is LordToil_HiveLikeRelated THL)
                {
                    if (THL != null)
                    {
                        if (THL.Data != null)
                        {
                            HiveLike hive = THL.Data.assignedHiveLikes.TryGetValue(pawn);
                            if (hive != null)
                            {
                                flag1 = hive.def == XenomorphDefOf.RRY_XenomorphHive;
                                flag2 = hive.def == XenomorphDefOf.RRY_XenomorphHive_Child;
                            }
                        }
                    }
                }
            }
            if ((!flag1 && !flag2 && !flag3))
            {
                return(null);
            }
            if (flag2)
            {
                MiningRange = 3;
            }
            for (int i = 0; i < 40; i++)
            {
                IntVec3 randomCell = HiveStruct.RandomElement();
                for (int j = 0; j < 4; j++)
                {
                    IntVec3 c = randomCell;// + GenAdj.CardinalDirections[j];
                    if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map))
                    {
                        Building edifice = c.GetEdifice(pawn.Map);
                        if (edifice == null && XenomorphUtil.DistanceBetween(c, pawn.mindState.duty.focus.Cell) <= MiningRange)
                        {
                            return(new Job(XenomorphDefOf.RRY_Job_ConstructHiveWall, c)
                            {
                                ignoreDesignations = true
                            });
                        }

                        /*
                         * else if (edifice==null)
                         * {
                         *  if (!pillarLoc.Contains(edifice.Position))
                         *  {
                         *      return new Job(JobDefOf.Mine, edifice)
                         *      {
                         *          ignoreDesignations = true
                         *      };
                         *  }
                         * }
                         */
                    }
                }
                if (flag1)
                {
                    randomCell = HiveWalls.RandomElement();
                    for (int j = 0; j < 4; j++)
                    {
                        IntVec3 c = randomCell;// + GenAdj.CardinalDirections[j];
                        if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map))
                        {
                            Building edifice = c.GetEdifice(pawn.Map);
                            if (edifice == null && XenomorphUtil.DistanceBetween(c, pawn.mindState.duty.focus.Cell) <= MiningRange)
                            {
                                return(new Job(XenomorphDefOf.RRY_Job_ConstructHiveWall, c)
                                {
                                    ignoreDesignations = false
                                });
                            }

                            /*
                             * else if (edifice==null)
                             * {
                             *  if (!pillarLoc.Contains(edifice.Position))
                             *  {
                             *      return new Job(JobDefOf.Mine, edifice)
                             *      {
                             *          ignoreDesignations = true
                             *      };
                             *  }
                             * }
                             */
                        }
                    }
                }
            }
            return(null);
        }
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54

        protected override Job TryGiveJob(Pawn pawn)
        {
            if (!pawn.isXenomorph(out Comp_Xenomorph _Xenomorph))
            {
                return(null);
            }
            if (pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Queen && pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Drone && pawn.def != XenomorphRacesDefOf.RRY_Xenomorph_Predalien)
            {
                return(null);
            }
            Map     map        = pawn.Map;
            IntVec3 pos        = pawn.Position;
            IntVec3 HiveCenter = _Xenomorph.HiveLoc;
            Region  region     = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }
            if (HiveCenter == pawn.InteractionCell)
            {
                return(null);
            }
            bool centerNode   = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive) != null;
            bool centerChild  = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Child) != null;
            bool centerSlime  = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Slime) != null;
            bool centerFilled = HiveCenter.Filled(pawn.Map);

            if (centerNode)
            {
                MiningRange = 6;
            }
            else
            {
                MiningRange = 3;
                if (!centerChild)
                {
                    if (pawn.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen || pawn.def == XenomorphRacesDefOf.RRY_Xenomorph_Drone)
                    {
                        if (!centerNode)
                        {
                            IntVec3 c = HiveCenter;
                            if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map) && pawn.CanReserveAndReach(c, PathEndMode.OnCell, Danger.Deadly))
                            {
                                return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Node, c)
                                {
                                    ignoreDesignations = false
                                });
                            }
                        }
                        return(null);
                    }
                }
            }
            if (!centerChild)
            {
                foreach (var structure in HiveStructure.HiveStruct(HiveCenter).Where(x => x.GetThingList(map).Any(z => !z.def.defName.Contains("RRY_Xenomorph_Hive")) && x.DistanceTo(HiveCenter) <= MiningRange && pawn.CanReserveAndReach(x, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor) && x.GetFirstBuilding(map) == null))
                {
                    return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Wall, structure)
                    {
                        ignoreDesignations = false
                    });
                }
                foreach (var structure in HiveStructure.HiveWallGen(HiveCenter, MiningRange).Where(x => x.GetThingList(map).Any(z => !z.def.defName.Contains("RRY_Xenomorph_Hive")) && x.DistanceTo(HiveCenter) <= MiningRange + 2 && pawn.CanReserveAndReach(x, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor) && x.GetFirstBuilding(map) == null))
                {
                    return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Wall, structure)
                    {
                        ignoreDesignations = false
                    });
                }
                Predicate <IntVec3> validator2 = delegate(IntVec3 y)
                {
                    bool roofed = (y.Roofed(pawn.Map));
                    bool result = !roofed && XenomorphUtil.DistanceBetween(y, HiveCenter) <= MiningRange && pawn.CanReserveAndReach(y, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Ceiling);
                    return(result);
                };
                if (RCellFinder.TryFindRandomCellNearWith(HiveCenter, validator2, pawn.Map, out IntVec3 c2, MiningRange, MiningRange))
                {
                    if (c2.InBounds(pawn.Map) && pawn.CanReserveAndReach(c2, PathEndMode.OnCell, Danger.Deadly))
                    {
                        return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Construct_Hive_Roof, c2)
                        {
                            ignoreDesignations = false
                        });
                    }
                }
            }
            return(null);
        }
 public static bool isPotentialHost(this ThingDef p)
 {
     return(XenomorphUtil.isInfectableThing(p) && !p.isXenomorph() && !p.isNeomorph());
 }
        public static bool isPotentialHost(this Thing t)
        {
            Pawn p = (Pawn)t;

            return(XenomorphUtil.isInfectablePawn(p) && !p.isXenomorph() && !p.isNeomorph() && p.health.hediffSet.HasHead);
        }
예제 #16
0
 // Token: 0x06000880 RID: 2176 RVA: 0x000475D8 File Offset: 0x000459D8
 private HiveLike FindClosestHiveLike(Pawn pawn)
 {
     return((HiveLike)XenomorphUtil.ClosestReachableHivelike(pawn));
 }
        public override void DoSettingsWindowContents(Rect inRect)
        {
            /*
             * this.settings.astartePunchingFactor = Widgets.HorizontalSlider(
             *  inRect.TopHalf().TopHalf().TopHalf().ContractedBy(4),
             *  this.settings.astartePunchingFactor, 0f, 5f, true,
             *  "Astarte Punching Power : " + this.settings.astartePunchingFactor * 100 +
             *  "% : [" + 15f * this.settings.astartePunchingFactor + "]\nDefault possible in single attack (Punch 15 at 100%)"
             *  , "0%", "500%");
             *
             * this.settings.astarteSplitFactor = Widgets.HorizontalSlider(
             *  inRect.TopHalf().TopHalf().BottomHalf().ContractedBy(4),
             *  this.settings.astarteSplitFactor, 0f, 5f, true,
             *  "Astarte Spit Power : " + this.settings.astarteSplitFactor * 100 +
             *  "% : [" + 80f * this.settings.astarteSplitFactor +
             *  "]\nDefault possible in single attack (Caustic Spit 80 at 100%)"
             *  , "0%", "500%");
             *
             * this.settings.scale = Widgets.HorizontalSlider(inRect.TopHalf().BottomHalf().TopHalf().ContractedBy(4),
             *  this.settings.scale, 0f, 2f, true,
             *  "Astarte Size Scaler: " + this.settings.astartePunchingFactor * 100 +
             *  "% for size of " + 3f * this.settings.scale
             *  , "0%", "200%");
             *
             */

            Widgets.Label(inRect.TopHalf().TopHalf().TopHalf().TopHalf().ContractedBy(4),
                          "Restart before playing to ensure your changes take effect.");
            Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().TopHalf().BottomHalf().ContractedBy(4), "RRY_AllowYautjaFaction".Translate(), ref settings.AllowYautjaFaction);
            Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().BottomHalf().TopHalf().ContractedBy(4), "RRY_AllowXenomorphFaction".Translate(), ref settings.AllowXenomorphFaction);
            Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().BottomHalf().BottomHalf().LeftHalf().ContractedBy(4), "RRY_AllowHiddenInfections".Translate(), ref settings.AllowHiddenInfections);
            Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().BottomHalf().BottomHalf().RightHalf().ContractedBy(4), "RRY_AllowPredalienImpregnations".Translate(), ref settings.AllowHiddenInfections);

            this.settings.fachuggerRemovalFailureDeathChance = Widgets.HorizontalSlider(inRect.TopHalf().BottomHalf().TopHalf().TopHalf().ContractedBy(4),
                                                                                        this.settings.fachuggerRemovalFailureDeathChance, 0f, 1f, true,
                                                                                        "RRY_FacehuggerRemovalDeathChance".Translate(this.settings.fachuggerRemovalFailureDeathChance * 100)
                                                                                        , "0%", "100%");

            this.settings.embryoRemovalFailureDeathChance = Widgets.HorizontalSlider(inRect.TopHalf().BottomHalf().TopHalf().BottomHalf().ContractedBy(4),
                                                                                     this.settings.embryoRemovalFailureDeathChance, 0f, 1f, true,
                                                                                     "RRY_EmbryoRemovalDeathChance".Translate(this.settings.embryoRemovalFailureDeathChance * 100)
                                                                                     , "0%", "100%");

            //    Widgets.BeginScrollView(inRect.BottomHalf().BottomHalf().BottomHalf().LeftHalf().ContractedBy(4), ref );


            float           num              = 400f;
            float           x                = inRect.x;
            float           num2             = inRect.y;
            float           num3             = inRect.y;
            List <ThingDef> suitablehostDefs = DefDatabase <ThingDef> .AllDefsListForReading.FindAll(xx => XenomorphUtil.isInfectableThing(xx));

            Widgets.Label(inRect.TopHalf().BottomHalf().BottomHalf().BottomHalf().LeftHalf().ContractedBy(4), "RRY_SuitableHostKinds".Translate(suitablehostDefs.Count));
            Widgets.BeginScrollView(inRect.BottomHalf().LeftHalf().ContractedBy(4), ref this.pos, new Rect(inRect.x, inRect.y, num, suitablehostDefs.Count * 22f), true);
            foreach (ThingDef pkd in suitablehostDefs.OrderBy(xy => xy.label))
            {
                string text = pkd.LabelCap;

                /*
                 * text += " possible Xenoforms:";
                 * foreach (var item in pkd.resultingXenomorph())
                 * {
                 *  text += " "+item.LabelCap;
                 * }
                 */
                Widgets.Label(new Rect(x, num2, num, 32f), text);
                num2 += 22f;
            }
            Widgets.EndScrollView();
            List <PawnKindDef> WorthyKillDefs = DefDatabase <PawnKindDef> .AllDefsListForReading.FindAll(xx => YautjaBloodedUtility.WorthyKill(xx));

            Widgets.Label(inRect.TopHalf().BottomHalf().BottomHalf().BottomHalf().RightHalf().ContractedBy(4), "RRY_WorthyKillKinds".Translate(WorthyKillDefs.Count));
            Widgets.BeginScrollView(inRect.BottomHalf().RightHalf().ContractedBy(4), ref this.pos2, new Rect(inRect.x, inRect.y, num, WorthyKillDefs.Count * 22f), true);
            foreach (PawnKindDef pkd in WorthyKillDefs.OrderBy(xz => YautjaBloodedUtility.GetMark(xz).stages[0].label))
            {
                Widgets.Label(new Rect(x, num3, num, 32f), YautjaBloodedUtility.GetMark(pkd).stages[0].label + " : " + pkd.LabelCap);
                num3 += 22f;
            }
            Widgets.EndScrollView();

            /*
             * //    Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().BottomHalf().TopHalf().ContractedBy(4), "setting3: Desc", ref settings.setting3);
             * //    Widgets.CheckboxLabeled(inRect.TopHalf().TopHalf().BottomHalf().BottomHalf().ContractedBy(4), "setting4: Desc", ref settings.setting4);
             *
             * Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().TopHalf().TopHalf().ContractedBy(4), "setting5: Desc", ref settings.setting5);
             * Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().TopHalf().BottomHalf().ContractedBy(4), "setting6: Desc", ref settings.setting6);
             *
             * Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().BottomHalf().TopHalf().ContractedBy(4), "setting7: Desc", ref settings.setting7);
             * Widgets.CheckboxLabeled(inRect.TopHalf().BottomHalf().BottomHalf().BottomHalf().ContractedBy(4), "setting8: Desc", ref settings.setting8);
             */
            this.settings.Write();
        }
예제 #18
0
        // Token: 0x060005B9 RID: 1465 RVA: 0x00037BC0 File Offset: 0x00035FC0
        private Pawn FindPawnTarget(Pawn pawn)
        {
            bool        selected = Find.Selector.SingleSelectedThing == pawn;
            List <Pawn> list     = pawn.Map.mapPawns.AllPawns.Where((Pawn x) => !x.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned) && !x.Downed && XenomorphUtil.isInfectablePawn(x) && pawn.CanReach(x, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.NoPassClosedDoors) && !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Anesthetic) && ((requireLOS && pawn.CanSee(x)) || !requireLOS) && (this.Gender == Gender.None || (this.Gender != Gender.None && x.gender == this.Gender))).ToList();

            if (list.NullOrEmpty())
            {
                return(null);
            }
            return((Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.ClosestTouch, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), HuntingRange, (x => x is Pawn p && list.Contains(p))));//(Pawn)AttackTargetFinder.BestAttackTarget(pawn, TargetScanFlags.NeedReachable, (Thing x) => x is Pawn p && XenomorphUtil.isInfectablePawn(p) && !p.Downed, 0f, 9999f, default(IntVec3), float.MaxValue, true, true);
        }
예제 #19
0
        // Token: 0x06000860 RID: 2144 RVA: 0x00047694 File Offset: 0x00045A94
        public override void UpdateAllDuties()
        {
            QueenPresent = XenomorphUtil.QueenPresent(Map, out Pawn Queen);
            if (QueenPresent)
            {
                if (this.Data.HiveQueen.DestroyedOrNull())
                {
                    this.Data.HiveQueen = Queen;
                }
            }
            eggsPresent = XenomorphUtil.EggsPresent(Map);
            base.FilterOutUnspawnedHiveLikes();
            for (int i = 0; i < this.lord.ownedPawns.Count; i++)
            {
                Pawn     pawn = this.lord.ownedPawns[i];
                PawnDuty duty;
                if (XenomorphUtil.HivelikesPresent(Map))
                {
                    HiveLike hiveFor = base.GetHiveLikeFor(this.lord.ownedPawns[i]);
                    if (hiveFor.parentHiveLike != null)
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, hiveFor.parentHiveLike, this.distToHiveToAttack);
                        this.Data.HiveLoc = hiveFor.parentHiveLike.Position;
                    }
                    else if (hiveFor != null)
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, hiveFor, this.distToHiveToAttack);
                        this.Data.HiveLoc = hiveFor.Position;
                    }
                    else
                    {
                        //     Log.Message(string.Format("hives present but not found, we dun f****d up boss"));
                        duty = null;
                    }
                }
                else
                {
                    if (XenomorphUtil.HiveSlimePresent(Map))
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, XenomorphUtil.ClosestReachableHiveSlime(pawn), this.distToHiveToAttack);
                        this.Data.HiveLoc = XenomorphUtil.ClosestReachableHiveSlime(pawn).Position;
                    }
                    else if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out IntVec3 c))
                    {
                        duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, c, this.distToHiveToAttack);
                        this.Data.HiveLoc = c;
                    }
                    else
                    {
                        duty = null;
                    }

                    /*
                     * ThingDef named = pawn.RaceProps.Humanlike ? XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon : XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon;
                     * cocoonsPresent = XenomorphUtil.CocoonsPresent(pawn.Map, named);
                     * eggsReachable = !XenomorphUtil.ClosestReachableEgg(pawn).DestroyedOrNull();
                     * closestReachableEgg = XenomorphUtil.ClosestReachableEgg(pawn);
                     *
                     * hivelikesReachable = !XenomorphUtil.ClosestReachableHivelike(pawn).DestroyedOrNull();
                     * closestReachableHivelike = XenomorphUtil.ClosestReachableHivelike(pawn);
                     *
                     * cocoonsReachable = !XenomorphUtil.ClosestReachableCocoon(pawn, named).DestroyedOrNull();
                     * closestReachableCocoon = XenomorphUtil.ClosestReachableCocoon(pawn, named);
                     *
                     * if (XenomorphUtil.EggsPresent(Map))
                     * {
                     * //     Log.Message(string.Format("eggsPresent: {0}", closestReachableEgg.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, closestReachableEgg, this.distToHiveToAttack);
                     * }
                     * else if (cocoonsPresent)
                     * {
                     * //     Log.Message(string.Format("cocoonsPresent: {0}", closestReachableCocoon.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, closestReachableCocoon, this.distToHiveToAttack);
                     * }
                     * else if (myFocus.Cell != IntVec3.Zero)
                     * {
                     * //     Log.Message(string.Format("myFocus {0}", myFocus.Cell));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, myFocus, this.distToHiveToAttack);
                     * }
                     * else if (InfestationLikeCellFinder.TryFindCell(out IntVec3 c, Map, false))
                     * {
                     * //     Log.Message(string.Format("InfestationLikeCellFinder: {0}", c));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, c, this.distToHiveToAttack);
                     * }
                     * else
                     * {
                     * //     Log.Message(string.Format("pawn: {0}", pawn.Position));
                     *  duty = new PawnDuty(OGHiveLikeDefOf.RRY_DefendAndExpandHiveLike, pawn, this.distToHiveToAttack);
                     * }
                     */
                }
                this.lord.ownedPawns[i].mindState.duty = duty;
                if (duty != null)
                {
                    if (duty.focus != null && duty.focus != IntVec3.Invalid && duty.focus != IntVec3.Zero)
                    {
                        myFocus = duty.focus;
                    }
                }
            }
        }
예제 #20
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.Map == null)
            {
                //    Log.Message("map == null");
                return(null);
            }
            Map map = pawn.Map;

            if (!pawn.isXenomorph(out Comp_Xenomorph _Xenomorph))
            {
                //    Log.Message("not xenomorph");
                return(null);
            }
            IntVec3 HiveCenter = IntVec3.Invalid;

            if (_Xenomorph.HiveLoc.IsValid && _Xenomorph.HiveLoc.InBounds(map) && _Xenomorph.HiveLoc != IntVec3.Zero)
            {
                HiveCenter = _Xenomorph.HiveLoc;
            }
            else
            {
                //    Log.Message(string.Format("not _Xenomorph.HiveLoc({0})", _Xenomorph.HiveLoc));
                return(null);
            }

            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }
            bool flag1 = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive) != null;
            bool flag2 = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Child) != null;
            bool flag3 = HiveCenter.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Xenomorph_Hive_Slime) != null;

            if (pawn.GetLord() is Lord L && L != null)
            {
                if ((L.CurLordToil is LordToil_DefendAndExpandHiveLike || L.CurLordToil is LordToil_DefendHiveLikeAggressively) && L.CurLordToil is LordToil_HiveLikeRelated THL)
                {
                    if (THL != null)
                    {
                        if (THL.Data != null)
                        {
                            HiveLike hive = THL.Data.assignedHiveLikes.TryGetValue(pawn);
                            if (hive != null)
                            {
                                flag1 = hive.def == XenomorphDefOf.RRY_Xenomorph_Hive;
                                flag2 = hive.def == XenomorphDefOf.RRY_Xenomorph_Hive_Child;
                            }
                        }
                    }
                }
            }
            if (flag1)
            {
                MiningRange = 7;
            }
            else
            if (flag2)
            {
                MiningRange = 3;
            }
            else
            {
                MiningRange = 5;
            }
            if (!pawn.CanReachMapEdge())
            {
                MiningRange = 10;
            }
            for (int i = 0; i < GenRadial.NumCellsInRadius(MiningRange); i++)
            {
                IntVec3 c = HiveCenter + GenRadial.RadialPattern[i];
                if (!HiveStructure.HiveStruct(HiveCenter).Contains(c) && !HiveStructure.HiveWalls(HiveCenter).Contains(c) && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly))
                {
                    Building edifice = c.GetEdifice(pawn.Map);
                    if (edifice != null && edifice.def.size == IntVec2.One && edifice.def != ThingDefOf.CollapsedRocks && edifice.def != XenomorphDefOf.RRY_Xenomorph_Hive_Wall && pawn.CanReserveAndReach(edifice, PathEndMode.ClosestTouch, Danger.Deadly, 1, 1) && XenomorphUtil.DistanceBetween(edifice.Position, HiveCenter) <= MiningRange)
                    {
                        bool xenobuilding = edifice.GetType() != typeof(Building_XenoEgg) && edifice.GetType() != typeof(Building_XenomorphCocoon) && edifice.GetType() != typeof(HiveLike);
                        if (xenobuilding)
                        {
                            return(new Job(JobDefOf.Mine, edifice)
                            {
                                ignoreDesignations = true
                            });
                        }
                    }
                }
            }

            return(null);
        }
        // RimWorld.FoodUtility
        private static Pawn BestPawnToHuntForPredator(Pawn predator, bool forceScanWholeMap)
        {
            if (predator.meleeVerbs.TryGetMeleeVerb(null) == null)
            {
                return(null);
            }
            bool  flag = false;
            float summaryHealthPercent = predator.health.summaryHealth.SummaryHealthPercent;

            if (summaryHealthPercent < 0.25f)
            {
                flag = true;
            }
            tmpPredatorCandidates.Clear();
            int maxRegionsToScan = GetMaxRegionsToScan(predator, forceScanWholeMap);

            if (maxRegionsToScan < 0)
            {
                tmpPredatorCandidates.AddRange(predator.Map.mapPawns.AllPawnsSpawned);
            }
            else
            {
                TraverseParms traverseParms = TraverseParms.For(predator, Danger.Deadly, TraverseMode.ByPawn, false);
                RegionTraverser.BreadthFirstTraverse(predator.Position, predator.Map, (Region from, Region to) => to.Allows(traverseParms, true), delegate(Region x)
                {
                    List <Thing> list = x.ListerThings.ThingsInGroup(ThingRequestGroup.Pawn);
                    for (int j = 0; j < list.Count; j++)
                    {
                        Pawn p = ((Pawn)list[j]);
                        if (p.isPotentialHost())
                        {
                            tmpPredatorCandidates.Add(p);
                        }
                        else
                        {
                            if (predator.jobs.debugLog)
                            {
                                predator.jobs.DebugLogEvent(string.Format("{0} cannae hunt {2} XenoInfection:{1} IsXenos:{3}", predator.Label, XenomorphUtil.IsInfectedPawn(p), ((Pawn)list[j]).Label, XenomorphUtil.IsXenomorph(p)));
                            }
                        }
                    }
                    return(false);
                }, 999999, RegionType.Set_Passable);
            }
            Pawn  pawn         = null;
            float num          = 0f;
            bool  tutorialMode = TutorSystem.TutorialMode;

            for (int i = 0; i < tmpPredatorCandidates.Count; i++)
            {
                Pawn pawn2 = tmpPredatorCandidates[i];
                if (predator.GetRoom(RegionType.Set_Passable) == pawn2.GetRoom(RegionType.Set_Passable))
                {
                    if (predator != pawn2)
                    {
                        if (!flag || pawn2.Downed)
                        {
                            if (IsAcceptablePreyFor(predator, pawn2))
                            {
                                if (predator.CanReach(pawn2, PathEndMode.ClosestTouch, Danger.Deadly, false, TraverseMode.ByPawn))
                                {
                                    if (!pawn2.IsForbidden(predator))
                                    {
                                        if (!tutorialMode || pawn2.Faction != Faction.OfPlayer)
                                        {
                                            float preyScoreFor = FoodUtility.GetPreyScoreFor(predator, pawn2);
                                            if (preyScoreFor > num || pawn == null)
                                            {
                                                num  = preyScoreFor;
                                                pawn = pawn2;
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            }
            tmpPredatorCandidates.Clear();
            return(pawn);
        }
예제 #22
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            if (pawn.Map == null)
            {
                return(null);
            }
            Map map = pawn.Map;

            if (!pawn.isXenomorph(out Comp_Xenomorph _Xenomorph))
            {
                return(null);
            }

            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }

            IntVec3 hiveCell;

            if (!XenomorphUtil.ClosestReachableParentHivelike(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableParentHivelike(pawn).Position;
            }
            else if (!XenomorphUtil.ClosestReachableHiveSlime(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableHiveSlime(pawn).Position;
            }
            else
            {
                hiveCell = _Xenomorph.HiveLoc == IntVec3.Invalid || _Xenomorph.HiveLoc == IntVec3.Zero || !_Xenomorph.HiveLoc.InBounds(map) ? pawn.mindState.duty.focus.Cell : _Xenomorph.HiveLoc;
            }
            if (hiveCell == IntVec3.Invalid || hiveCell == IntVec3.Zero || !hiveCell.InBounds(map))
            {
                return(null);
            }
            foreach (var c in GenAdj.AdjacentCellsAndInside)
            {
                if ((hiveCell + c).GetFirstHaulable(pawn.Map) is Thing h && !(h is Pawn) && !(h is Building_XenoEgg) && !(h is Building_XenomorphCocoon))
                {
                    if (pawn.jobs.debugLog)
                    {
                        pawn.jobs.DebugLogEvent(string.Format("{0} TryGiveJob {1} @ {2} 1", this, pawn.LabelShortCap, (hiveCell + c)));
                    }
                    if (pawn.CanReserve(h, 1, -1, null, false))
                    {
                        if (pawn.jobs.debugLog)
                        {
                            pawn.jobs.DebugLogEvent(string.Format("{0} TryGiveJob {1} @ {2} 2", this, pawn.LabelShortCap, (hiveCell + c)));
                        }
                        if (!XenomorphUtil.CanHaulAside(pawn, h, hiveCell, ClearingRange, out IntVec3 c2))
                        {
                            if (pawn.jobs.debugLog)
                            {
                                pawn.jobs.DebugLogEvent(string.Format("{0} TryGiveJob {1} @ {2} 3", this, pawn.LabelShortCap, (hiveCell + c)));
                            }
                            return(null);
                        }
                        if (pawn.jobs.debugLog)
                        {
                            pawn.jobs.DebugLogEvent(string.Format("{0} TryGiveJob {1} @ {2} 4", this, pawn.LabelShortCap, (hiveCell + c)));
                        }
                        return(new Job(JobDefOf.HaulToCell, h, c2)
                        {
                            count = 99999,
                            haulOpportunisticDuplicates = false,
                            haulMode = HaulMode.ToCellNonStorage,
                            ignoreDesignations = true
                        });
                    }
                }
            }
            return(null);
        }
 public static bool isPotentialHost(this Pawn p, out string failReason)
 {
     failReason = string.Empty;
     if (!p.health.hediffSet.HasHead)
     {
         failReason = "HasHead";
         return(false);
     }
     if (p.isNeomorph())
     {
         failReason = "isNeomorph";
         return(false);
     }
     if (p.isXenomorph())
     {
         failReason = "isXenomorph";
         return(false);
     }
     if (p.Dead)
     {
         failReason = "Dead";
         return(false);
     }
     if (UtilChjAndroids.ChjAndroid)
     {
         if (p.kindDef.race.defName == "ChjAndroid" || p.kindDef.race.defName == "ChjDroid")
         {
             failReason = "ChjAndroid";
             return(false);
         }
     }
     if (UtilTieredAndroids.TieredAndroid)
     {
         if (p.kindDef.race.defName.Contains("Android" + "Tier"))
         {
             failReason = "TieredAndroid";
             return(false);
         }
     }
     if (p.RaceProps.body.defName.Contains("AIRobot"))
     {
         failReason = "AIRobot";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("Android"))
     {
         failReason = "Android";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("Droid"))
     {
         failReason = "Droid";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("Mech"))
     {
         failReason = "Mech";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("TM_Undead"))
     {
         failReason = "TM_Undead";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("TM_StoneFlesh"))
     {
         failReason = "TM_StoneFlesh";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("TM_") && p.kindDef.race.defName.Contains("Minion"))
     {
         failReason = "TM_Minion";
         return(false);
     }
     if (p.kindDef.race.defName.Contains("TM_Demon"))
     {
         failReason = "TM_Demon";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("ChaosDeamon"))
     {
         failReason = "ChaosDeamon";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("Necron"))
     {
         failReason = "Necron";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("EldarConstruct"))
     {
         failReason = "EldarConstruct";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("ImperialConstruct"))
     {
         failReason = "ImperialConstruct";
         return(false);
     }
     if (p.kindDef.race.race.FleshType.defName.Contains("MechanicusConstruct"))
     {
         failReason = "MechanicusConstruct";
         return(false);
     }
     if (p.RaceProps.IsMechanoid)
     {
         failReason = "IsMechanoid";
         return(false);
     }
     if (!p.RaceProps.IsFlesh)
     {
         failReason = "notFlesh";
         return(false);
     }
     if (p.isHost())
     {
         failReason = "isHost";
         if (p.isNeoHost())
         {
             failReason = "isHostNeo";
         }
         if (p.isXenoHost())
         {
             failReason = "isHostXeno";
         }
         return(false);
     }
     if (XenomorphUtil.IsXenomorphFaction(p))
     {
         failReason = "IsXenomorphFaction";
         return(false);
     }
     if (p.BodySize < 0.65f && !p.RaceProps.Humanlike)
     {
         failReason = "NonhumanlikeTooSmall";
         return(false);
     }
     return(true);
 }
예제 #24
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            Map            map       = pawn.Map;
            List <IntVec3> pillarLoc = new List <IntVec3>()
            {
                // Cardinals
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z + 3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z - 3
                },
                // Corners
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                }
            };
            Region region = pawn.GetRegion(RegionType.Set_Passable);
            bool   flag1  = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_XenomorphHive) != null;
            bool   flag2  = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_XenomorphHive_Child) != null;
            bool   flag3  = pawn.mindState.duty.focus.Cell.GetFirstThing(pawn.Map, XenomorphDefOf.RRY_Hive_Slime) != null;

            if (pawn.GetLord() is Lord L && L != null)
            {
                if ((L.CurLordToil is LordToil_DefendAndExpandHiveLike || L.CurLordToil is LordToil_DefendHiveLikeAggressively) && L.CurLordToil is LordToil_HiveLikeRelated THL)
                {
                    if (THL != null)
                    {
                        if (THL.Data != null)
                        {
                            HiveLike hive = THL.Data.assignedHiveLikes.TryGetValue(pawn);
                            if (hive != null)
                            {
                                flag1 = hive.def == XenomorphDefOf.RRY_XenomorphHive;
                                flag2 = hive.def == XenomorphDefOf.RRY_XenomorphHive_Child;
                            }
                        }
                    }
                }
            }
            if (region == null)
            {
                return(null);
            }
            if (flag2)
            {
                MiningRange = 3;
            }
            for (int i = 0; i < GenRadial.NumCellsInRadius(MiningRange); i++)
            {
                IntVec3 c = pawn.mindState.duty.focus.Cell + GenRadial.RadialPattern[MiningRange];
                if (!pillarLoc.Contains(c))
                {
                    Building edifice = c.GetEdifice(pawn.Map);
                    if (edifice != null && (edifice.def.passability == Traversability.Impassable /* || edifice.def.IsDoor */) && edifice.def.size == IntVec2.One && edifice.def != ThingDefOf.CollapsedRocks && edifice.def != XenomorphDefOf.RRY_Xenomorph_HiveWall && pawn.CanReserve(edifice, 1, -1, null, false) && XenomorphUtil.DistanceBetween(edifice.Position, pawn.mindState.duty.focus.Cell) <= MiningRange)
                    {
                        if (!pillarLoc.Contains(edifice.Position))
                        {
                            return(new Job(JobDefOf.Mine, edifice)
                            {
                                ignoreDesignations = true
                            });
                        }
                    }
                }
            }

            return(null);
        }
 public static bool isPotentialHost(this PawnKindDef p)
 {
     return(XenomorphUtil.isInfectablePawnKind(p) && !p.isXenomorph() && !p.isNeomorph());
 }
예제 #26
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            List <IntVec3> pillarLoc = new List <IntVec3>()
            {
                // Cardinals
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 3,
                    z = pawn.mindState.duty.focus.Cell.z
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z + 3
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x,
                    z = pawn.mindState.duty.focus.Cell.z - 3
                },
                // Corners
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z + 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x + 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                },
                new IntVec3
                {
                    x = pawn.mindState.duty.focus.Cell.x - 2,
                    z = pawn.mindState.duty.focus.Cell.z - 2
                }
            };
            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }
            for (int i = 0; i < 40; i++)
            {
                IntVec3 randomCell = region.RandomCell;
                for (int j = 0; j < 4; j++)
                {
                    IntVec3 c = randomCell + GenAdj.CardinalDirections[j];
                    if (c.InBounds(pawn.Map) && c.Roofed(pawn.Map))
                    {
                        Building edifice = c.GetEdifice(pawn.Map);
                        if (edifice != null && (edifice.def.passability == Traversability.Impassable || edifice.def.IsDoor) && edifice.def.size == IntVec2.One && edifice.def != ThingDefOf.CollapsedRocks && edifice.def != XenomorphDefOf.RRY_Xenomorph_HiveWall && pawn.CanReserve(edifice, 1, -1, null, false) && XenomorphUtil.DistanceBetween(edifice.Position, pawn.mindState.duty.focus.Cell) <= MiningRange)
                        {
                            if (!pillarLoc.Contains(edifice.Position))
                            {
                                return(new Job(JobDefOf.Mine, edifice)
                                {
                                    ignoreDesignations = true
                                });
                            }
                        }

                        /*
                         * else if (edifice==null)
                         * {
                         *  if (!pillarLoc.Contains(edifice.Position))
                         *  {
                         *      return new Job(JobDefOf.Mine, edifice)
                         *      {
                         *          ignoreDesignations = true
                         *      };
                         *  }
                         * }
                         */
                    }
                }
            }
            return(null);
        }
예제 #27
0
 // Token: 0x06002676 RID: 9846 RVA: 0x0012417C File Offset: 0x0012257C
 public override void Tick()
 {
     base.Tick();
     if (base.Spawned)
     {
         this.FilterOutUnspawnedPawns();
         if (!this.active && !base.Position.Fogged(base.Map) && canSpawnPawns)
         {
             this.Activate();
         }
         if (this.active && Find.TickManager.TicksGame >= this.nextPawnSpawnTick)
         {
             if (this.SpawnedPawnsPoints < MaxSpawnedPawnsPoints)
             {
                 bool flag = this.TrySpawnPawn(out Pawn pawn);
                 if (flag && pawn.caller != null)
                 {
                     pawn.caller.DoCall();
                 }
             }
             this.CalculateNextPawnSpawnTick();
         }
         if (this.Map.skyManager.CurSkyGlow < 0.5f && this.active)
         {
             if (this.innerContainer != null)
             {
                 if ((this.innerContainer.Count == 1 && !this.innerContainer.Any(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen)) || this.innerContainer.Count > 1)
                 {
                     this.innerContainer.TryDropAll(this.Position, this.Map, ThingPlaceMode.Near, null, null);
                 }
             }
         }
         if (!this.innerContainer.NullOrEmpty())
         {
             if (hiveMaintainer != null)
             {
                 if (this.innerContainer.Count > 0 && hiveMaintainer.CurStage == MaintainableStage.NeedsMaintenance)
                 {
                     Thing thing = this.innerContainer.RandomElement();
                     this.innerContainer.TryDrop(thing, ThingPlaceMode.Near, out thing);
                 }
             }
             if (Find.TickManager.TicksGame % 10000 == 0)
             {
                 Thing thing = GenClosest.ClosestThingReachable(this.Position, this.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), Verse.AI.PathEndMode.ClosestTouch, TraverseParms.For(TraverseMode.ByPawn, Danger.Deadly), 30f, (x => x.isPotentialHost()));
                 if (this.innerContainer.Count > 0 && !thing.DestroyedOrNull())
                 {
                     Pawn p = (Pawn)thing;
                     for (int i = 0; i < this.innerContainer.Count; i++)
                     {
                         Thing thing2 = this.innerContainer[i];
                         float chance = p.RaceProps.baseBodySize * p.ageTracker.CurLifeStage.bodySizeFactor / XenomorphUtil.DistanceBetween(this.Position, p.Position) * this.innerContainer.Count;
                         if (Rand.ChanceSeeded(chance, AvPConstants.AvPSeed))
                         {
                             this.innerContainer.TryDrop(thing2, ThingPlaceMode.Near, out thing2);
                         }
                     }
                 }
             }
         }
     }
 }
예제 #28
0
        // Token: 0x0600041E RID: 1054 RVA: 0x0002CA54 File Offset: 0x0002AE54
        protected override Job TryGiveJob(Pawn pawn)
        {
            Region region = pawn.GetRegion(RegionType.Set_Passable);

            if (region == null)
            {
                return(null);
            }

            IntVec3 hiveCell;

            if (!XenomorphUtil.ClosestReachableParentHivelike(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableParentHivelike(pawn).Position;
            }
            else if (!XenomorphUtil.ClosestReachableHiveSlime(pawn).DestroyedOrNull())
            {
                hiveCell = XenomorphUtil.ClosestReachableHiveSlime(pawn).Position;
            }
            else
            {
                hiveCell = pawn.mindState.duty.focus.Cell;
            }
            foreach (var c in GenAdj.AdjacentCellsAndInside)
            {
                if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode)
                {
                    Log.Message(string.Format("{0} TryGiveJob {1} @ {2}", this, pawn.LabelShortCap, (hiveCell + c)));
                }
                if ((hiveCell + c).GetFirstHaulable(pawn.Map) is Thing h && !(h is Pawn) && !(h is Building_XenoEgg) && !(h is Building_XenomorphCocoon))
                {
                    if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode)
                    {
                        Log.Message(string.Format("{0} TryGiveJob {1} @ {2} 1", this, pawn.LabelShortCap, (hiveCell + c)));
                    }
                    if (pawn.CanReserve(h, 1, -1, null, false))
                    {
                        if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode)
                        {
                            Log.Message(string.Format("{0} TryGiveJob {1} @ {2} 2", this, pawn.LabelShortCap, (hiveCell + c)));
                        }
                        if (!XenomorphUtil.CanHaulAside(pawn, h, hiveCell, ClearingRange, out IntVec3 c2))
                        {
                            if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode)
                            {
                                Log.Message(string.Format("{0} TryGiveJob {1} @ {2} 3", this, pawn.LabelShortCap, (hiveCell + c)));
                            }
                            return(null);
                        }
                        if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode)
                        {
                            Log.Message(string.Format("{0} TryGiveJob {1} @ {2} 4", this, pawn.LabelShortCap, (hiveCell + c)));
                        }
                        return(new Job(JobDefOf.HaulToCell, h, c2)
                        {
                            count = 99999,
                            haulOpportunisticDuplicates = false,
                            haulMode = HaulMode.ToCellNonStorage,
                            ignoreDesignations = true
                        });
                    }
                }
            }
            return(null);
        }
예제 #29
0
        // Token: 0x060005B9 RID: 1465 RVA: 0x00037BC0 File Offset: 0x00035FC0
        private Pawn FindPawnTarget(Pawn pawn)
        {
            Pawn pawn2 = (Pawn)AttackTargetFinder.BestAttackTarget(pawn, TargetScanFlags.NeedReachable, (Thing x) => x is Pawn && XenomorphUtil.isInfectablePawn((Pawn)x), 0f, 10f, default(IntVec3), float.MaxValue, true, true);

            if (pawn2 == null)
            {
                pawn2 = (Pawn)AttackTargetFinder.BestAttackTarget(pawn, TargetScanFlags.NeedReachable, (Thing x) => x is Pawn && XenomorphUtil.isInfectablePawn((Pawn)x), 0f, 9999f, default(IntVec3), float.MaxValue, true, true);
            }
            if (pawn2 == null)
            {
                pawn2 = BestPawnToHuntForPredator(pawn, forceScanWholeMap);
            }
#if DEBUG
            bool selected = Find.Selector.SingleSelectedThing == pawn;
            if (selected)
            {
                if (pawn2 != null)
                {
                    Log.Message(string.Format("{0}@{1} hunting {2}@{3}", pawn.Label, pawn.Position, pawn2.Label, pawn2.Position));
                }
            }
#endif
            return(pawn2);
        }
예제 #30
0
 // Token: 0x06000956 RID: 2390 RVA: 0x0004D678 File Offset: 0x0004BA78
 protected override bool Satisfied(Pawn pawn)
 {
     return(XenomorphUtil.ClosestReachableHivelike(pawn).DestroyedOrNull());
 }