// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { if (!SettingsHelper.latest.AllowPredalienImpregnations) { return(null); } if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("JobGiver_PredalienImpregnate TryGiveJob")); } Pawn t; if (XenomorphKidnapUtility.TryFindGoodImpregnateVictim(pawn, 18f, out t, null) && !GenAI.InDangerousCombat(pawn)) { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("victim found: {0}", t.LabelShortCap)); } return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_PredalienImpregnate) { targetA = t }); } return(null); }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = HuntingRange; IntVec3 c = IntVec3.Invalid; if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Pawn t, null) && !GenAI.InDangerousCombat(pawn)) { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, t, out c)) { ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && t != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); //Log.Message(string.Format("{0} {1} {2} {3} {4} {5}", y, !adjacent, !filled, edifice, building, thing)); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); return(new Job(XenomorphDefOf.RRY_Job_XenomorphKidnap) { targetA = t, targetB = lc, count = 1 }); } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} something went wrong", this)); } } } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} No Cocooning spot Found", this)); } } }
// Token: 0x06000420 RID: 1056 RVA: 0x0002CD30 File Offset: 0x0002B130 protected override IntVec3 GetWanderRoot(Pawn pawn) { if (pawn.isXenomorph()) { HiveLike hivelike = pawn.mindState.duty != null && pawn.mindState.duty.focus != null ? pawn.mindState.duty.focus.Thing as HiveLike : null; if (hivelike != null) { return(hivelike.Position); } /* * if (hivelike==null) * { * hivelike = FindClosestHiveLike(pawn); * } */ if (hivelike == null || !hivelike.Spawned) { if (XenomorphUtil.HivelikesPresent(pawn.Map)) { return(XenomorphUtil.ClosestReachableHivelike(pawn).Position); } if (!XenomorphKidnapUtility.hiveslimepresent) { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out IntVec3 c)) { return(c); } } else if (!XenomorphUtil.ClosestReachableHiveSlime(pawn).DestroyedOrNull()) { return(XenomorphUtil.ClosestReachableHiveSlime(pawn).Position); } return(pawn.Position); } // Log.Message(string.Format("JobGiver_WanderHiveLike hivelike.Position: {0}", hivelike.Position)); return(hivelike.Position); } else if (pawn.isNeomorph()) { Corpse corpse = (Corpse)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Corpse), PathEndMode.Touch, TraverseParms.For(pawn, Danger.Deadly), 20f); if (corpse != null) { return(corpse.Position); } return(pawn.Position); } else { return(pawn.Position); } }
// Token: 0x06000865 RID: 2149 RVA: 0x000477A4 File Offset: 0x00045BA4 public override void UpdateAllDuties() { base.FilterOutUnspawnedHiveLikes(); MapComponent_HiveGrid hive = Map.GetComponent <MapComponent_HiveGrid>(); if (!hive.Hivelist.NullOrEmpty() && !hive.HiveLoclist.NullOrEmpty()) { } else { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(lord.ownedPawns.RandomElement(), out _, null, true, false, true)) { } else if (XenomorphKidnapUtility.TryFindGoodHiveLoc(lord.ownedPawns.RandomElement(), out _, null, true, true, true)) { } } for (int i = 0; i < this.lord.ownedPawns.Count; i++) { PawnDuty duty; if (!hive.Hivelist.NullOrEmpty()) { HiveLike hiveFor = base.GetHiveLikeFor(this.lord.ownedPawns[i]); if (hiveFor.parentHiveLike != null) { duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively, hiveFor.parentHiveLike, this.distToHiveToAttack); } else { duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively, hiveFor, this.distToHiveToAttack); } } else if (!hive.HiveLoclist.NullOrEmpty()) { IntVec3 hiveloc = hive.HiveLoclist.RandomElement(); duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively, hiveloc, this.distToHiveToAttack); } else { duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_AssaultColony_CutPower); } this.lord.ownedPawns[i].mindState.duty = duty; } }
// 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; } } } }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = HuntingRange; Map map = pawn.Map; IntVec3 c = IntVec3.Invalid; Pawn Victim = null; if (!pawn.isXenomorph(out Comp_Xenomorph xenomorph) || map == null) { return(null); } MapComponent_HiveGrid hiveGrid = pawn.Map.HiveGrid(); /* * if (GenAI.InDangerousCombat(pawn)) * { * Log.Warning(string.Format("{0} is InDangerousCombat", pawn.NameShortColored)); * } */ if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Victim, null, forceRoofed, allowCocooned, minRadius, allowHosts) && !GenAI.InDangerousCombat(pawn)) { if (xenomorph.HiveLoc.IsValid && xenomorph.HiveLoc.InBounds(map) && xenomorph.HiveLoc != IntVec3.Zero) { c = xenomorph.HiveLoc; } /* * else * if (!hiveGrid.Hivelist.NullOrEmpty()) * { * c = hiveGrid.Hivelist.RandomElement().Position; * } * else * if (!hiveGrid.HiveLoclist.NullOrEmpty()) * { * c = hiveGrid.HiveLoclist.RandomElement(); * } * else */ bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && Victim != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool roofed = (y.Roofed(pawn.Map) && this.forceRoofed) || !this.forceRoofed; bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetThingList(pawn.Map).Any(x => x.GetType() == typeof(Building_XenoEgg) && x.GetType() == typeof(Building_XenomorphCocoon) && x.GetType() == typeof(HiveLike)); // Log.Message(string.Format("{0}, adjacent: {1}, filled: {2}, edifice: {3}, building: {4}", y, !adjacent, !filled, edifice, building)); return(!adjacent && !filled && edifice && building && !thingA && roofed && pawn.CanReserveAndReach(y, PathEndMode.OnCell, Danger.Deadly, layer: ReservationLayerDefOf.Floor)); }; if (pawn.GetLord() != null && pawn.GetLord() is Lord lord) { // Log.Message(string.Format("TryFindGoodHiveLoc pawn.GetLord() != null")); } else { // Log.Message(string.Format("TryFindGoodHiveLoc pawn.GetLord() == null")); } if (pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive && pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively) { pawn.mindState.duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive, c, 40f); } if (RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 2, 8)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Kidnap) { targetA = Victim, targetB = lc, targetC = lc.RandomAdjacentCell8Way(), count = 1 }); } } else { Log.Error("No suitable hive location found"); // if (Find.Selector.SelectedObjects.Contains(pawn)) Log.Message(string.Format("{0} something went wrong", this)); } } else { // Log.Error("No suitable Victim found"); } return(null); }
// Token: 0x06000424 RID: 1060 RVA: 0x0002CE84 File Offset: 0x0002B284 protected override Job TryGiveJob(Pawn pawn) { if (pawn.Map == null || pawn.Map != Find.CurrentMap) { return(null); } IntVec3 c = IntVec3.Invalid; CompXenoEggLayer compEggLayer = pawn.TryGetComp <CompXenoEggLayer>(); if (compEggLayer == null || !compEggLayer.CanLayNow) { return(null); } ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon; if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c)) { bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_LayXenomorphEgg, lc)); } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} something went wrong", this)); } } } else { if (Find.Selector.SelectedObjects.Contains(pawn)) { Log.Message(string.Format("{0} No Egglaying spot Found", this)); } c = pawn.Position; Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_LayXenomorphEgg, lc)); } return(null); }
// Token: 0x06000424 RID: 1060 RVA: 0x0002CE84 File Offset: 0x0002B284 protected override Job TryGiveJob(Pawn pawn) { if (pawn.Map == null || pawn.Map != Find.CurrentMap) { return(null); } IntVec3 c = IntVec3.Invalid; CompXenoEggLayer compEggLayer = pawn.TryGetComp <CompXenoEggLayer>(); if (compEggLayer == null || !compEggLayer.CanLayNow) { return(null); } if (!pawn.isXenomorph(out Comp_Xenomorph xenomorph)) { return(null); } else { c = xenomorph.HiveLoc; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThingsNotWater)) { using (PawnPath pawnPath = pawn.Map.pathFinder.FindPath(pawn.Position, c, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassAllDestroyableThings, false), PathEndMode.OnCell)) { IntVec3 cellBeforeBlocker; Thing thing = pawnPath.FirstBlockingBuilding(out cellBeforeBlocker, pawn); if (thing != null) { Job job = DigUtility.PassBlockerJob(pawn, thing, cellBeforeBlocker, true, true); if (job != null) { return(job); } } } Log.Message("queen can reach eggsite"); Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; if (pawn.GetLord() == null) { // Log.Message(string.Format("XenoLord TryFindGoodHiveLoc for {0} Cell Found: {1}, Allow: Fogged, Digging", pawn.LabelShortCap, c)); LordJob newJob = new LordJob_DefendAndExpandHiveLike(false, pawn.Faction, c, 40f); pawn.CreateNewLord(c, newJob); } return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } else { Log.Warning("queen couldnt reach eggsite"); } if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c)) { if (c != IntVec3.Invalid && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} something went wrong", this)); } } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} No Egglaying spot Found", this)); } c = pawn.Position; Predicate <IntVec3> validator = delegate(IntVec3 y) { bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); return(!adjacent && !filled && edifice && building && thingA && thingB); }; bool b = RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 6, 12); List <Thing> egglist = pawn.Map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_EggXenomorphFertilized).FindAll(x => lc.InHorDistOf(x.Position, 9)); bool eggflag = egglist.CountAllowNull() < 40; return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_LayEgg, lc)); } } return(null); }
// Token: 0x060004D1 RID: 1233 RVA: 0x0003100C File Offset: 0x0002F40C protected override Job TryGiveJob(Pawn pawn) { float Searchradius = MaxRange; IntVec3 c = IntVec3.Invalid; if (Searchradius == 0) { if (pawn.mindState.duty != null) { if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive)) { Searchradius = 7f; } if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive_Child)) { Searchradius = 3f; } if (pawn.mindState.duty.focus.Cell.GetThingList(pawn.Map).Any(x => x.def == XenomorphDefOf.RRY_Xenomorph_Hive_Slime)) { Searchradius = 5f; } } } if (XenomorphKidnapUtility.TryFindGoodKidnapVictim(pawn, Searchradius, out Pawn t, null, this.forceRoofed, true, MinRange) && !GenAI.InDangerousCombat(pawn)) { if (XenomorphKidnapUtility.TryFindGoodHiveLoc(pawn, out c, t, true, !this.forceRoofed, this.forceCanDig)) { ThingDef namedA = XenomorphDefOf.RRY_Xenomorph_Cocoon_Humanoid; ThingDef namedB = XenomorphDefOf.RRY_Xenomorph_Cocoon_Animal; bool selected = pawn.Map != null?Find.Selector.SelectedObjects.Contains(pawn) && (Prefs.DevMode) : false; if (c != IntVec3.Invalid && t != null && pawn.CanReach(c, PathEndMode.ClosestTouch, Danger.Deadly, true, TraverseMode.PassAllDestroyableThings)) { Predicate <IntVec3> validator = delegate(IntVec3 y) { bool roofed = (y.Roofed(pawn.Map) && this.forceRoofed) || !this.forceRoofed; bool adjacent = c.AdjacentTo8WayOrInside(y); bool filled = y.Filled(pawn.Map); bool edifice = y.GetEdifice(pawn.Map).DestroyedOrNull(); bool building = y.GetFirstBuilding(pawn.Map).DestroyedOrNull(); bool thingA = y.GetFirstThing(pawn.Map, namedA).DestroyedOrNull(); bool thingB = y.GetFirstThing(pawn.Map, namedB).DestroyedOrNull(); if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0}, adjacent: {1}, filled: {2}, edifice: {3}, building: {4}", y, !adjacent, !filled, edifice, building)); } return(!adjacent && !filled && edifice && building && thingA && thingB && roofed); }; if (pawn.GetLord() != null && pawn.GetLord() is Lord lord) { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("TryFindGoodHiveLoc pawn.GetLord() != null")); } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("TryFindGoodHiveLoc pawn.GetLord() == null")); } } if (pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive && pawn.mindState.duty.def != XenomorphDefOf.RRY_Xenomorph_DefendHiveAggressively) { pawn.mindState.duty = new PawnDuty(XenomorphDefOf.RRY_Xenomorph_DefendAndExpandHive, c, 40f); } if (RCellFinder.TryFindRandomCellNearWith(c, validator, pawn.Map, out IntVec3 lc, 2, 6)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_Kidnap) { targetA = t, targetB = lc, count = 1 }); } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} something went wrong", this)); } } } else { if (pawn.jobs.debugLog) { pawn.jobs.DebugLogEvent(string.Format("{0} No Cocooning spot Found", this)); } } }