From d0d469a45af581cb4a6d60b79a668dcbca5ec7ac Mon Sep 17 00:00:00 2001 From: Putnam Date: Sat, 9 Nov 2019 01:00:35 -0800 Subject: [PATCH] Better roundend logging --- code/__HELPERS/roundend.dm | 4 ++-- code/game/gamemodes/dynamic/dynamic.dm | 15 +++++++++++---- .../dynamic/dynamic_rulesets_midround.dm | 4 ++-- .../nukeop/equipment/nuclear_challenge.dm | 2 +- code/modules/antagonists/traitor/datum_traitor.dm | 4 ++-- .../antagonists/wizard/equipment/spellbook.dm | 6 +++--- 6 files changed, 21 insertions(+), 14 deletions(-) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 8e59106d98..233ea22631 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -313,8 +313,8 @@ parts += "[FOURSPACES]Threat level: [mode.threat_level]" parts += "[FOURSPACES]Threat left: [mode.threat]" parts += "[FOURSPACES]Executed rules:" - for(var/datum/dynamic_ruleset/rule in mode.executed_rules) - parts += "[FOURSPACES][FOURSPACES][rule.ruletype] - [rule.name]: -[rule.cost] threat" + for(var/str in mode.threat_log) + parts += "[FOURSPACES][FOURSPACES][str]" return parts.Join("
") /client/proc/roundend_report_file() diff --git a/code/game/gamemodes/dynamic/dynamic.dm b/code/game/gamemodes/dynamic/dynamic.dm index 34b263c6bd..dff34df50a 100644 --- a/code/game/gamemodes/dynamic/dynamic.dm +++ b/code/game/gamemodes/dynamic/dynamic.dm @@ -64,6 +64,8 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) var/threat = 0 /// Running information about the threat. Can store text or datum entries. var/list/threat_log = list() + /// As above, but with info such as refunds. + var/list/threat_log_verbose = list() /// List of roundstart rules used for selecting the rules. var/list/roundstart_rules = list() /// List of latejoin rules used for selecting the rules. @@ -266,6 +268,11 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) if(rule.flags & HIGHLANDER_RULESET) return rule.check_finished() +/datum/game_mode/dynamic/proc/log_threat(var/log_str,var/verbose = FALSE) + threat_log_verbose += ("[worldtime2text()]: "+log_str) + if(!verbose) + threat_log += log_str + /datum/game_mode/dynamic/proc/show_threatlog(mob/admin) if(!SSticker.HasRoundStarted()) alert("The round hasn't started yet!") @@ -276,7 +283,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) var/list/out = list("Threat LogThreat Log
Starting Threat: [threat_level]
") - for(var/entry in threat_log) + for(var/entry in threat_log_verbose) if(istext(entry)) out += "[entry]
" @@ -461,7 +468,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) starting_rule.trim_candidates() if (starting_rule.pre_execute()) spend_threat(starting_rule.cost) - threat_log += "[worldtime2text()]: Roundstart [starting_rule.name] spent [starting_rule.cost]" + log_threat("Roundstart [starting_rule.name] spent [starting_rule.cost]") if(starting_rule.flags & HIGHLANDER_RULESET) highlander_executed = TRUE else if(starting_rule.flags & ONLY_RULESET) @@ -526,7 +533,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) if (rule.execute()) log_game("DYNAMIC: Injected a [rule.ruletype == "latejoin" ? "latejoin" : "midround"] ruleset [rule.name].") spend_threat(rule.cost) - threat_log += "[worldtime2text()]: [rule.ruletype] [rule.name] spent [rule.cost]" + log_threat("[rule.ruletype] [rule.name] spent [rule.cost]") if(rule.flags & HIGHLANDER_RULESET) highlander_executed = TRUE else if(rule.flags & ONLY_RULESET) @@ -575,7 +582,7 @@ GLOBAL_VAR_INIT(dynamic_forced_threat_level, -1) new_rule.trim_candidates() if (new_rule.ready(forced)) spend_threat(new_rule.cost) - threat_log += "[worldtime2text()]: Forced rule [new_rule.name] spent [new_rule.cost]" + log_threat("Rule [new_rule.name] spent [new_rule.cost]") if (new_rule.execute()) // This should never fail since ready() returned 1 if(new_rule.flags & HIGHLANDER_RULESET) highlander_executed = TRUE diff --git a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm index 222f2fc791..16d556c795 100644 --- a/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm +++ b/code/game/gamemodes/dynamic/dynamic_rulesets_midround.dm @@ -114,7 +114,7 @@ message_admins("The ruleset [name] received no applications.") log_game("DYNAMIC: The ruleset [name] received no applications.") mode.refund_threat(cost) - mode.threat_log += "[worldtime2text()]: Rule [name] refunded [cost] (no applications)" + mode.log_threat("[worldtime2text()]: Rule [name] refunded [cost] (no applications)",verbose=TRUE) mode.executed_rules -= src return @@ -130,7 +130,7 @@ if(i == 1) // We have found no candidates so far and we are out of applicants. mode.refund_threat(cost) - mode.threat_log += "[worldtime2text()]: Rule [name] refunded [cost] (all applications invalid)" + mode.log_threat("[worldtime2text()]: Rule [name] refunded [cost] (all applications invalid)",verbose=TRUE) mode.executed_rules -= src break var/mob/applicant = pick(candidates) diff --git a/code/modules/antagonists/nukeop/equipment/nuclear_challenge.dm b/code/modules/antagonists/nukeop/equipment/nuclear_challenge.dm index 9441236692..219084d3e0 100644 --- a/code/modules/antagonists/nukeop/equipment/nuclear_challenge.dm +++ b/code/modules/antagonists/nukeop/equipment/nuclear_challenge.dm @@ -78,7 +78,7 @@ GLOBAL_VAR_INIT(war_declared, FALSE) var/datum/game_mode/dynamic/mode = SSticker.mode var/threat_spent = CONFIG_GET(number/dynamic_warops_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Nuke ops spent [threat_spent] on war ops." + mode.log_threat("Nuke ops spent [threat_spent] on war ops.") SSblackbox.record_feedback("amount", "nuclear_challenge_mode", 1) qdel(src) diff --git a/code/modules/antagonists/traitor/datum_traitor.dm b/code/modules/antagonists/traitor/datum_traitor.dm index 55f9fe483b..9a3aa19377 100644 --- a/code/modules/antagonists/traitor/datum_traitor.dm +++ b/code/modules/antagonists/traitor/datum_traitor.dm @@ -106,7 +106,7 @@ if(is_dynamic) var/threat_spent = CONFIG_GET(number/dynamic_hijack_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Traitor spent [threat_spent] on hijack." + mode.log_threat("[owner.name] spent [threat_spent] on hijack.") return @@ -123,7 +123,7 @@ if(is_dynamic) var/threat_spent = CONFIG_GET(number/dynamic_hijack_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Traitor spent [threat_spent] on glorious death." + mode.log_threat("[owner.name] spent [threat_spent] on glorious death.") return else diff --git a/code/modules/antagonists/wizard/equipment/spellbook.dm b/code/modules/antagonists/wizard/equipment/spellbook.dm index 71b92feec6..ef0974f73c 100644 --- a/code/modules/antagonists/wizard/equipment/spellbook.dm +++ b/code/modules/antagonists/wizard/equipment/spellbook.dm @@ -498,7 +498,7 @@ var/datum/game_mode/dynamic/mode = SSticker.mode var/threat_spent = CONFIG_GET(number/dynamic_summon_guns_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Wizard spent [threat_spent] on summon guns." + mode.log_threat("Wizard spent [threat_spent] on summon guns.") return 1 /datum/spellbook_entry/summon/magic @@ -524,7 +524,7 @@ var/datum/game_mode/dynamic/mode = SSticker.mode var/threat_spent = CONFIG_GET(number/dynamic_summon_magic_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Wizard spent [threat_spent] on summon magic." + mode.log_threat("Wizard spent [threat_spent] on summon magic.") return 1 /datum/spellbook_entry/summon/events @@ -551,7 +551,7 @@ var/datum/game_mode/dynamic/mode = SSticker.mode var/threat_spent = CONFIG_GET(number/dynamic_summon_events_cost) mode.spend_threat(threat_spent) - mode.threat_log += "[worldtime2text()]: Wizard spent [threat_spent] on summon events." + mode.log_threat("Wizard spent [threat_spent] on summon events.") return 1 /datum/spellbook_entry/summon/events/GetInfo()