From 46dff1f20257bf3eb22e557fc0848485aa23ba64 Mon Sep 17 00:00:00 2001 From: tattle <66640614+dragomagol@users.noreply.github.com> Date: Mon, 8 Aug 2022 14:44:04 -0700 Subject: [PATCH] Moves some more dynamic logs to dynamic.log (#69004) --- code/__HELPERS/logging/dynamic.dm | 5 +++++ code/game/gamemodes/dynamic/dynamic.dm | 5 ----- .../gamemodes/dynamic/dynamic_hijacking.dm | 6 +++--- .../dynamic/dynamic_midround_rolling.dm | 20 +++++++++---------- .../gamemodes/dynamic/dynamic_rulesets.dm | 8 ++++---- .../dynamic/dynamic_rulesets_midround.dm | 9 +++------ .../dynamic/dynamic_unfavorable_situation.dm | 4 ++-- 7 files changed, 27 insertions(+), 30 deletions(-) diff --git a/code/__HELPERS/logging/dynamic.dm b/code/__HELPERS/logging/dynamic.dm index 0f051b8d11c..ff1f4fd1f7a 100644 --- a/code/__HELPERS/logging/dynamic.dm +++ b/code/__HELPERS/logging/dynamic.dm @@ -1,3 +1,8 @@ +/// Log to dynamic and message admins +/datum/game_mode/dynamic/proc/log_dynamic_and_announce(text) + message_admins("DYNAMIC: [text]") + log_dynamic("[text]") + /// Logging for dynamic procs /proc/log_dynamic(text) WRITE_LOG(GLOB.dynamic_log, "DYNAMIC: [text]") diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index 59d182c7219..2f94fba78b2 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -768,11 +768,6 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) if (20 to INFINITY) return rand(90, 100) -/// Log to messages and to the game -/datum/game_mode/dynamic/proc/dynamic_log(text) - message_admins("DYNAMIC: [text]") - log_dynamic("[text]") - #undef FAKE_REPORT_CHANCE #undef FAKE_GREENSHIFT_FORM_CHANCE #undef REPORT_NEG_DIVERGENCE diff --git a/code/game/gamemodes/dynamic/dynamic_hijacking.dm b/code/game/gamemodes/dynamic/dynamic_hijacking.dm index 335a4246a2b..316aba26daf 100644 --- a/code/game/gamemodes/dynamic/dynamic_hijacking.dm +++ b/code/game/gamemodes/dynamic/dynamic_hijacking.dm @@ -7,7 +7,7 @@ return if (random_event_hijacked != HIJACKED_NOTHING) - dynamic_log("Random event [round_event_control.name] tried to roll, but Dynamic vetoed it (random event has already ran).") + log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but Dynamic vetoed it (random event has already ran).") SSevents.spawnEvent() SSevents.reschedule() return CANCEL_PRE_RANDOM_EVENT @@ -16,10 +16,10 @@ if (world.time - last_midround_injection_attempt < time_range) random_event_hijacked = HIJACKED_TOO_RECENT - dynamic_log("Random event [round_event_control.name] tried to roll, but the last midround injection \ + log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but the last midround injection \ was too recent. Heavy injection chance has been raised to [get_heavy_midround_injection_chance(dry_run = TRUE)]%.") return CANCEL_PRE_RANDOM_EVENT if (next_midround_injection() - world.time < time_range) - dynamic_log("Random event [round_event_control.name] tried to roll, but the next midround injection is too soon.") + log_dynamic_and_announce("Random event [round_event_control.name] tried to roll, but the next midround injection is too soon.") return CANCEL_PRE_RANDOM_EVENT diff --git a/code/game/gamemodes/dynamic/dynamic_midround_rolling.dm b/code/game/gamemodes/dynamic/dynamic_midround_rolling.dm index 65f744838d5..bdbd301607a 100644 --- a/code/game/gamemodes/dynamic/dynamic_midround_rolling.dm +++ b/code/game/gamemodes/dynamic/dynamic_midround_rolling.dm @@ -32,7 +32,7 @@ next_midround_injection = null forced_injection = FALSE - dynamic_log("A midround ruleset is rolling, and will be [spawn_heavy ? "HEAVY" : "LIGHT"].") + log_dynamic_and_announce("A midround ruleset is rolling, and will be [spawn_heavy ? "HEAVY" : "LIGHT"].") random_event_hijacked = HIJACKED_NOTHING @@ -41,29 +41,29 @@ for (var/datum/dynamic_ruleset/midround/ruleset in midround_rules) if (ruleset.weight == 0) - log_game("DYNAMIC: FAIL: [ruleset] has a weight of 0") + log_dynamic("FAIL: [ruleset] has a weight of 0") continue if (!ruleset.acceptable(GLOB.alive_player_list.len, threat_level)) - log_game("DYNAMIC: FAIL: [ruleset] is not acceptable with the current parameters. Alive players: [GLOB.alive_player_list.len], threat level: [threat_level]") + log_dynamic("FAIL: [ruleset] is not acceptable with the current parameters. Alive players: [GLOB.alive_player_list.len], threat level: [threat_level]") continue if (mid_round_budget < ruleset.cost) - log_game("DYNAMIC: FAIL: [ruleset] is too expensive, and cannot be bought. Midround budget: [mid_round_budget], ruleset cost: [ruleset.cost]") + log_dynamic("FAIL: [ruleset] is too expensive, and cannot be bought. Midround budget: [mid_round_budget], ruleset cost: [ruleset.cost]") continue if (ruleset.minimum_round_time > world.time - SSticker.round_start_time) - log_game("DYNAMIC: FAIL: [ruleset] is trying to run too early. Minimum round time: [ruleset.minimum_round_time], current round time: [world.time - SSticker.round_start_time]") + log_dynamic("FAIL: [ruleset] is trying to run too early. Minimum round time: [ruleset.minimum_round_time], current round time: [world.time - SSticker.round_start_time]") continue // If admins have disabled dynamic from picking from the ghost pool if(istype(ruleset, /datum/dynamic_ruleset/midround/from_ghosts) && !(GLOB.ghost_role_flags & GHOSTROLE_MIDROUND_EVENT)) - log_game("DYNAMIC: FAIL: [ruleset] is a from_ghosts ruleset, but ghost roles are disabled") + log_dynamic("FAIL: [ruleset] is a from_ghosts ruleset, but ghost roles are disabled") continue ruleset.trim_candidates() if (!ruleset.ready()) - log_game("DYNAMIC: FAIL: [ruleset] is not ready()") + log_dynamic("FAIL: [ruleset] is not ready()") continue var/ruleset_is_heavy = (ruleset.midround_ruleset_style == MIDROUND_RULESET_STYLE_HEAVY) @@ -74,15 +74,15 @@ var/heavy_light_log_count = "[drafted_heavies.len] heavies / [drafted_lights.len] lights" - log_game("DYNAMIC: Rolling [spawn_heavy ? "HEAVY" : "LIGHT"]... [heavy_light_log_count]") + log_dynamic("Rolling [spawn_heavy ? "HEAVY" : "LIGHT"]... [heavy_light_log_count]") if (spawn_heavy && drafted_heavies.len > 0 && pick_midround_rule(drafted_heavies, "heavy rulesets")) return else if (drafted_lights.len > 0 && pick_midround_rule(drafted_lights, "light rulesets")) if (spawn_heavy) - dynamic_log("A heavy ruleset was intended to roll, but there weren't any available. [heavy_light_log_count]") + log_dynamic_and_announce("A heavy ruleset was intended to roll, but there weren't any available. [heavy_light_log_count]") else - dynamic_log("No midround rulesets could be drafted. ([heavy_light_log_count])") + log_dynamic_and_announce("No midround rulesets could be drafted. ([heavy_light_log_count])") /// Gets the chance for a heavy ruleset midround injection, the dry_run argument is only used for forced injection. /datum/game_mode/dynamic/proc/get_heavy_midround_injection_chance(dry_run) diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets.dm b/code/game/gamemodes/dynamic/dynamic_rulesets.dm index aeb5d499fff..cbf12ef3684 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets.dm @@ -104,15 +104,15 @@ indice_pop = min(requirements.len,round(population/pop_per_requirement)+1) if(minimum_players > population) - log_game("DYNAMIC: FAIL: [src] failed acceptable: minimum_players ([minimum_players]) > population ([population])") + log_dynamic("FAIL: [src] failed acceptable: minimum_players ([minimum_players]) > population ([population])") return FALSE if(maximum_players > 0 && population > maximum_players) - log_game("DYNAMIC: FAIL: [src] failed acceptable: maximum_players ([maximum_players]) < population ([population])") + log_dynamic("FAIL: [src] failed acceptable: maximum_players ([maximum_players]) < population ([population])") return FALSE if (threat_level < requirements[indice_pop]) - log_game("DYNAMIC: FAIL: [src] failed acceptable: threat_level ([threat_level]) < requirement ([requirements[indice_pop]])") + log_dynamic("FAIL: [src] failed acceptable: threat_level ([threat_level]) < requirement ([requirements[indice_pop]])") return FALSE return TRUE @@ -189,7 +189,7 @@ if (required_candidates <= candidates.len) return TRUE - log_game("DYNAMIC: FAIL: [src] does not have enough candidates ([required_candidates] needed, [candidates.len] found)") + log_dynamic("FAIL: [src] does not have enough candidates ([required_candidates] needed, [candidates.len] found)") return FALSE /// Here you can remove candidates that do not meet your requirements. diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index c5c9a5952cc..42770c66db2 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -116,20 +116,17 @@ /datum/dynamic_ruleset/midround/from_ghosts/proc/send_applications(list/possible_volunteers = list()) if (possible_volunteers.len <= 0) // This shouldn't happen, as ready() should return FALSE if there is not a single valid candidate message_admins("Possible volunteers was 0. This shouldn't appear, because of ready(), unless you forced it!") - return - message_admins("Polling [possible_volunteers.len] players to apply for the [name] ruleset.") - log_dynamic("Polling [possible_volunteers.len] players to apply for the [name] ruleset.") + mode.log_dynamic_and_announce("Polling [possible_volunteers.len] players to apply for the [name] ruleset.") candidates = poll_ghost_candidates("The mode is looking for volunteers to become [antag_flag] for [name]", antag_flag_override, antag_flag || antag_flag_override, poll_time = 300) if(!candidates || candidates.len <= 0) - mode.dynamic_log("The ruleset [name] received no applications.") + mode.log_dynamic_and_announce("The ruleset [name] received no applications.") mode.executed_rules -= src attempt_replacement() return - message_admins("[candidates.len] players volunteered for the ruleset [name].") - log_dynamic("[candidates.len] players volunteered for [name].") + mode.log_dynamic_and_announce("[candidates.len] players volunteered for [name].") review_applications() /// Here is where you can check if your ghost applicants are valid for the ruleset. diff --git a/code/game/gamemodes/dynamic/dynamic_unfavorable_situation.dm b/code/game/gamemodes/dynamic/dynamic_unfavorable_situation.dm index a74e03739ea..2fec0eb20d9 100644 --- a/code/game/gamemodes/dynamic/dynamic_unfavorable_situation.dm +++ b/code/game/gamemodes/dynamic/dynamic_unfavorable_situation.dm @@ -47,11 +47,11 @@ var/datum/round_event_control/round_event_control_type = pick(unfavorable_random_events) var/delay = rand(20 SECONDS, 1 MINUTES) - dynamic_log("An unfavorable situation was requested, but no heavy rulesets could be drafted. Spawning [initial(round_event_control_type.name)] in [DisplayTimeText(delay)] instead.") + log_dynamic_and_announce("An unfavorable situation was requested, but no heavy rulesets could be drafted. Spawning [initial(round_event_control_type.name)] in [DisplayTimeText(delay)] instead.") var/datum/round_event_control/round_event_control = new round_event_control_type addtimer(CALLBACK(round_event_control, /datum/round_event_control.proc/runEvent), delay) else var/datum/dynamic_ruleset/midround/heavy_ruleset = pick_weight(possible_heavies) - dynamic_log("An unfavorable situation was requested, spawning [initial(heavy_ruleset.name)]") + log_dynamic_and_announce("An unfavorable situation was requested, spawning [initial(heavy_ruleset.name)]") picking_specific_rule(heavy_ruleset, forced = TRUE, ignore_cost = TRUE)