// Token: 0x06004E32 RID: 20018 RVA: 0x001A4484 File Offset: 0x001A2684 public static void Notify_HiveDespawned(Hive hive, Map map) { int num = GenRadial.NumCellsInRadius(2f); for (int i = 0; i < num; i++) { IntVec3 c = hive.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 == Faction.OfInsects && !HiveUtility.AnyHivePreventsClaiming(thingList[j]) && !(thingList[j] is Pawn)) { thingList[j].SetFaction(null, null); } } } } }
public override void Tick() { if (!base.Spawned) { return; } sustainer.Maintain(); Vector3 vector = base.Position.ToVector3Shifted(); TargetInfo localTarget = new TargetInfo(this); Rand.PushState(); if (Rand.MTBEventOccurs(FilthSpawnMTB, 1f, 1.TicksToSeconds()) && CellFinder.TryFindRandomReachableCellNear(base.Position, base.Map, FilthSpawnRadius, TraverseParms.For(TraverseMode.NoPassClosedDoors), null, null, out IntVec3 result) && !filthTypes.NullOrEmpty()) { FilthMaker.TryMakeFilth(result, base.Map, filthTypes.RandomElement()); } if (Rand.MTBEventOccurs(DustMoteSpawnMTB, 1f, 1.TicksToSeconds())) { Vector3 loc = new Vector3(vector.x, 0f, vector.z); loc.y = AltitudeLayer.MoteOverhead.AltitudeFor(); FleckMaker.ThrowDustPuffThick(loc, base.Map, Rand.Range(1.5f, 3f), Ext.dustColor ?? new Color(1f, 1f, 1f, 2.5f)); if (Ext.thowSparksinDust) { if (Rand.MTBEventOccurs((EMPMoteSpawnMTB * TimeRemaining), 1f, 0.25f)) { FleckMaker.ThrowMicroSparks(loc, base.Map); } } } if (Ext.effecter != null) { if (Rand.MTBEventOccurs((EMPMoteSpawnMTB * TimeRemaining), 0.5f, 0.25f)) { if (this.Effecter == null && Ext.effecter != null) { this.Effecter = new Effecter(Ext.effecter); } if (Effecter != null) { Effecter.EffectTick(localTarget, localTarget); } else { this.Effecter.EffectTick(localTarget, localTarget); } } } Rand.PopState(); if (secondarySpawnTick > Find.TickManager.TicksGame) { return; } if (this.Effecter != null) { this.Effecter.Cleanup(); } sustainer.End(); Map map = base.Map; IntVec3 position = base.Position; Destroy(); if (Ext.strikespreexplode) { FireEvent(map, position); } if (Ext.explodesprespawn) { GenExplosion.DoExplosion(position, map, Ext.blastradius, Ext.damageDef, null, -1, -1f, null, null, null, null, null, 0f, 1, false, null, 0f, 1, 0f, false); } Hive obj = null; if (spawnHive) { obj = (Hive)GenSpawn.Spawn(ThingMaker.MakeThing(this.Ext.HiveDef), position, map); obj.SetFaction(SpawnedFaction); obj.questTags = questTags; foreach (CompSpawner comp in obj.GetComps <CompSpawner>()) { if (comp.PropsSpawner.thingToSpawn == RimWorld.ThingDefOf.InsectJelly) { comp.TryDoSpawn(); break; } } } List <Pawn> list = new List <Pawn>(); if (initialPoints > 0f) { initialPoints = Mathf.Max(initialPoints, this.Ext.HiveDef.GetCompProperties <CompProperties_SpawnerPawn>().spawnablePawnKinds.Min((PawnGenOption x) => x.Cost)); float pointsLeft = initialPoints; int num = 0; PawnGenOption result2; for (; pointsLeft > 0f; pointsLeft -= result2.Cost) { num++; if (num > 1000) { Log.Error("Too many iterations."); break; } if (!this.Ext.HiveDef.GetCompProperties <CompProperties_SpawnerPawn>().spawnablePawnKinds.Where((PawnGenOption x) => x.Cost <= pointsLeft).TryRandomElementByWeight(x => x.selectionWeight, out result2)) { break; } Pawn pawn = PawnGenerator.GeneratePawn(result2.kind, SpawnedFaction); GenSpawn.Spawn(pawn, CellFinder.RandomClosewalkCellNear(position, map, 2), map); pawn.mindState.spawnedByInfestationThingComp = spawnedByInfestationThingComp; list.Add(pawn); } } if (list.Any()) { this.MakeLord(lordJobType, list); } }