Exemple #1
0
        private TunnelHiveLikeSpawner SpawnTunnelLikeCluster(int hiveCount, Map map)
        {
            IntVec3           loc = DropCellFinder.RandomDropSpot(map);
            ThingDef_HiveLike tD  = (ThingDef_HiveLike)this.def.mechClusterBuilding;
            ThingDef_TunnelHiveLikeSpawner thingDef = (ThingDef_TunnelHiveLikeSpawner)tD.TunnelDef;
            TunnelHiveLikeSpawner          hivelike = (TunnelHiveLikeSpawner)ThingMaker.MakeThing(thingDef, null);

            GenSpawn.Spawn(ThingMaker.MakeThing(hivelike.def, null), loc, map);
            //hivelike.SetFaction(hivelike.faction, null);
            IncidentWorker_Hivelike.SpawnItemInstantly(hivelike);
            for (int i = 0; i < hiveCount - 1; i++)
            {
                TunnelHiveLikeSpawner hivelike2;
                CompSpawnerHiveLikes  c = hivelike.GetComp <CompSpawnerHiveLikes>();
                if (hivelike.Spawned && hivelike.GetComp <CompSpawnerHiveLikes>().TrySpawnChildHiveLike(true, out hivelike2))
                {
                    IncidentWorker_Hivelike.SpawnItemInstantly(hivelike2);
                    hivelike = hivelike2;
                    //Log.Message(string.Format("7 e"));
                }
                //Log.Message(string.Format("7 f"));
            }
            //Log.Message(string.Format("8"));
            return(hivelike);
        }
Exemple #2
0
        private HiveLike SpawnHiveLikeCluster(int hiveCount, Map map)
        {
            ;
            IntVec3           loc      = DropCellFinder.RandomDropSpot(map);
            ThingDef_HiveLike thingDef = (ThingDef_HiveLike)this.def.mechClusterBuilding;
            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);
        }