Refactors the map generation to not assume the fifth z-level is mining. Now it checks the config.txt.

This commit is contained in:
Neerti
2015-08-09 05:49:25 -04:00
parent 5bd11514f1
commit 88270df755
3 changed files with 28 additions and 6 deletions

View File

@@ -141,6 +141,8 @@ var/list/gamemode_cache = list()
var/welder_vision = 1 var/welder_vision = 1
var/generate_asteroid = 0 var/generate_asteroid = 0
var/asteroid_z_levels = list()
//Used for modifying movement speed for mobs. //Used for modifying movement speed for mobs.
//Unversal modifiers //Unversal modifiers
var/run_speed = 0 var/run_speed = 0
@@ -329,6 +331,12 @@ var/list/gamemode_cache = list()
if ("generate_asteroid") if ("generate_asteroid")
config.generate_asteroid = 1 config.generate_asteroid = 1
if ("asteroid_z_levels")
config.asteroid_z_levels = text2list(value, ";")
//Numbers get stored as strings, so we'll fix that right now.
for(var/z_level in config.asteroid_z_levels)
z_level = text2num(z_level)
if("allow_admin_ooccolor") if("allow_admin_ooccolor")
config.allow_admin_ooccolor = 1 config.allow_admin_ooccolor = 1

View File

@@ -74,12 +74,20 @@ var/global/datum/global_init/init = new ()
if(config.generate_asteroid) if(config.generate_asteroid)
// These values determine the specific area that the map is applied to. // These values determine the specific area that the map is applied to.
// If you do not use the official Baycode moonbase map, you will need to change them. // Because we do not use Bay's default map, we check the config file to see if custom parameters are needed, so we need to avoid hardcoding.
//Create the mining Z-level. if(config.asteroid_z_levels)
new /datum/random_map/automata/cave_system(null,1,1,5,255,255) for(var/z_level in config.asteroid_z_levels)
//new /datum/random_map/noise/volcanism(null,1,1,5,255,255) // Not done yet! Pretty, though. // In case we got fed a string instead of a number...
// Create the mining ore distribution map. z_level = text2num(z_level)
new /datum/random_map/noise/ore(null, 1, 1, 5, 64, 64) if(!isnum(z_level))
// If it's still not a number, we probably got fed some nonsense string.
admin_notice("<span class='danger'>Error: ASTEROID_Z_LEVELS config wasn't given a number.</span>"
// Now for the actual map generating. This occurs for every z-level defined in the config.
new /datum/random_map/automata/cave_system(null,1,1,z_level,300,300)
// Let's add ore too.
new /datum/random_map/noise/ore(null, 1, 1, z_level, 64, 64)
else
admin_notice("<span class='danger'>Error: No asteroid z-levels defined in config!</span>")
// Update all turfs to ensure everything looks good post-generation. Yes, // Update all turfs to ensure everything looks good post-generation. Yes,
// it's brute-forcey, but frankly the alternative is a mine turf rewrite. // it's brute-forcey, but frankly the alternative is a mine turf rewrite.
for(var/turf/simulated/mineral/M in world) // Ugh. for(var/turf/simulated/mineral/M in world) // Ugh.

View File

@@ -361,6 +361,12 @@ STARLIGHT 0
## Enable asteroid tunnel/cave generation. Will behave strangely if turned off with a map that expects it on. ## Enable asteroid tunnel/cave generation. Will behave strangely if turned off with a map that expects it on.
# GENERATE_ASTEROID # GENERATE_ASTEROID
## If you've enabled asteroid generation, you need to supply which z-levels to apply it to, in integer form, and seperated using ;
## An example: 1;4;5
# ASTEROID_Z_LEVELS 1;4;5
## Uncomment to enable organ decay outside of a body or storage item. ## Uncomment to enable organ decay outside of a body or storage item.
#ORGANS_CAN_DECAY #ORGANS_CAN_DECAY