Skip to content

Commit

Permalink
makes it work
Browse files Browse the repository at this point in the history
  • Loading branch information
dwasint committed Jun 28, 2024
1 parent 8cd5586 commit 2d75ff8
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 6 deletions.
14 changes: 11 additions & 3 deletions code/controllers/subsystem/mapping.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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()
Expand Down Expand Up @@ -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.
Expand Down
4 changes: 2 additions & 2 deletions code/datums/mapgen/CaveGenerator.dm
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
11 changes: 10 additions & 1 deletion code/game/area/areas.dm
Original file line number Diff line number Diff line change
Expand Up @@ -207,14 +207,23 @@ 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()
for(var/turf/T in contents)
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()
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand Down

0 comments on commit 2d75ff8

Please sign in to comment.