diff --git a/code/__HELPERS/roundend.dm b/code/__HELPERS/roundend.dm index 1f1bab691e..d2f67778c1 100644 --- a/code/__HELPERS/roundend.dm +++ b/code/__HELPERS/roundend.dm @@ -1,41 +1,24 @@ +#define POPCOUNT_SURVIVORS "survivors" //Not dead at roundend +#define POPCOUNT_ESCAPEES "escapees" //Not dead and on centcomm/shuttles marked as escaped +#define POPCOUNT_GHOSTS "ghosts" //Ghosts on roundend +#define POPCOUNT_HUMAN_ESCAPEES "human_escapees" //Same as escapees but human only +#define POPCOUNT_HUMAN_SURVIVORS "human_survivors" //Same as survivors but human only +#define POPCOUNT_SHUTTLE_ESCAPEES "shuttle_escapees" //Emergency shuttle only. + /datum/controller/subsystem/ticker/proc/gather_roundend_feedback() + //Survivor numbers var/clients = GLOB.player_list.len - var/surviving_humans = 0 - var/surviving_total = 0 - var/ghosts = 0 - var/escaped_humans = 0 - var/escaped_total = 0 + var/popcount = count_survivors() + SSblackbox.record_feedback("nested tally", "round_end_stats", clients, list("clients")) + SSblackbox.record_feedback("nested tally", "round_end_stats", popcount[POPCOUNT_GHOSTS], list("ghosts")) + SSblackbox.record_feedback("nested tally", "round_end_stats", popcount[POPCOUNT_HUMAN_SURVIVORS], list("survivors", "human")) + SSblackbox.record_feedback("nested tally", "round_end_stats", popcount[POPCOUNT_SURVIVORS], list("survivors", "total")) + SSblackbox.record_feedback("nested tally", "round_end_stats", popcount[POPCOUNT_HUMAN_ESCAPEES], list("escapees", "human")) + SSblackbox.record_feedback("nested tally", "round_end_stats", popcount[POPCOUNT_ESCAPEES], list("escapees", "total")) + //Antag information + gather_antag_data() - for(var/mob/M in GLOB.player_list) - if(ishuman(M)) - if(!M.stat) - surviving_humans++ - if(M.z == ZLEVEL_CENTCOM) - escaped_humans++ - if(!M.stat) - surviving_total++ - if(M.z == ZLEVEL_CENTCOM) - escaped_total++ - - if(isobserver(M)) - ghosts++ - - if(clients) - SSblackbox.record_feedback("nested tally", "round_end_stats", clients, list("clients")) - if(ghosts) - SSblackbox.record_feedback("nested tally", "round_end_stats", ghosts, list("ghosts")) - if(surviving_humans) - SSblackbox.record_feedback("nested tally", "round_end_stats", surviving_humans, list("survivors", "human")) - if(surviving_total) - SSblackbox.record_feedback("nested tally", "round_end_stats", surviving_total, list("survivors", "total")) - if(escaped_humans) - SSblackbox.record_feedback("nested tally", "round_end_stats", escaped_humans, list("escapees", "human")) - if(escaped_total) - SSblackbox.record_feedback("nested tally", "round_end_stats", escaped_total, list("escapees", "total")) - - gather_antag_success_rate() - -/datum/controller/subsystem/ticker/proc/gather_antag_success_rate() +/datum/controller/subsystem/ticker/proc/gather_antag_data() var/team_gid = 1 var/list/team_ids = list() @@ -189,29 +172,49 @@ return parts.Join() - -/datum/controller/subsystem/ticker/proc/survivor_report() - var/list/parts = list() +/datum/controller/subsystem/ticker/proc/count_survivors() + . = list() var/station_evacuated = EMERGENCY_ESCAPED_OR_ENDGAMED var/num_survivors = 0 var/num_escapees = 0 var/num_shuttle_escapees = 0 + var/num_ghosts = 0 + var/num_human_survivors = 0 + var/num_human_escapees = 0 //Player status report for(var/i in GLOB.mob_list) var/mob/Player = i if(Player.mind && !isnewplayer(Player)) + if(isobserver(Player)) + num_ghosts++ if(Player.stat != DEAD && !isbrain(Player)) num_survivors++ + if(ishuman(Player)) + num_human_survivors++ if(station_evacuated) //If the shuttle has already left the station var/list/area/shuttle_areas if(SSshuttle && SSshuttle.emergency) shuttle_areas = SSshuttle.emergency.shuttle_areas if(Player.onCentCom() || Player.onSyndieBase()) num_escapees++ + if(ishuman(Player)) + num_human_escapees++ if(shuttle_areas[get_area(Player)]) num_shuttle_escapees++ + + .[POPCOUNT_SURVIVORS] = num_survivors + .[POPCOUNT_ESCAPEES] = num_escapees + .[POPCOUNT_SHUTTLE_ESCAPEES] = num_shuttle_escapees + .[POPCOUNT_HUMAN_SURVIVORS] = num_human_survivors + .[POPCOUNT_HUMAN_ESCAPEES] = num_human_escapees + .[POPCOUNT_GHOSTS] = num_ghosts +/datum/controller/subsystem/ticker/proc/survivor_report() + var/list/parts = list() + var/station_evacuated = EMERGENCY_ESCAPED_OR_ENDGAMED + var/popcount = count_survivors() + //Round statistics report var/datum/station_state/end_state = new /datum/station_state() end_state.count() @@ -223,9 +226,9 @@ if(total_players) parts+= "[GLOB.TAB]Total Population: [total_players]" if(station_evacuated) - parts += "
[GLOB.TAB]Evacuation Rate: [num_escapees] ([PERCENT(num_escapees/total_players)]%)" - parts += "[GLOB.TAB](on emergency shuttle): [num_shuttle_escapees] ([PERCENT(num_shuttle_escapees/total_players)]%)" - parts += "[GLOB.TAB]Survival Rate: [num_survivors] ([PERCENT(num_survivors/total_players)]%)" + 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)]%)" return parts.Join("
") /datum/controller/subsystem/ticker/proc/show_roundend_report(client/C,common_report)