private HiveLike SpawnHiveLikeCluster(int hiveCount, Map map, bool ignoreRoofedRequirement = false, bool allowUnreachable = false, float modifier = 1)
        {
            ;
            IntVec3           loc      = intVec;
            ThingDef_HiveLike thingDef = (ThingDef_HiveLike)this.def.mechClusterBuilding;
            HiveLike          hivelike = (HiveLike)ThingMaker.MakeThing(thingDef, null);

            GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.Def.TunnelDef, null), loc, map);
            hivelike.SetFaction(hivelike.OfFaction, null);
            IncidentWorker_Xenomorph_Hivelike.SpawnItemInstantly(hivelike);
            for (int i = 0; i < hiveCount - 1; i++)
            {
                CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>();
                if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(modifier, modifier, out HiveLike hivelike2, ignoreRoofedRequirement, allowUnreachable))
                {
                    IncidentWorker_Xenomorph_Hivelike.SpawnItemInstantly(hivelike2);
                    hivelike = hivelike2;
                }
            }
            return(hivelike);
        }
Beispiel #2
0
        private HiveLike SpawnHiveLikeCluster(int hiveCount, Map map)
        {
            ;
            IntVec3           loc      = DropCellFinder.RandomDropSpot(map);
            ThingDef_HiveLike thingDef = (ThingDef_HiveLike)this.def.shipPart;
            HiveLike          hivelike = (HiveLike)ThingMaker.MakeThing(thingDef, null);

            GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.OfTunnel, null), loc, map);
            hivelike.SetFaction(hivelike.OfFaction, null);
            IncidentWorker_Hivelike.SpawnItemInstantly(hivelike);
            for (int i = 0; i < hiveCount - 1; i++)
            {
                HiveLike             hivelike2;
                CompSpawnerHiveLikes c = hivelike.GetComp <CompSpawnerHiveLikes>();
                if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(true, out hivelike2))
                {
                    IncidentWorker_Hivelike.SpawnItemInstantly(hivelike2);
                    hivelike = hivelike2;
                }
            }
            return(hivelike);
        }
        // Token: 0x0600118A RID: 4490 RVA: 0x00084ED4 File Offset: 0x000832D4
        private void TrySpawnHive(Map map)
        {
            IntVec3 intVec;

            if (!this.TryFindHiveSpawnCell(map, out intVec))
            {
                return;
            }
            this.possibleSpawnCells.Remove(intVec);
            HiveLike hive = (HiveLike)GenSpawn.Spawn(ThingMaker.MakeThing(XenomorphDefOf.RRY_Xenomorph_Hive, null), intVec, map, WipeMode.Vanish);

            hive.SetFaction(Find.FactionManager.FirstFactionOfDef(XenomorphDefOf.RRY_Xenomorph), null);
            hive.caveColony = true;

            /*
             * (from x in hive.GetComps<CompSpawner>()
             * where x.PropsSpawner.thingToSpawn == ThingDefOf.GlowPod
             * select x).First<CompSpawner>().TryDoSpawn();
             */
            hive.SpawnPawnsUntilPoints(Rand.Range(200f, 500f));
            hive.canSpawnPawns = false;
            hive.GetComp <CompSpawnerHiveLikes>().canSpawnHiveLikes = false;
            this.spawnedHives.Add(hive);
        }