[MIRROR] Adds logging to SSore_generation on subsystem initialize (#26891)

* Adds logging to SSore_generation on subsystem initialize (#81488)

This PR adds a new logging category and a logging message specific to
SSore_generation's initialize, logging the number of vents of each size,
as well as the number of random and proximity based ore spawns due to
cave generation and map generation.

Currently drafted as I could use some feedback as to why I'm not seeing
the logger.log() messages not appearing on any of the current in-game
log files 👍

Useful for data logging to determine how many of each type of ore is
spawned on the map, for the purposes of determining how much ore is
being spawned manually over the automatic amounts based on the vents,
with the quantity of ores spawning being a product of the ore vent sizes
being logged as well.

* Adds logging to SSore_generation on subsystem initialize

---------

Co-authored-by: ArcaneMusic <41715314+ArcaneMusic@users.noreply.github.com>
This commit is contained in:
SkyratBot
2024-03-15 14:22:19 -04:00
committed by GitHub
co-authored by ArcaneMusic
parent cf708294f7
commit b42d49c174
7 changed files with 84 additions and 32 deletions
+1
View File
@@ -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"
+11
View File
@@ -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.
+23
View File
@@ -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,
))
+36 -22
View File
@@ -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)
@@ -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)
+7 -7
View File
@@ -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"
@@ -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