calculates richest escapee by including account balance along with cash (#21004)

* calculates richest escapee including account balance

* runtimes bad

* Update code/game/gamemodes/scoreboard.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/game/gamemodes/scoreboard.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

* Update code/game/gamemodes/scoreboard.dm

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>

---------

Co-authored-by: Ryan <80364400+Sirryan2002@users.noreply.github.com>
This commit is contained in:
Taran
2023-05-11 12:31:52 -05:00
committed by GitHub
co-authored by Ryan
parent 73269c0527
commit 2fa07ac844
+9 -2
View File
@@ -144,7 +144,7 @@ GLOBAL_VAR(scoreboard) // Variable to save the scoreboard string once it's been
score_escapees++
var/cash_score = get_score_container_worth(H)
var/cash_score = get_score_person_worth(H)
if(cash_score > richest_cash)
richest_cash = cash_score
richest_name = H.real_name
@@ -158,7 +158,14 @@ GLOBAL_VAR(scoreboard) // Variable to save the scoreboard string once it's been
damaged_job = H.job
damaged_key = H.key
// A recursive function to properly determine the wealthiest escapee
/// A function to determine the cash plus the account balance of the wealthiest escapee
/datum/scoreboard/proc/get_score_person_worth(mob/living/carbon/human/H)
if(!H.mind)
return // if they have no mind, we don't care
// return value of space cash on the person + whatever balance they currently have in their original money account
return get_score_container_worth(H) + H.mind.initial_account?.credit_balance
/// A recursive function to properly determine the cash on the wealthiest escapee
/datum/scoreboard/proc/get_score_container_worth(atom/C, level = 0)
. = 0
if(level >= 5) // in case the containers recurse or something