diff --git a/code/game/gamemodes/newobjective.dm b/code/game/gamemodes/newobjective.dm
index 9f183206633..f8d16134ae9 100644
--- a/code/game/gamemodes/newobjective.dm
+++ b/code/game/gamemodes/newobjective.dm
@@ -1203,7 +1203,7 @@ datum
check_completion()
var/held_credits = 0
for(var/obj/item/weapon/spacecash/M in owner.current.get_contents())
- held_credits += M.worth
+ held_credits += M.get_total()
if(held_credits >= steal_amount)
return 1
return 0
diff --git a/code/game/gamemodes/scoreboard.dm b/code/game/gamemodes/scoreboard.dm
index 56f37477b76..bfe8dc0afa4 100644
--- a/code/game/gamemodes/scoreboard.dm
+++ b/code/game/gamemodes/scoreboard.dm
@@ -55,15 +55,7 @@
var/area/escape_zone = locate(/area/shuttle/escape/centcom)
if(E.stat != DEAD && location in escape_zone) // Escapee Scores
- for(var/obj/item/weapon/card/id/C1 in E.contents)
- cash_score += C1.money
- for(var/obj/item/weapon/spacecash/C2 in E.contents)
- cash_score += C2.worth
- for(var/obj/item/weapon/storage/S in E.contents)
- for(var/obj/item/weapon/card/id/C3 in S.contents)
- cash_score += C3.money
- for(var/obj/item/weapon/spacecash/C4 in S.contents)
- cash_score += C4.worth
+ cash_score = get_score_container_worth(E)
if(cash_score > score_richestcash)
score_richestcash = cash_score
@@ -163,6 +155,22 @@
if(E.client.prefs && !(E.client.prefs.toggles & DISABLE_SCOREBOARD))
E.scorestats()
+// A recursive function to properly determine the wealthiest escapee
+/datum/controller/gameticker/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/weapon/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/weapon/spacecash/cash in C.contents)
+ . += cash.get_total()
+ for(var/obj/item/weapon/storage/S in C.contents)
+ . += .(S, level + 1)
/datum/game_mode/proc/get_scoreboard_stats()
return null
diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm
index ad1761e2ece..769b932dcae 100644
--- a/code/game/machinery/vending.dm
+++ b/code/game/machinery/vending.dm
@@ -292,7 +292,7 @@
* usr is the mob who gets the change.
*/
/obj/machinery/vending/proc/pay_with_cash(var/obj/item/weapon/spacecash/cashmoney, mob/user)
- if(currently_vending.price > cashmoney.worth)
+ if(currently_vending.price > cashmoney.get_total())
// This is not a status display message, since it's something the character
// themselves is meant to see BEFORE putting the money in
usr << "\icon[cashmoney] That is not enough money."
@@ -304,7 +304,7 @@
// just assume that all spacecash that's not something else is a bill
visible_message("[usr] inserts a credit chip into [src].")
- var/left = cashmoney.worth - currently_vending.price
+ var/left = cashmoney.get_total() - currently_vending.price
usr.unEquip(cashmoney)
qdel(cashmoney)
diff --git a/code/game/objects/items/weapons/cash.dm b/code/game/objects/items/weapons/cash.dm
index 8aadcc91e92..be8cc69f39f 100644
--- a/code/game/objects/items/weapons/cash.dm
+++ b/code/game/objects/items/weapons/cash.dm
@@ -56,6 +56,9 @@ var/global/list/moneytypes=list(
stack.color=stack_color
overlays += stack
+/obj/item/weapon/spacecash/proc/get_total()
+ return worth * amount
+
/obj/item/weapon/spacecash/c10
icon_state = "cash10"
worth = 10
@@ -105,4 +108,4 @@ var/global/list/moneytypes=list(
/proc/count_cash(var/list/cash)
. = 0
for(var/obj/item/weapon/spacecash/C in cash)
- . += C.amount * C.worth
\ No newline at end of file
+ . += C.get_total()
\ No newline at end of file
diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm
index faf598f77e9..31ad003135e 100644
--- a/code/modules/economy/ATM.dm
+++ b/code/modules/economy/ATM.dm
@@ -13,8 +13,6 @@ log transactions
#define VIEW_TRANSACTION_LOGS 3
#define PRINT_DELAY 100
-/obj/item/weapon/card/id/var/money = 2000
-
/obj/machinery/atm
name = "Nanotrasen Automatic Teller Machine"
desc = "For all your monetary needs!"
@@ -97,7 +95,8 @@ log transactions
else if(authenticated_account)
if(istype(I,/obj/item/weapon/spacecash))
//consume the money
- authenticated_account.money += I:worth * I:amount
+ var/obj/item/weapon/spacecash/C = I
+ authenticated_account.money += C.get_total()
if(prob(50))
playsound(loc, 'sound/items/polaroid1.ogg', 50, 1)
else
@@ -107,13 +106,13 @@ log transactions
var/datum/transaction/T = new()
T.target_name = authenticated_account.owner_name
T.purpose = "Credit deposit"
- T.amount = I:worth
+ T.amount = C.get_total()
T.source_terminal = machine_id
T.date = current_date_string
T.time = worldtime2text()
authenticated_account.transaction_log.Add(T)
- user << "You insert [I] into [src]."
+ user << "You insert [C] into [src]."
src.attack_hand(user)
qdel(I)
else
diff --git a/code/modules/economy/POS.dm b/code/modules/economy/POS.dm
index 5a107e8f11a..8cc707f3b2f 100644
--- a/code/modules/economy/POS.dm
+++ b/code/modules/economy/POS.dm
@@ -521,7 +521,7 @@ var/const/POS_HEADER = {"
flick(src,"pos-error")
return
var/obj/item/weapon/spacecash/C=A
- credits_held += C.worth*C.amount
+ credits_held += C.get_total()
if(credits_held >= credits_needed)
visible_message("\blue The machine beeps, and begins printing a receipt","You hear a beep and the sound of paper being shredded.")
PrintReceipt()
diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm
index 0703eb5deaa..22bbef5d805 100644
--- a/code/modules/economy/cash.dm
+++ b/code/modules/economy/cash.dm
@@ -17,50 +17,34 @@
var/worth = 0
/obj/item/weapon/spacecash/c1
- name = "1 credip chip"
icon_state = "spacecash"
- desc = "It's worth 1 credit."
worth = 1
/obj/item/weapon/spacecash/c10
- name = "10 credit chip"
icon_state = "spacecash10"
- desc = "It's worth 10 credits."
worth = 10
/obj/item/weapon/spacecash/c20
- name = "20 credit chip"
icon_state = "spacecash20"
- desc = "It's worth 20 credits."
worth = 20
/obj/item/weapon/spacecash/c50
- name = "50 credit chip"
icon_state = "spacecash50"
- desc = "It's worth 50 credits."
worth = 50
/obj/item/weapon/spacecash/c100
- name = "100 credit chip"
icon_state = "spacecash100"
- desc = "It's worth 100 credits."
worth = 100
/obj/item/weapon/spacecash/c200
- name = "200 credit chip"
icon_state = "spacecash200"
- desc = "It's worth 200 credits."
worth = 200
/obj/item/weapon/spacecash/c500
- name = "500 credit chip"
icon_state = "spacecash500"
- desc = "It's worth 500 credits."
worth = 500
/obj/item/weapon/spacecash/c1000
- name = "1000 credit chip"
icon_state = "spacecash1000"
- desc = "It's worth 1000 credits."
worth = 1000