private static void TrySpawnHive(Map map) { IntVec3 intVec3; if (!TryFindHiveSpawnCell(map, out intVec3)) { return; } possibleSpawnCells.Remove(intVec3); Hive hive = (Hive)GenSpawn.Spawn(ThingMaker.MakeThing(ThingDefOf.Hive, null), intVec3, map, WipeMode.Vanish); hive.SetFaction(Faction.OfInsects, null); //hive.caveColony = true; ( from x in hive.GetComps <CompSpawner>() where x.PropsSpawner.thingToSpawn == ThingDefOf.GlowPod select x ).First <CompSpawner>().TryDoSpawn(); hive.PawnSpawner.SpawnPawnsUntilPoints(Rand.Range(200f, 500f)); hive.PawnSpawner.canSpawnPawns = false; hive.GetComp <CompSpawnerHives>().canSpawnHives = false; hive.GetComp <CompSpawnerBugs>().SetActive(false); spawnedHives.Add(hive); }
private void TrySpawnHive(Map map) { if (TryFindHiveSpawnCell(map, out IntVec3 spawnCell)) { possibleSpawnCells.Remove(spawnCell); Hive hive = (Hive)GenSpawn.Spawn(ThingMaker.MakeThing(ThingDefOf.Hive), spawnCell, map); hive.SetFaction(Faction.OfInsects); hive.PawnSpawner.aggressive = false; (from x in hive.GetComps <CompSpawner>() where x.PropsSpawner.thingToSpawn == ThingDefOf.GlowPod select x).First().TryDoSpawn(); hive.PawnSpawner.SpawnPawnsUntilPoints(Rand.Range(200f, 500f)); hive.PawnSpawner.canSpawnPawns = false; hive.GetComp <CompSpawnerHives>().canSpawnHives = false; spawnedHives.Add(hive); } }
// Token: 0x0600018B RID: 395 RVA: 0x0000EC70 File Offset: 0x0000CE70 public override void Resolve(ResolveParams rp) { Map map = BaseGen.globalSettings.map; Rand.PushState(); for (int i = 0; i < Rand.RangeInclusive(5, 20); i++) { Faction faction = rp.faction; IntVec3 randomCell = rp.rect.RandomCell; bool flag = randomCell.Standable(map) && randomCell.GetFirstItem(map) == null && randomCell.GetFirstPawn(map) == null && randomCell.GetFirstBuilding(map) == null; if (flag) { bool flag2 = Rand.RangeInclusive(1, 4) < 3; if (flag2) { ThingDef hivedef = faction.HivedefsFor().RandomElement() ?? RimWorld.ThingDefOf.Hive; Hive hive = (Hive)GenSpawn.Spawn(ThingMaker.MakeThing(hivedef, null), randomCell, map, WipeMode.Vanish); hive.SetFaction(faction, null); foreach (CompSpawner compSpawner in hive.GetComps <CompSpawner>()) { if (compSpawner.PropsSpawner.thingToSpawn == RimWorld.ThingDefOf.InsectJelly) { compSpawner.TryDoSpawn(); break; } } } else { ThingDef hivedef = faction.HivedefsFor().RandomElement() ?? RimWorld.ThingDefOf.Hive; Hive hive2 = (Hive)GenSpawn.Spawn(ThingMaker.MakeThing(hivedef, null), randomCell, map, WipeMode.Vanish); hive2.SetFaction(faction, null); foreach (CompSpawner compSpawner2 in hive2.GetComps <CompSpawner>()) { if (compSpawner2.PropsSpawner.thingToSpawn == RimWorld.ThingDefOf.InsectJelly) { compSpawner2.TryDoSpawn(); break; } } } } } Rand.PopState(); }