diff --git a/code/__DEFINES/logging.dm b/code/__DEFINES/logging.dm index 492a0a06a88..d4730ce0bb7 100644 --- a/code/__DEFINES/logging.dm +++ b/code/__DEFINES/logging.dm @@ -115,6 +115,7 @@ #define LOG_CATEGORY_TOOL "tool" #define LOG_CATEGORY_TRANSPORT "transport" #define LOG_CATEGORY_VIRUS "virus" +#define LOG_CATEGORY_CAVE_GENERATION "cave-generation" // Admin categories #define LOG_CATEGORY_ADMIN "admin" diff --git a/code/__DEFINES/mining.dm b/code/__DEFINES/mining.dm index 11d150a453d..4b233a5d4f1 100644 --- a/code/__DEFINES/mining.dm +++ b/code/__DEFINES/mining.dm @@ -39,6 +39,17 @@ /// The chance of ore spawning in a wall that is VENT_PROX_FAR tiles to a vent. #define VENT_CHANCE_FAR 1 +/// The amount of ore that is mined from a wall that is VENT_PROX_VERY_HIGH tiles to a vent. +#define ORE_WALL_VERY_HIGH 5 +/// The amount of ore that is mined from a wall that is VENT_PROX_HIGH tiles to a vent. +#define ORE_WALL_HIGH 4 +/// The amount of ore that is mined from a wall that is VENT_PROX_MEDIUM tiles to a vent. +#define ORE_WALL_MEDIUM 3 +/// The amount of ore that is mined from a wall that is VENT_PROX_LOW tiles to a vent. +#define ORE_WALL_LOW 2 +/// The amount of ore that is mined from a wall that is VENT_PROX_FAR tiles to a vent. +#define ORE_WALL_FAR 1 + /// The number of points a miner gets for discovering a vent, multiplied by BOULDER_SIZE when completing a wave defense minus the discovery bonus. #define MINER_POINT_MULTIPLIER 100 /// The multiplier that gets applied for automatically generated mining points. diff --git a/code/_globalvars/lists/mapping.dm b/code/_globalvars/lists/mapping.dm index b77942bad87..8719f45f18f 100644 --- a/code/_globalvars/lists/mapping.dm +++ b/code/_globalvars/lists/mapping.dm @@ -151,3 +151,26 @@ GLOBAL_LIST_INIT(megafauna_spawn_list, list( /mob/living/simple_animal/hostile/megafauna/colossus = 2, /mob/living/simple_animal/hostile/megafauna/dragon = 4, )) + +/// List of how many minerals spawned based on proximity to an ore vent. +GLOBAL_LIST_INIT(post_ore_random, list( + "[ORE_WALL_FAR]" = 0, + "[ORE_WALL_LOW]" = 0, + "[ORE_WALL_MEDIUM]" = 0, + "[ORE_WALL_HIGH]" = 0, + "[ORE_WALL_VERY_HIGH]" = 0, +)) +/// List of how many minerals spawned randomly off of mining Z-levels, and at what quantity. +GLOBAL_LIST_INIT(post_ore_manual, list( + "[ORE_WALL_FAR]" = 0, + "[ORE_WALL_LOW]" = 0, + "[ORE_WALL_MEDIUM]" = 0, + "[ORE_WALL_HIGH]" = 0, + "[ORE_WALL_VERY_HIGH]" = 0, +)) +/// List of how many ore vents spawned, and of what size. +GLOBAL_LIST_INIT(ore_vent_sizes, list( + LARGE_VENT_TYPE = 0, + MEDIUM_VENT_TYPE = 0, + SMALL_VENT_TYPE = 0, +)) diff --git a/code/controllers/subsystem/ore_generation.dm b/code/controllers/subsystem/ore_generation.dm index ca8aa09d611..e36dd577794 100644 --- a/code/controllers/subsystem/ore_generation.dm +++ b/code/controllers/subsystem/ore_generation.dm @@ -20,27 +20,6 @@ SUBSYSTEM_DEF(ore_generation) var/list/ore_vent_minerals = list() /// A tracker of how many of each ore vent size we have in the game. Useful for tracking purposes. - var/list/ore_vent_sizes = list( - LARGE_VENT_TYPE = 0, - MEDIUM_VENT_TYPE = 0, - SMALL_VENT_TYPE = 0, - ) - /// Ores spawned by proximity to an ore vent. Useful for logging purposes. - var/list/post_ore_random = list( - "1" = 0, - "2" = 0, - "3" = 0, - "4" = 0, - "5" = 0, - ) - /// Ores spawned randomly on the map without proximity to an ore vent. Useful for logging purposes. - var/list/post_ore_manual = list( - "1" = 0, - "2" = 0, - "3" = 0, - "4" = 0, - "5" = 0, - ) /datum/controller/subsystem/ore_generation/Initialize() //Basically, we're going to round robin through the list of ore vents and assign a mineral to them until complete. @@ -56,8 +35,43 @@ SUBSYSTEM_DEF(ore_generation) else stallbreaker++ if(stallbreaker >= length(possible_vents)) - return SS_INIT_SUCCESS //We've done all we can here. + break //We've done all we can here. break inner loop continue + if(stallbreaker >= length(possible_vents)) + break //We've done all we can here. break outer loop + + /// Handles roundstart logging + logger.Log( + LOG_CATEGORY_CAVE_GENERATION, + "Ore Generation spawned the following ores based on vent proximity", + list( + "[ORE_WALL_FAR]" = GLOB.post_ore_random["[ORE_WALL_FAR]"], + "[ORE_WALL_LOW]" = GLOB.post_ore_random["[ORE_WALL_LOW]"], + "[ORE_WALL_MEDIUM]" = GLOB.post_ore_random["[ORE_WALL_MEDIUM]"], + "[ORE_WALL_HIGH]" = GLOB.post_ore_random["[ORE_WALL_HIGH]"], + "[ORE_WALL_VERY_HIGH]" = GLOB.post_ore_random["[ORE_WALL_VERY_HIGH]"], + ), + ) + logger.Log( + LOG_CATEGORY_CAVE_GENERATION, + "Ore Generation spawned the following ores randomly", + list( + "[ORE_WALL_FAR]" = GLOB.post_ore_manual["[ORE_WALL_FAR]"], + "[ORE_WALL_LOW]" = GLOB.post_ore_manual["[ORE_WALL_LOW]"], + "[ORE_WALL_MEDIUM]" = GLOB.post_ore_manual["[ORE_WALL_MEDIUM]"], + "[ORE_WALL_HIGH]" = GLOB.post_ore_manual["[ORE_WALL_HIGH]"], + "[ORE_WALL_VERY_HIGH]" = GLOB.post_ore_manual["[ORE_WALL_VERY_HIGH]"], + ), + ) + logger.Log( + LOG_CATEGORY_CAVE_GENERATION, + "Ore Generation spawned the following vent sizes", + list( + "large" = LAZYACCESS(GLOB.ore_vent_sizes, LARGE_VENT_TYPE), + "medium" = LAZYACCESS(GLOB.ore_vent_sizes, MEDIUM_VENT_TYPE), + "small" = LAZYACCESS(GLOB.ore_vent_sizes, SMALL_VENT_TYPE), + ), + ) return SS_INIT_SUCCESS /datum/controller/subsystem/ore_generation/fire(resumed) diff --git a/code/game/objects/structures/lavaland/ore_vent.dm b/code/game/objects/structures/lavaland/ore_vent.dm index c3aa446916d..70ab15427b7 100644 --- a/code/game/objects/structures/lavaland/ore_vent.dm +++ b/code/game/objects/structures/lavaland/ore_vent.dm @@ -425,15 +425,15 @@ if(LARGE_VENT_TYPE) boulder_size = BOULDER_SIZE_LARGE if(mapload) - SSore_generation.ore_vent_sizes["large"] += 1 + GLOB.ore_vent_sizes["large"] += 1 if(MEDIUM_VENT_TYPE) boulder_size = BOULDER_SIZE_MEDIUM if(mapload) - SSore_generation.ore_vent_sizes["medium"] += 1 + GLOB.ore_vent_sizes["medium"] += 1 if(SMALL_VENT_TYPE) boulder_size = BOULDER_SIZE_SMALL if(mapload) - SSore_generation.ore_vent_sizes["small"] += 1 + GLOB.ore_vent_sizes["small"] += 1 else boulder_size = BOULDER_SIZE_SMALL //Might as well set a default value name = initial(name) diff --git a/code/game/turfs/closed/minerals.dm b/code/game/turfs/closed/minerals.dm index 8753ad9413a..641cd36ea67 100644 --- a/code/game/turfs/closed/minerals.dm +++ b/code/game/turfs/closed/minerals.dm @@ -143,15 +143,15 @@ return rand(1,5) if(distance < VENT_PROX_VERY_HIGH) - return 5 + return ORE_WALL_VERY_HIGH if(distance < VENT_PROX_HIGH) - return 4 + return ORE_WALL_HIGH if(distance < VENT_PROX_MEDIUM) - return 3 + return ORE_WALL_MEDIUM if(distance < VENT_PROX_LOW) - return 2 + return ORE_WALL_LOW if(distance < VENT_PROX_FAR) - return 1 + return ORE_WALL_FAR return 0 /turf/closed/mineral/get_smooth_underlay_icon(mutable_appearance/underlay_appearance, turf/asking_turf, adjacency_dir) @@ -323,7 +323,7 @@ var/turf/closed/mineral/M = T M.turf_type = src.turf_type M.mineralAmt = scale_ore_to_vent() - SSore_generation.post_ore_random["[M.mineralAmt]"] += 1 + GLOB.post_ore_random["[M.mineralAmt]"] += 1 src = M M.levelupdate() else @@ -334,7 +334,7 @@ Change_Ore(path, FALSE) Spread_Vein(path) mineralAmt = scale_ore_to_vent() - SSore_generation.post_ore_manual["[mineralAmt]"] += 1 + GLOB.post_ore_manual["[mineralAmt]"] += 1 /turf/closed/mineral/random/high_chance icon_state = "rock_highchance" diff --git a/code/modules/logging/categories/log_category_misc.dm b/code/modules/logging/categories/log_category_misc.dm index 2d200e63aa2..4d69c7cb35b 100644 --- a/code/modules/logging/categories/log_category_misc.dm +++ b/code/modules/logging/categories/log_category_misc.dm @@ -65,3 +65,6 @@ category = LOG_CATEGORY_QDEL // We want this human readable so it's easy to see at a glance entry_flags = ENTRY_USE_DATA_W_READABLE + +/datum/log_category/cave_generation + category = LOG_CATEGORY_CAVE_GENERATION