/datum/controller/subsystem/ticker/proc/scoreboard()
//Print a list of antagonists to the server log
var/list/total_antagonists = list()
//Look into all mobs in world, dead or alive
for(var/datum/mind/Mind in SSticker.minds)
var/temprole = Mind.special_role
if(temprole) //if they are an antagonist of some sort.
if(temprole in total_antagonists) //If the role exists already, add the name to it
total_antagonists[temprole] += ", [Mind.name]([Mind.key])"
else
total_antagonists.Add(temprole) //If the role doesnt exist in the list, create it and add the mob
total_antagonists[temprole] += ": [Mind.name]([Mind.key])"
//Now print them all into the log!
log_game("Antagonists at round end were...")
for(var/i in total_antagonists)
log_game("[i]s[total_antagonists[i]].")
// Score Calculation and Display
// Who is alive/dead, who escaped
for(var/mob/living/silicon/ai/I in GLOB.mob_list)
if(I.stat == DEAD && is_station_level(I.z))
score_deadaipenalty++
score_deadcrew++
for(var/mob/living/carbon/human/I in GLOB.mob_list)
if(I.stat == DEAD && is_station_level(I.z))
score_deadcrew++
if(SSshuttle.emergency.mode >= SHUTTLE_ENDGAME)
for(var/mob/living/player in GLOB.mob_list)
if(player.client)
if(player.stat != DEAD)
var/turf/location = get_turf(player.loc)
var/area/escape_zone = locate(/area/shuttle/escape)
if(location in escape_zone)
score_escapees++
var/cash_score = 0
var/dmg_score = 0
if(SSshuttle.emergency.mode >= SHUTTLE_ENDGAME)
for(var/mob/living/carbon/human/E in GLOB.mob_list)
cash_score = 0
dmg_score = 0
var/turf/location = get_turf(E.loc)
var/area/escape_zone = SSshuttle.emergency.areaInstance
if(E.stat != DEAD && location in escape_zone) // Escapee Scores
cash_score = get_score_container_worth(E)
if(cash_score > score_richestcash)
score_richestcash = cash_score
score_richestname = E.real_name
score_richestjob = E.job
score_richestkey = E.key
dmg_score = E.getBruteLoss() + E.getFireLoss() + E.getToxLoss() + E.getOxyLoss()
if(dmg_score > score_dmgestdamage)
score_dmgestdamage = dmg_score
score_dmgestname = E.real_name
score_dmgestjob = E.job
score_dmgestkey = E.key
if(SSticker && SSticker.mode)
SSticker.mode.set_scoreboard_gvars()
// Check station's power levels
for(var/obj/machinery/power/apc/A in GLOB.apcs)
if(!is_station_level(A.z)) continue
for(var/obj/item/stock_parts/cell/C in A.contents)
if(C.charge < 2300)
score_powerloss++ //200 charge leeway
// Check how much uncleaned mess is on the station
for(var/obj/effect/decal/cleanable/M in world)
if(!is_station_level(M.z)) continue
if(istype(M, /obj/effect/decal/cleanable/blood/gibs))
score_mess += 3
if(istype(M, /obj/effect/decal/cleanable/blood))
score_mess += 1
if(istype(M, /obj/effect/decal/cleanable/vomit))
score_mess += 1
// Bonus Modifiers
//var/traitorwins = score_traitorswon
var/deathpoints = score_deadcrew * 25 //done
var/researchpoints = score_researchdone * 30
var/eventpoints = score_eventsendured * 50
var/escapoints = score_escapees * 25 //done
var/harvests = score_stuffharvested * 5 //done
var/shipping = score_stuffshipped * 5
var/mining = score_oremined * 2 //done
var/meals = score_meals * 5 //done, but this only counts cooked meals, not drinks served
var/power = score_powerloss * 20
var/messpoints
if(score_mess != 0)
messpoints = score_mess //done
var/plaguepoints = score_disease * 30
// Good Things
score_crewscore += shipping
score_crewscore += harvests
score_crewscore += mining
score_crewscore += researchpoints
score_crewscore += eventpoints
score_crewscore += escapoints
if(power == 0)
score_crewscore += 2500
score_powerbonus = 1
if(score_mess == 0)
score_crewscore += 3000
score_messbonus = 1
score_crewscore += meals
if(score_allarrested)
score_crewscore *= 3 // This needs to be here for the bonus to be applied properly
score_crewscore -= deathpoints
if(score_deadaipenalty)
score_crewscore -= 250
score_crewscore -= power
score_crewscore -= messpoints
score_crewscore -= plaguepoints
// Show the score - might add "ranks" later
to_chat(world, "The crew's final score is:")
to_chat(world, "[score_crewscore]")
for(var/mob/E in GLOB.player_list)
if(E.client && !E.get_preference(DISABLE_SCOREBOARD))
E.scorestats()
// A recursive function to properly determine the wealthiest escapee
/datum/controller/subsystem/ticker/proc/get_score_container_worth(atom/C, level=0)
if(level >= 5)
// in case the containers recurse or something
return 0
else
. = 0
for(var/obj/item/card/id/id in C.contents)
var/datum/money_account/A = get_money_account(id.associated_account_number)
// has an account?
if(A)
. += A.money
for(var/obj/item/stack/spacecash/cash in C.contents)
. += cash.amount
for(var/obj/item/storage/S in C.contents)
. += .(S, level + 1)
/datum/game_mode/proc/get_scoreboard_stats()
return null
/datum/game_mode/proc/set_scoreboard_gvars()
return null
/mob/proc/scorestats()
var/dat = "Round Statistics and Score