// Token: 0x060004C5 RID: 1221 RVA: 0x00030B6C File Offset: 0x0002EF6C protected override Job TryGiveJob(Pawn pawn) { MapComponent_HiveGrid _HiveGrid = pawn.Map.GetComponent <MapComponent_HiveGrid>(); HiveLike Tunnel = null; Tunnel = JobGiver_EnterHiveTunnel.FindMyTunnel(pawn); if (Tunnel == null) { return(null); } if (Tunnel.HitPoints == 0) { return(null); } bool flag1 = Tunnel.def == XenomorphDefOf.RRY_Xenomorph_Hive; bool flag2 = Tunnel.def == XenomorphDefOf.RRY_Xenomorph_Hive_Child; bool flag3 = Tunnel.Map.mapPawns.AllPawnsSpawned.Any(x => x.isPotentialHost() && pawn.TryGetComp <Comp_Xenomorph>().IsAcceptablePreyFor(pawn, x, true)); bool flag4 = _HiveGrid.HiveGuardlist.Contains(pawn) || (Tunnel.hiveMaintainer != null && Tunnel.hiveMaintainer.CurStage != MaintainableStage.Healthy && (_HiveGrid.HiveWorkerlist.Contains(pawn) || _HiveGrid.HiveWorkerlist.NullOrEmpty())); if (flag3 || flag4 || Tunnel == null || (Tunnel != null && Tunnel.spawnedPawns.Contains(pawn) && (Tunnel.Position.Roofed(Tunnel.Map) || flag1)) || !pawn.CanReach(Tunnel, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn)) { return(null); } if (Tunnel.hiveDormant && !_HiveGrid.HiveGuardlist.Contains(pawn)) { return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_EnterHiveTunnel, Tunnel)); } return(new Job(XenomorphDefOf.RRY_Job_Xenomorph_EnterHiveTunnel, Tunnel)); }
// Token: 0x060004C6 RID: 1222 RVA: 0x00030C6C File Offset: 0x0002F06C public static HiveLike FindMyTunnel(Pawn pawn) { if (pawn.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen) { if (XenomorphUtil.HivelikesPresent(pawn.Map)) { HiveLike hive = (HiveLike)XenomorphUtil.ClosestReachableHivelike(pawn); if (!hive.hasQueen) { if (hive.Lord != null && hive.Lord != pawn.GetLord()) { pawn.SwitchToLord(hive.Lord); } return((HiveLike)XenomorphUtil.ClosestReachableHivelike(pawn)); } } } if (pawn.GetLord() != null && pawn.GetLord() is Lord lord) { if (lord.LordJob is LordJob_DefendAndExpandHiveLike hivejob) { if (lord.CurLordToil is LordToil_DefendAndExpandHiveLike hivetoil) { if (hivetoil.Data.assignedHiveLikes.TryGetValue(pawn) != null) { return(hivetoil.Data.assignedHiveLikes.TryGetValue(pawn)); } } } else if (lord.CurLordToil is LordToil_DefendHiveLikeAggressively hivetoilA) { if (hivetoilA.Data.assignedHiveLikes.TryGetValue(pawn) != null) { return(hivetoilA.Data.assignedHiveLikes.TryGetValue(pawn)); } } else { if (XenomorphUtil.HivelikesPresent(pawn.Map)) { HiveLike hive = (HiveLike)XenomorphUtil.ClosestReachableHivelike(pawn); if (hive.Lord != null && hive.Lord != pawn.GetLord()) { pawn.SwitchToLord(hive.Lord); } return((HiveLike)XenomorphUtil.ClosestReachableHivelike(pawn)); } } } return(null); }
// Token: 0x060002EA RID: 746 RVA: 0x0001C738 File Offset: 0x0001AB38 protected override IEnumerable <Toil> MakeNewToils() { this.FailOnDespawnedOrNull(this.TransporterInd); yield return(Toils_Goto.GotoThing(this.TransporterInd, PathEndMode.Touch)); yield return(new Toil { initAction = delegate() { HiveLike transporter = this.Transporter; this.pawn.DeSpawn(DestroyMode.Vanish); transporter.GetDirectlyHeldThings().TryAdd(this.pawn, true); } }); yield break; }
// Token: 0x0600268A RID: 9866 RVA: 0x00124ABC File Offset: 0x00122EBC public static void Notify_HiveLikeDespawned(HiveLike hivelike, Map map) { int num = GenRadial.NumCellsInRadius(2f); for (int i = 0; i < num; i++) { IntVec3 c = hivelike.Position + GenRadial.RadialPattern[i]; if (c.InBounds(map)) { List <Thing> thingList = c.GetThingList(map); for (int j = 0; j < thingList.Count; j++) { if (thingList[j].Faction == hivelike.OfFaction && !XenomorphHiveUtility.AnyHiveLikePreventsClaiming(thingList[j])) { thingList[j].SetFaction(null, null); } } } } }
public override void MapComponentTick() { base.MapComponentTick(); /* * if (true) * { * bool hiveship = XenomorphUtil.HiveShipPresent(this.map); * bool hivetunnel = XenomorphUtil.HivelikesPresent(this.map); * bool hiveslime = XenomorphUtil.HiveSlimePresent(this.map); * if (!hiveship && !hivetunnel && !hiveslime) * { * for (int i = 0; i < depthGrid.Length; i++) * { * if (depthGrid[i] > 0f) * { * HiveUtility.AddHiveRadial(this.map.cellIndices.IndexToCell(i), map, 1, -Rand.RangeSeeded(0.0001f,0.001f, AvPConstants.AvPSeed)); * } * } * } * } */ if (Find.TickManager.TicksGame % 500 == 0) { // Log.Message(string.Format("MapComponentTick update lists")); potentialHosts = map.ViableHosts(); nonpotentialHosts = map.InviableHosts(); Queenlist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen); Dronelist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Drone); Warriorlist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Warrior); Runnerlist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Runner); Predalienlist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Predalien); Thrumbomorphlist = map.mapPawns.AllPawnsSpawned.FindAll(x => x.def == XenomorphRacesDefOf.RRY_Xenomorph_Thrumbomorph); Hivelist = map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_XenomorphHive); HiveChildlist = map.listerThings.ThingsOfDef(XenomorphDefOf.RRY_XenomorphHive_Child); foreach (HiveLike item in HiveChildlist) { if (!item.GetDirectlyHeldThings().NullOrEmpty()) { IList <Thing> l = item.GetDirectlyHeldThings(); if (Hivelist != null) { int drone = 0; int warrior = 0; int runner = 0; HiveLike main = (HiveLike)Hivelist.RandomElement(); foreach (Pawn i in l) { if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Runner) { runner++; if (runner > 2) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } } if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Drone) { drone++; if (drone > 2) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } } if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Warrior) { warrior++; if (warrior > 2) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } } if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Predalien) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Queen) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } if (i.def == XenomorphRacesDefOf.RRY_Xenomorph_Thrumbomorph) { main.GetDirectlyHeldThings().TryAddOrTransfer(i); } if (!l.Contains(i)) { if (main.GetDirectlyHeldThings().Contains(i)) { if (main.Lord != null) { i.switchLord(main.Lord); } else { // Log.Message(string.Format("{0} lord is null", main, i.LabelShortCap)); } } else { // Log.Message(string.Format("{0} doesnt contain {1}", main, i.LabelShortCap)); } } else { // Log.Message(string.Format("{0} still contains {1}", item, i.LabelShortCap)); } } } } } } }