From 188e68feb81bb939115ffb1545ba78a8f8312586 Mon Sep 17 00:00:00 2001 From: Segrain Date: Mon, 21 Oct 2013 05:06:46 +0300 Subject: [PATCH] Money spawning. --- code/modules/economy/ATM.dm | 29 +---------------------------- code/modules/economy/cash.dm | 11 ++++++++++- 2 files changed, 11 insertions(+), 29 deletions(-) diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm index b43c73ca66..32dc6cbc9d 100644 --- a/code/modules/economy/ATM.dm +++ b/code/modules/economy/ATM.dm @@ -282,7 +282,7 @@ log transactions //remove the money authenticated_account.money -= amount - withdraw_arbitrary_sum(amount) + spawn_money(amount,src.loc) //create an entry in the account transaction log var/datum/transaction/T = new() @@ -340,33 +340,6 @@ log transactions src.attack_hand(usr) -//create the most effective combination of notes to make up the requested amount -/obj/machinery/atm/proc/withdraw_arbitrary_sum(var/arbitrary_sum) - while(arbitrary_sum >= 1000) - arbitrary_sum -= 1000 - new /obj/item/weapon/spacecash/c1000(src) - while(arbitrary_sum >= 500) - arbitrary_sum -= 500 - new /obj/item/weapon/spacecash/c500(src) - while(arbitrary_sum >= 200) - arbitrary_sum -= 200 - new /obj/item/weapon/spacecash/c200(src) - while(arbitrary_sum >= 100) - arbitrary_sum -= 100 - new /obj/item/weapon/spacecash/c100(src) - while(arbitrary_sum >= 50) - arbitrary_sum -= 50 - new /obj/item/weapon/spacecash/c50(src) - while(arbitrary_sum >= 20) - arbitrary_sum -= 20 - new /obj/item/weapon/spacecash/c20(src) - while(arbitrary_sum >= 10) - arbitrary_sum -= 10 - new /obj/item/weapon/spacecash/c10(src) - while(arbitrary_sum >= 1) - arbitrary_sum -= 1 - new /obj/item/weapon/spacecash(src) - //stolen wholesale and then edited a bit from newscasters, which are awesome and by Agouri /obj/machinery/atm/proc/scan_user(mob/living/carbon/human/human_user as mob) if(!authenticated_account) diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index ff1fd9aaab..c352caa88d 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -62,4 +62,13 @@ name = "1000 credit chip" icon_state = "spacecash1000" desc = "It's worth 1000 credits." - worth = 1000 \ No newline at end of file + worth = 1000 + +proc/spawn_money(var/sum, spawnloc) + var/cash_type + for(var/i in list(1000,500,200,100,50,20,10,1)) + cash_type = text2path("/obj/item/weapon/spacecash/c[i]") + while(sum >= i) + sum -= i + new cash_type(spawnloc) + return \ No newline at end of file