Better roundend logging
This commit is contained in:
@@ -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] - <b>[rule.name]</b>: -[rule.cost] threat"
|
||||
for(var/str in mode.threat_log)
|
||||
parts += "[FOURSPACES][FOURSPACES][str]"
|
||||
return parts.Join("<br>")
|
||||
|
||||
/client/proc/roundend_report_file()
|
||||
|
||||
@@ -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("<TITLE>Threat Log</TITLE><B><font size='3'>Threat Log</font></B><br><B>Starting Threat:</B> [threat_level]<BR>")
|
||||
|
||||
for(var/entry in threat_log)
|
||||
for(var/entry in threat_log_verbose)
|
||||
if(istext(entry))
|
||||
out += "[entry]<BR>"
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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()
|
||||
|
||||
Reference in New Issue
Block a user