diff --git a/code/controllers/subsystem/mapping.dm b/code/controllers/subsystem/mapping.dm index 6b806a9921f7..bff56f05766a 100644 --- a/code/controllers/subsystem/mapping.dm +++ b/code/controllers/subsystem/mapping.dm @@ -161,9 +161,11 @@ SUBSYSTEM_DEF(mapping) #endif // Run map generation after ruin generation to prevent issues - run_map_generation() + run_map_terrain_generation() // Generate our rivers, we do this here so the map doesn't load on top of them setup_rivers() + // now that the terrain is generated, including rivers, we can safely populate it with objects and mobs + run_map_terrain_population() // Add the first transit level var/datum/space_level/base_transit = add_reservation_zlevel() require_area_resort() @@ -589,9 +591,15 @@ GLOBAL_LIST_EMPTY(the_station_areas) if(!GLOB.the_station_areas.len) log_world("ERROR: Station areas list failed to generate!") -/datum/controller/subsystem/mapping/proc/run_map_generation() +/// Generate the turfs of the area +/datum/controller/subsystem/mapping/proc/run_map_terrain_generation() for(var/area/A as anything in GLOB.areas) - A.RunGeneration() + A.RunTerrainGeneration() + +/// Populate the turfs of the area +/datum/controller/subsystem/mapping/proc/run_map_terrain_population() + for(var/area/A as anything in GLOB.areas) + A.RunTerrainPopulation() /datum/controller/subsystem/mapping/proc/maprotate() if(map_voted || SSmapping.next_map_config) //If voted or set by other means. diff --git a/code/datums/mapgen/CaveGenerator.dm b/code/datums/mapgen/CaveGenerator.dm index ad27001ff7a9..feade231cc32 100644 --- a/code/datums/mapgen/CaveGenerator.dm +++ b/code/datums/mapgen/CaveGenerator.dm @@ -164,8 +164,8 @@ var/datum/biome/selected_biome // Here comes the meat of the biome code. - var/drift_x = clamp(((gen_turf.x + rand(-BIOME_RANDOM_SQUARE_DRIFT, BIOME_RANDOM_SQUARE_DRIFT)) / perlin_zoom), 1, world.maxx) - var/drift_y = clamp(((gen_turf.y + rand(-BIOME_RANDOM_SQUARE_DRIFT, BIOME_RANDOM_SQUARE_DRIFT)) / perlin_zoom), 2, world.maxy) + var/drift_x = clamp(((gen_turf.x + rand(-BIOME_RANDOM_SQUARE_DRIFT, BIOME_RANDOM_SQUARE_DRIFT))), 1, world.maxx) + var/drift_y = clamp(((gen_turf.y + rand(-BIOME_RANDOM_SQUARE_DRIFT, BIOME_RANDOM_SQUARE_DRIFT))), 2, world.maxy) // Where we go in the generated string (generated outside of the loop for s p e e d) var/coordinate = world.maxx * (drift_y - 1) + drift_x diff --git a/code/game/area/areas.dm b/code/game/area/areas.dm index ca18e3814dd5..bbd784c88a52 100644 --- a/code/game/area/areas.dm +++ b/code/game/area/areas.dm @@ -207,7 +207,8 @@ GLOBAL_LIST_EMPTY(teleportlocs) power_change() // all machines set to current power level, also updates icon update_beauty() -/area/proc/RunGeneration() +/// Generate turfs, including cool cave wall gen +/area/proc/RunTerrainGeneration() if(map_generator) map_generator = new map_generator() var/list/turfs = list() @@ -215,6 +216,14 @@ GLOBAL_LIST_EMPTY(teleportlocs) turfs += T map_generator.generate_terrain(turfs, src) +/// Populate the previously generated terrain with mobs and objects +/area/proc/RunTerrainPopulation() + if(map_generator) + var/list/turfs = list() + for(var/turf/T in contents) + turfs += T + map_generator.populate_terrain(turfs, src) + /area/proc/test_gen() if(map_generator) var/list/turfs = list() diff --git a/monkestation/code/modules/map_gen_expansions/forest/generator.dm b/monkestation/code/modules/map_gen_expansions/forest/generator.dm index a78e735e211f..b06f71a849e7 100644 --- a/monkestation/code/modules/map_gen_expansions/forest/generator.dm +++ b/monkestation/code/modules/map_gen_expansions/forest/generator.dm @@ -1,5 +1,6 @@ /datum/map_generator/cave_generator/forest + buildmode_name = "Forest Generator" weighted_open_turf_types = list(/turf/open/misc/asteroid/forest = 1) weighted_closed_turf_types = list(/turf/closed/mineral/random/forest = 1) flora_spawn_chance = 35 diff --git a/monkestation/code/modules/map_gen_expansions/mushroom/generator.dm b/monkestation/code/modules/map_gen_expansions/mushroom/generator.dm index c276d76dea0a..0d673a76c9b4 100644 --- a/monkestation/code/modules/map_gen_expansions/mushroom/generator.dm +++ b/monkestation/code/modules/map_gen_expansions/mushroom/generator.dm @@ -1,6 +1,7 @@ /datum/map_generator/cave_generator/forest/mushroom name = "Mushroom Cave Biome Generator" + buildmode_name = "Mushroom Cave Biome Generator" weighted_open_turf_types = list(/turf/open/misc/dirt/forest = 3, /turf/open/misc/asteroid/forest/mushroom = 2) weighted_closed_turf_types = list(/turf/closed/mineral/random/forest = 1) initial_closed_chance = 53