diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm
index d5491f29101..e14acff154d 100644
--- a/code/__HELPERS/roundend.dm
+++ b/code/__HELPERS/roundend.dm
@@ -1,6 +1,8 @@
#define POPCOUNT_SURVIVORS "survivors" //Not dead at roundend
#define POPCOUNT_ESCAPEES "escapees" //Not dead and on centcom/shuttles marked as escaped
#define POPCOUNT_SHUTTLE_ESCAPEES "shuttle_escapees" //Emergency shuttle only.
+#define PERSONAL_LAST_ROUND "personal last round"
+#define SERVER_LAST_ROUND "server last round"
/datum/controller/subsystem/ticker/proc/gather_roundend_feedback()
gather_antag_data()
@@ -365,20 +367,48 @@
/client/proc/roundend_report_file()
return "data/roundend_reports/[ckey].html"
-/datum/controller/subsystem/ticker/proc/show_roundend_report(client/C, previous = FALSE)
+/**
+ * Log the round-end report as an HTML file
+ *
+ * Composits the roundend report, and saves it in two locations.
+ * The report is first saved along with the round's logs
+ * Then, the report is copied to a fixed directory specifically for
+ * housing the server's last roundend report. In this location,
+ * the file will be overwritten at the end of each shift.
+ */
+/datum/controller/subsystem/ticker/proc/log_roundend_report()
+ var/filename = "[GLOB.log_directory]/round_end_data.html"
+ var/list/parts = list()
+ parts += "
"
+ parts += GLOB.survivor_report
+ parts += "
"
+ parts += GLOB.common_report
+ var/content = parts.Join()
+ //Log the rendered HTML in the round log directory
+ fdel(filename)
+ text2file(content, filename)
+ //Place a copy in the root folder, to be overwritten each round.
+ filename = "data/server_last_roundend_report.html"
+ fdel(filename)
+ text2file(content, filename)
+
+/datum/controller/subsystem/ticker/proc/show_roundend_report(client/C, report_type = null)
var/datum/browser/roundend_report = new(C, "roundend")
roundend_report.width = 800
roundend_report.height = 600
var/content
var/filename = C.roundend_report_file()
- if(!previous)
+ if(report_type == PERSONAL_LAST_ROUND) //Look at this player's last round
+ content = file2text(filename)
+ else if (report_type == SERVER_LAST_ROUND) //Look at the last round that this server has seen
+ content = file2text("data/server_last_roundend_report.html")
+ else //report_type is null, so make a new report based on the current round and show that to the player
var/list/report_parts = list(personal_report(C), GLOB.common_report)
content = report_parts.Join()
remove_verb(C, /client/proc/show_previous_roundend_report)
fdel(filename)
text2file(content, filename)
- else
- content = file2text(filename)
+
roundend_report.set_content(content)
roundend_report.stylesheets = list()
roundend_report.add_stylesheet("roundend", 'html/browser/roundend.css')
@@ -415,8 +445,9 @@
/datum/controller/subsystem/ticker/proc/display_report(popcount)
GLOB.common_report = build_roundend_report()
GLOB.survivor_report = survivor_report(popcount)
+ log_roundend_report()
for(var/client/C in GLOB.clients)
- show_roundend_report(C, FALSE)
+ show_roundend_report(C)
give_show_report_button(C)
CHECK_TICK
@@ -608,7 +639,7 @@
/datum/action/report/Trigger()
if(owner && GLOB.common_report && SSticker.current_state == GAME_STATE_FINISHED)
- SSticker.show_roundend_report(owner.client, FALSE)
+ SSticker.show_roundend_report(owner.client)
/datum/action/report/IsAvailable()
return 1
diff --git a/code/modules/client/client_procs.dm b/code/modules/client/client_procs.dm
index 8f47c51361f..0f6e883415e 100644
--- a/code/modules/client/client_procs.dm
+++ b/code/modules/client/client_procs.dm
@@ -257,6 +257,9 @@ GLOBAL_LIST_INIT(blacklisted_builds, list(
if(fexists(roundend_report_file()))
add_verb(src, /client/proc/show_previous_roundend_report)
+ if(fexists("data/last_roundend/server_last_roundend_report.html"))
+ add_verb(src, /client/proc/show_servers_last_roundend_report)
+
var/full_version = "[byond_version].[byond_build ? byond_build : "xxx"]"
log_access("Login: [key_name(src)] from [address ? address : "localhost"]-[computer_id] || BYOND v[full_version]")
diff --git a/code/modules/client/verbs/ooc.dm b/code/modules/client/verbs/ooc.dm
index edc27c50baa..25269a4d330 100644
--- a/code/modules/client/verbs/ooc.dm
+++ b/code/modules/client/verbs/ooc.dm
@@ -339,7 +339,14 @@ GLOBAL_VAR_INIT(normal_ooc_colour, "#002eb8")
set category = "OOC"
set desc = "View the last round end report you've seen"
- SSticker.show_roundend_report(src, TRUE)
+ SSticker.show_roundend_report(src, report_type = PERSONAL_LAST_ROUND)
+
+/client/proc/show_servers_last_roundend_report()
+ set name = "Server's Last Round"
+ set category = "OOC"
+ set desc = "View the last round end report from this server"
+
+ SSticker.show_roundend_report(src, report_type = SERVER_LAST_ROUND)
/client/verb/fit_viewport()
set name = "Fit Viewport"