// 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) { 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); }
// 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); }