diff --git a/code/controllers/configuration/sections/ruin_configuration.dm b/code/controllers/configuration/sections/ruin_configuration.dm index cad322a7f52..3bc9af89d74 100644 --- a/code/controllers/configuration/sections/ruin_configuration.dm +++ b/code/controllers/configuration/sections/ruin_configuration.dm @@ -1,13 +1,15 @@ /// Config holder for all things regarding space ruins and lavaland ruins /datum/configuration_section/ruin_configuration - /// Whether to load the lavaland Z-level + /// Enable space z-level generation. + var/enable_space = TRUE + /// Enable lavaland generation. var/enable_lavaland = TRUE - /// Enable or disable all ruins, including lavaland ruins and lavaland tendrils. - var/enable_space_ruins = TRUE - /// Minimum number of extra zlevels to fill with ruins - var/extra_levels_min = 2 - /// Maximum number of extra zlevels to fill with ruins - var/extra_levels_max = 4 + /// Globally enable and disable placing of all ruins across lavaland and space. + var/enable_ruins = TRUE + /// Minimum number of extra space zlevels to generate + var/minimum_space_zlevels = 2 + /// Maximum number of extra space zlevels to generate + var/maximum_space_zlevels = 4 /// List of all active space ruins var/list/active_space_ruins = list() /// List of all active lavaland ruins @@ -23,10 +25,11 @@ /datum/configuration_section/ruin_configuration/load_data(list/data) // Use the load wrappers here. That way the default isnt made 'null' if you comment out the config line + CONFIG_LOAD_BOOL(enable_space, data["enable_space"]) CONFIG_LOAD_BOOL(enable_lavaland, data["enable_lavaland"]) - CONFIG_LOAD_BOOL(enable_space_ruins, data["enable_space_ruins"]) - CONFIG_LOAD_NUM(extra_levels_min, data["minimum_zlevels"]) - CONFIG_LOAD_NUM(extra_levels_max, data["maximum_zlevels"]) + CONFIG_LOAD_BOOL(enable_ruins, data["enable_ruins"]) + CONFIG_LOAD_NUM(minimum_space_zlevels, data["minimum_space_zlevels"]) + CONFIG_LOAD_NUM(maximum_space_zlevels, data["maximum_space_zlevels"]) CONFIG_LOAD_LIST(active_space_ruins, data["active_space_ruins"]) CONFIG_LOAD_LIST(active_lava_ruins, data["active_lava_ruins"]) CONFIG_LOAD_NUM(space_ruin_budget_min, data["space_ruin_budget_min"]) diff --git a/code/controllers/subsystem/non_firing/SSmapping.dm b/code/controllers/subsystem/non_firing/SSmapping.dm index 3c016c3b2bc..2d400e7c229 100644 --- a/code/controllers/subsystem/non_firing/SSmapping.dm +++ b/code/controllers/subsystem/non_firing/SSmapping.dm @@ -101,15 +101,26 @@ SUBSYSTEM_DEF(mapping) // Load the station loadStation() - // Load lavaland - loadLavaland() + if(GLOB.configuration.ruins.enable_space) + generate_space_zlevels() + if(GLOB.configuration.ruins.enable_lavaland) + generate_lavaland_zlevels() + + // Setup the Z-level linkage + GLOB.space_manager.do_transition_setup() // Seed space ruins - if(GLOB.configuration.ruins.enable_space_ruins) - handleRuins() + if(GLOB.configuration.ruins.enable_ruins) + place_lavaland_ruins() + place_space_ruins() else log_startup_progress("Skipping space ruins...") + if(GLOB.configuration.ruins.enable_lavaland) + // Perform procedural generation for lavaland rivers and caves, which + // happens after ruin placement. + procgen_lavaland() + var/empty_z_traits = list(REACHABLE_BY_CREW, REACHABLE_SPACE_ONLY) #ifdef GAME_TESTS preloadTemplates(path = "_maps/map_files/tests/") @@ -121,24 +132,6 @@ SUBSYSTEM_DEF(mapping) // Add a reserved z-level add_reservation_zlevel() - // Setup the Z-level linkage - GLOB.space_manager.do_transition_setup() - - if(GLOB.configuration.ruins.enable_lavaland) - // Spawn Lavaland ruins and rivers. - log_startup_progress("Populating lavaland...") - var/lavaland_setup_timer = start_watch() - lavaland_ruins_placer = new() - lavaland_ruins_placer.place_ruins(list(level_name_to_num(MINING))) - if(lavaland_theme) - lavaland_theme.setup() - if(caves_theme) - caves_theme.setup() - var/time_spent = stop_watch(lavaland_setup_timer) - log_startup_progress("Successfully populated lavaland in [time_spent]s.") - else - log_startup_progress("Skipping lavaland ruins...") - // Now we make a list of areas for teleport locs // Located below is some of the worst code I've ever seen // Checking all areas to see if they have a turf in them? Nice one ssmapping! @@ -254,26 +247,33 @@ SUBSYSTEM_DEF(mapping) log_startup_progress("Successfully seeded space salvage in [stop_watch(space_salvage_timer)]s.") -// Do not confuse with seedRuins() -/datum/controller/subsystem/mapping/proc/handleRuins() - // load in extra levels of space ruins - var/load_zlevels_timer = start_watch() - log_startup_progress("Creating random space levels...") - var/num_extra_space = rand(GLOB.configuration.ruins.extra_levels_min, GLOB.configuration.ruins.extra_levels_max) - for(var/i in 1 to num_extra_space) +/datum/controller/subsystem/mapping/proc/generate_space_zlevels() + var/zlevel_count = rand(GLOB.configuration.ruins.minimum_space_zlevels, GLOB.configuration.ruins.maximum_space_zlevels) + if(zlevel_count == 0) + log_startup_progress("Skipping space levels...") + return + + var/watch = start_watch() + log_startup_progress("Adding space levels...") + for(var/i in 1 to zlevel_count) GLOB.space_manager.add_new_zlevel("Ruin Area #[i]", linkage = CROSSLINKED, traits = list(REACHABLE_BY_CREW, SPAWN_RUINS, REACHABLE_SPACE_ONLY)) CHECK_TICK - log_startup_progress("Loaded random space levels in [stop_watch(load_zlevels_timer)]s.") + log_startup_progress("Added space levels in [stop_watch(watch)]s.") - // Now spawn ruins, random budget between 20 and 30 for all zlevels combined. - // While this may seem like a high number, the amount of ruin Z levels can be anywhere between 3 and 7. - // Note that this budget is not split evenly accross all zlevels - log_startup_progress("Seeding ruins...") - var/seed_ruins_timer = start_watch() +/datum/controller/subsystem/mapping/proc/place_lavaland_ruins() + log_startup_progress("Placing lavaland ruins...") + var/watch = start_watch() + lavaland_ruins_placer = new() + lavaland_ruins_placer.place_ruins(levels_by_trait(ORE_LEVEL)) + log_startup_progress("Placed lavaland ruins in [stop_watch(watch)]s.") + +/datum/controller/subsystem/mapping/proc/place_space_ruins() + log_startup_progress("Placing space ruins...") + var/watch = start_watch() space_ruins_placer = new() space_ruins_placer.place_ruins(levels_by_trait(SPAWN_RUINS)) - log_startup_progress("Successfully seeded ruins in [stop_watch(seed_ruins_timer)]s.") + log_startup_progress("Placed space ruins in [stop_watch(watch)]s.") seed_space_salvage(levels_by_trait(SPAWN_RUINS)) // Loads in the station @@ -309,16 +309,22 @@ SUBSYSTEM_DEF(mapping) query_set_map.Execute(async = FALSE) // This happens during a time of intense server lag, so should be non-async qdel(query_set_map) -// Loads in lavaland -/datum/controller/subsystem/mapping/proc/loadLavaland() - if(!GLOB.configuration.ruins.enable_lavaland) - log_startup_progress("Skipping Lavaland...") - return - var/watch = start_watch() +/datum/controller/subsystem/mapping/proc/generate_lavaland_zlevels() log_startup_progress("Loading Lavaland...") - var/lavaland_z_level = GLOB.space_manager.add_new_zlevel(MINING, linkage = SELFLOOPING, traits = list(ORE_LEVEL, REACHABLE_BY_CREW, STATION_CONTACT, HAS_WEATHER, AI_OK)) + var/watch = start_watch() + var/lavaland_z_level = GLOB.space_manager.add_new_zlevel(MINING, linkage = CROSSLINKED, traits = list(ORE_LEVEL, REACHABLE_BY_CREW, STATION_CONTACT, HAS_WEATHER, AI_OK)) GLOB.maploader.load_map(file("_maps/map_files/generic/Lavaland.dmm"), z_offset = lavaland_z_level) - log_startup_progress("Loaded Lavaland in [stop_watch(watch)]s") + CHECK_TICK + log_startup_progress("Added lavaland levels in [stop_watch(watch)]s") + +/datum/controller/subsystem/mapping/proc/procgen_lavaland() + var/watch = start_watch() + log_startup_progress("Loading lavaland themes...") + if(lavaland_theme) + lavaland_theme.setup() + if(caves_theme) + caves_theme.setup() + log_startup_progress("Loaded lavaland themes in [stop_watch(watch)]s") /datum/controller/subsystem/mapping/proc/make_maint_all_access() for(var/area/station/maintenance/A in existing_station_areas) diff --git a/code/datums/helper_datums/map_template.dm b/code/datums/helper_datums/map_template.dm index 5858f9b1621..6457a27903e 100644 --- a/code/datums/helper_datums/map_template.dm +++ b/code/datums/helper_datums/map_template.dm @@ -129,7 +129,7 @@ var/datum/map_template/T = new(path = "[path][map]", rename = "[map]") GLOB.map_templates[T.name] = T - if(GLOB.configuration.ruins.enable_space_ruins) // so we don't unnecessarily clutter start-up + if(GLOB.configuration.ruins.enable_ruins) // so we don't unnecessarily clutter start-up preloadRuinTemplates() preloadShelterTemplates() preloadShuttleTemplates() diff --git a/config/example/config.toml b/config/example/config.toml index b2893eda418..4b1471b3e43 100644 --- a/config/example/config.toml +++ b/config/example/config.toml @@ -603,14 +603,16 @@ redis_connstring = "redis://127.0.0.1/" [ruin_configuration] # This section contains configuration for all space ruins and lava ruins -# Whether to load the lavaland Z-level. +# Enable space z-level generation. +enable_space = true +# Enable lavaland generation. enable_lavaland = true -# Globally enable and disable placing of all ruins, including lavaland ruins and lavaland tendrils. -enable_space_ruins = false -# Minimum number of extra zlevels to generate and fill with ruins -minimum_zlevels = 2 -# Maximum number of extra zlevels to generate and fill with ruins -maximum_zlevels = 4 +# Globally enable and disable placing of all ruins across lavaland and space. +enable_ruins = false +# Minimum number of extra space zlevels to generate +minimum_space_zlevels = 2 +# Maximum number of extra space zlevels to generate +maximum_space_zlevels = 4 # Minimum space ruin budget. space_ruin_budget_min = 750 # Maximum space ruin budget. diff --git a/config/tests/config_unit_tests.toml b/config/tests/config_unit_tests.toml index dee4ef090fc..a3910ea4343 100644 --- a/config/tests/config_unit_tests.toml +++ b/config/tests/config_unit_tests.toml @@ -1,8 +1,7 @@ [ruin_configuration] enable_lavaland = false -enable_space_ruins = false -minimum_zlevels = 0 -maximum_zlevels = 0 +enable_space = false +enable_ruins = false [redis_configuration] enabled = false diff --git a/docs/contributing/getting_started.md b/docs/contributing/getting_started.md index dae74269ff7..dec18c8af27 100644 --- a/docs/contributing/getting_started.md +++ b/docs/contributing/getting_started.md @@ -286,11 +286,12 @@ map altogether and save yourself some time starting the server by setting If you do not need to load Lavaland, any of its ruins, or any space ruins, you can change these settings under `ruin_configuration`: -- `enable_lavaland`: whether to load the Lavaland z-level. +- `enable_lavaland`: whether to load Lavaland. +- `enable_space`: Whether to load space sectors. - `enable_space_ruins`: despite its name, this controls whether ruins are spawned for both space _and_ Lavaland. -- `minimum_zlevels` and `maximum_zlevels` control the number of space z-levels - generated. If you don't need any, set both to `0`. +- `minimum_space_zlevels` and `minimum_space_zlevels` control the number of + space z-levels generated. If you don't need any, set both to `0`. ### Enabling or disabling station traits