public override void PostMapGenerate(Map map, RandomPlaceWorldObject worldObject)
 {
     foreach (var cell in map.AllCells)
     {
         GenSpawn.Spawn(ThingDefOf.Granite, cell, map);
     }
 }
        public override void PostMapDefGenerate(Map map, RandomPlaceWorldObject worldObject)
        {
            FloodFillerFog.DebugFloodUnfog(map.mapPawns.FreeColonists.RandomElement().Position, map);

            CameraJumper.TryJump(map.mapPawns.FreeColonists.RandomElement().Position, map);

            worldObject.UseEnterMapFloatMenuOption = false;

            Find.LetterStack.ReceiveLetter("EnteredToBunkerTitle".Translate(), "EnteredToBunkerDesc".Translate(), LetterDefOf.NeutralEvent);
        }
        private void DoEnter(bool first)
        {
            if (first)
            {
                generator = MapGenDefGetter;

                IntVec3 mapSize = new IntVec3(generator.size.x, 1, generator.size.z);

                mapHolder      = (RandomPlaceWorldObject)WorldObjectMaker.MakeWorldObject(WorldObjectsDefOfLocal.RandomPlace);
                mapHolder.Tile = parent.Tile;
                Find.WorldObjects.Add(mapHolder);

                PreMapGenerate(mapHolder);

                Map map = null;
                LongEventHandler.QueueLongEvent(delegate
                {
                    map = Verse.MapGenerator.GenerateMap(mapSize, mapHolder, MapGeneratorDefOfLocal.EmptyMap);

                    LongEventHandler.ExecuteWhenFinished(delegate
                    {
                        PostMapGenerate(map, mapHolder);

                        MapGeneratorHandler.GenerateMap(generator, map, out List <Pawn> pawns, ClearMap, SetTerrain, Fog, UnFogRooms, SpawnPawns, CreateRoof, GeneratePlants, forceFaction, forceLord, BreakdownBuildings);

                        var things = GenRadial.RadialDistinctThingsAround(parent.Position, parent.Map, CollectThingsRadius, false).Where(x => x.Faction == Faction.OfPlayer);
                        foreach (var t in things)
                        {
                            t.DeSpawn();

                            GenSpawn.Spawn(t, generator.PawnsSpawnPos, map);
                        }

                        PostMapDefGenerate(map, mapHolder);

                        if (OneUse)
                        {
                            parent.Destroy();
                        }
                    });
                }, "GeneratingMapForNewEncounter", doAsynchronously: false, null);
            }
            else
            {
                var things = GenRadial.RadialDistinctThingsAround(parent.Position, parent.Map, CollectThingsRadius, false).Where(x => x.Faction == Faction.OfPlayer);
                foreach (var t in things)
                {
                    t.DeSpawn();

                    GenSpawn.Spawn(t, generator.PawnsSpawnPos, mapHolder.Map);
                }
            }
        }
Example #4
0
        public void DoAction(Caravan caravan)
        {
            RandomPlaceWorldObject obj = (RandomPlaceWorldObject)WorldObjectMaker.MakeWorldObject(WorldObjectsDefOfLocal.RandomPlace);

            obj.Tile = caravan.Tile;
            obj.SetFaction(Faction);
            obj.RandomPlaceDef = RandomPlaceDef;
            Find.WorldObjects.Add(obj);

            LongEventHandler.QueueLongEvent(delegate
            {
                DoEnter(caravan, obj);
            }, "GeneratingMapForNewEncounter", doAsynchronously: false, null);
        }
 public virtual void PostMapDefGenerate(Map map, RandomPlaceWorldObject worldObject)
 {
 }
 public virtual void PreMapGenerate(RandomPlaceWorldObject worldObject)
 {
 }