From 7496feb40f0f04947ec32980fd6e51bcead0bd9e Mon Sep 17 00:00:00 2001 From: Ashe Higgs Date: Mon, 19 Feb 2018 15:46:41 -0500 Subject: [PATCH 1/2] The end-round report now shows the name, area, ckey, damage taken, and last words of the first person to die that round (#35582) * Adds a "first death" feature to the roundend * no clogging up with antag-rollers * fixes red text color * Maintainer review (finally, sorry) --- code/__HELPERS/roundend.dm | 6 ++++++ code/controllers/subsystem/blackbox.dm | 15 +++++++++++++-- code/controllers/subsystem/ticker.dm | 2 ++ code/modules/mob/living/death.dm | 10 ++++++++++ 4 files changed, 31 insertions(+), 2 deletions(-) diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 5c6856d3f6..b0bc653b01 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -277,6 +277,12 @@ parts += "
[GLOB.TAB]Evacuation Rate: [popcount[POPCOUNT_ESCAPEES]] ([PERCENT(popcount[POPCOUNT_ESCAPEES]/total_players)]%)" parts += "[GLOB.TAB](on emergency shuttle): [popcount[POPCOUNT_SHUTTLE_ESCAPEES]] ([PERCENT(popcount[POPCOUNT_SHUTTLE_ESCAPEES]/total_players)]%)" parts += "[GLOB.TAB]Survival Rate: [popcount[POPCOUNT_SURVIVORS]] ([PERCENT(popcount[POPCOUNT_SURVIVORS]/total_players)]%)" + if(SSblackbox.first_death) + var/list/ded = SSblackbox.first_death + if(ded.len) + parts += "[GLOB.TAB]First Death: [ded["name"]], [ded["role"]], at [ded["area"]]. Damage taken: [ded["damage"]].[ded["last_words"] ? " Their last words were: \"[ded["last_words"]]\"" : ""]" + else + parts += "[GLOB.TAB]Nobody died this shift!" return parts.Join("
") /datum/controller/subsystem/ticker/proc/show_roundend_report(client/C,common_report, popcount) diff --git a/code/controllers/subsystem/blackbox.dm b/code/controllers/subsystem/blackbox.dm index 832538ddf9..a2ce748295 100644 --- a/code/controllers/subsystem/blackbox.dm +++ b/code/controllers/subsystem/blackbox.dm @@ -6,6 +6,7 @@ SUBSYSTEM_DEF(blackbox) init_order = INIT_ORDER_BLACKBOX var/list/feedback = list() //list of datum/feedback_variable + var/list/first_death = list() //the first death of this round, assoc. vars keep track of different things var/triggertime = 0 var/sealed = FALSE //time to stop tracking stats? var/list/versions = list("antagonists" = 3, @@ -260,6 +261,8 @@ Versioning return if(!L || !L.key || !L.mind) return + var/brute = L.getBruteLoss() + var/fire = L.getFireLoss() var/area/placeofdeath = get_area(L) var/sqlname = sanitizeSQL(L.real_name) var/sqlkey = sanitizeSQL(L.ckey) @@ -268,8 +271,8 @@ Versioning var/sqlpod = sanitizeSQL(placeofdeath.name) var/laname = sanitizeSQL(L.lastattacker) var/lakey = sanitizeSQL(L.lastattackerckey) - var/sqlbrute = sanitizeSQL(L.getBruteLoss()) - var/sqlfire = sanitizeSQL(L.getFireLoss()) + var/sqlbrute = sanitizeSQL(brute) + var/sqlfire = sanitizeSQL(fire) var/sqlbrain = sanitizeSQL(L.getBrainLoss()) var/sqloxy = sanitizeSQL(L.getOxyLoss()) var/sqltox = sanitizeSQL(L.getToxLoss()) @@ -281,5 +284,13 @@ Versioning var/last_words = sanitizeSQL(L.last_words) var/suicide = sanitizeSQL(L.suiciding) var/map = sanitizeSQL(SSmapping.config.map_name) + if(!suicide && !first_death.len) //some of the things in here are not SQL-sanitized because they're only stored locally, and sanitized versions do not appear to show correctly + first_death["name"] = L.name + first_death["role"] = null + if(L.mind.assigned_role) + first_death["role"] = L.mind.assigned_role + first_death["area"] = "[get_area_name(L, TRUE)] [COORD(L)]" + first_death["damage"] = "[brute]/[fire]/[L.toxloss]/[L.oxyloss]/[L.cloneloss]" + first_death["last_words"] = L.last_words var/datum/DBQuery/query_report_death = SSdbcore.NewQuery("INSERT INTO [format_table_name("death")] (pod, x_coord, y_coord, z_coord, mapname, server_ip, server_port, round_id, tod, job, special, name, byondkey, laname, lakey, bruteloss, fireloss, brainloss, oxyloss, toxloss, cloneloss, staminaloss, last_words, suicide) VALUES ('[sqlpod]', '[x_coord]', '[y_coord]', '[z_coord]', '[map]', INET_ATON(IF('[world.internet_address]' LIKE '', '0', '[world.internet_address]')), '[world.port]', [GLOB.round_id], '[SQLtime()]', '[sqljob]', '[sqlspecial]', '[sqlname]', '[sqlkey]', '[laname]', '[lakey]', [sqlbrute], [sqlfire], [sqlbrain], [sqloxy], [sqltox], [sqlclone], [sqlstamina], '[last_words]', [suicide])") query_report_death.Execute() diff --git a/code/controllers/subsystem/ticker.dm b/code/controllers/subsystem/ticker.dm index 4ab8332303..59bcfa90ec 100755 --- a/code/controllers/subsystem/ticker.dm +++ b/code/controllers/subsystem/ticker.dm @@ -32,6 +32,8 @@ SUBSYSTEM_DEF(ticker) SCRIPTURE_SCRIPT = FALSE, \ SCRIPTURE_APPLICATION = FALSE) //list of clockcult scripture states for announcements + var/list/first_death = list() //contains info about the first player to die; ckey, name, location, and last words + var/delay_end = 0 //if set true, the round will not restart on it's own var/admin_delay_notice = "" //a message to display to anyone who tries to restart the world after a delay var/ready_for_reboot = FALSE //all roundend preparation done with, all that's left is reboot diff --git a/code/modules/mob/living/death.dm b/code/modules/mob/living/death.dm index 36cf94df3b..f405331d56 100644 --- a/code/modules/mob/living/death.dm +++ b/code/modules/mob/living/death.dm @@ -74,6 +74,16 @@ if (client) client.move_delay = initial(client.move_delay) + if(!suiciding && !SSticker.first_death.len) //suicides don't clog up the list, only BRUTAL deaths here + var/list/L = list() + L["name"] = name + L["role"] = null + if(mind.assigned_role) + L["role"] = mind.assigned_role + L["area"] = "[get_area_name(src, TRUE)] [COORD(src)]" + L["damage"] = "[bruteloss]/[fireloss]/[toxloss]/[oxyloss]/[cloneloss]" + L["last_words"] = last_words + SSticker.first_death = L for(var/s in ownedSoullinks) var/datum/soullink/S = s