// 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 && pawn.isPotentialHost() && pawn.CanReach(x, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)).ToList(); if (!list.NullOrEmpty()) { 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); } } if (Find.Selector.SelectedObjects.Contains(pawn) && Prefs.DevMode && DebugSettings.godMode) { Log.Message(string.Format("{0} Result: {1}, flagSpawned: {2}, flagLOS: {3}, flagPawnRange: {4}, flagHiveRange: {5}, flagRange: {6}", this, result, flagSpawned, flagLOS, flagPawnRange, flagHiveRange, flagRange)); } return(result); }
// 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 }); }
// 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); }
// 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); } } } } } } }
// 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: 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); }
// 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); }
// 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); }
// 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); }
// 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); }