From 60fbe4b3bed72371ae6e226c28bfe892fb1e285c Mon Sep 17 00:00:00 2001 From: igalan Date: Thu, 17 Apr 2014 01:48:06 +0100 Subject: [PATCH] First commit for review: -ATMs no longer spawn spacecash when you Withdraw funds from them. Instead they spawn a charge card with the funds asked. -You can swipe a charge card at an EFTPOS instead of your ID. The funds will be substracted from the charge card and won't ask for any PIN. (ID card swiping is still available, of course) -You can insert a change card in a vending machine. You can retrieve multiple products from the machine as long as the change card has enough funds to pay for them. -Also, the EFTPOS instructions are rewritten into a simpler text. The text is not final. Needed: -A better name than "change card"? Also, until a name is set, variables are keeping the name "ewallet". -An icon for the change card. For now it's using the 1000$ cash icon as placeholder. --- code/game/machinery/vending.dm | 35 ++++++++++++++++++++++++++++++---- code/modules/economy/ATM.dm | 7 ++----- code/modules/economy/EFTPOS.dm | 20 ++++++++++++++----- code/modules/economy/cash.dm | 13 +++++++++---- 4 files changed, 57 insertions(+), 18 deletions(-) diff --git a/code/game/machinery/vending.dm b/code/game/machinery/vending.dm index 5eb4601be8..dc83dc9eab 100644 --- a/code/game/machinery/vending.dm +++ b/code/game/machinery/vending.dm @@ -53,6 +53,8 @@ var/const/WIRE_SHOOTINV = 4 var/check_accounts = 0 // 1 = requires PIN and checks accounts. 0 = You slide an ID, it vends, SPACE COMMUNISM! + var/obj/item/weapon/spacecash/ewallet/ewallet + /obj/machinery/vending/New() ..() @@ -150,6 +152,11 @@ else if(istype(W, /obj/item/weapon/card) && currently_vending) var/obj/item/weapon/card/I = W scan_card(I) + else if (istype(W, /obj/item/weapon/spacecash/ewallet)) + user.drop_item() + W.loc = src + ewallet = W + user << "\blue You insert the [W] into the [src]" else if(src.panel_open) @@ -243,7 +250,10 @@ dat += "Select an item:

" //the rest is just general spacing and bolding if (premium.len > 0) - dat += "Coin slot: [coin ? coin : "No coin inserted"] (Remove)

" + dat += "Coin slot: [coin ? coin : "No coin inserted"] (Remove)
" + + if (ewallet) + dat += "Charge card's credits: [ewallet ? ewallet.worth : "No charge card inserted"] (Remove)

" if (src.product_records.len == 0) dat += "No product loaded!" @@ -317,6 +327,15 @@ usr << "\blue You remove the [coin] from the [src]" coin = null + if(href_list["remove_ewallet"] && !istype(usr,/mob/living/silicon)) + if (!ewallet) + usr << "There is no charge card in this machine." + return + ewallet.loc = src.loc + if(!usr.get_active_hand()) + usr.put_in_hands(ewallet) + usr << "\blue You remove the [ewallet] from the [src]" + ewallet = null if ((usr.contents.Find(src) || (in_range(src, usr) && istype(src.loc, /turf)))) usr.set_machine(src) @@ -344,9 +363,17 @@ if(R.price == null) src.vend(R, usr) else - src.currently_vending = R - src.updateUsrDialog() - + if (ewallet) + if (R.price <= ewallet.worth) + ewallet.worth -= R.price + src.vend(R, usr) + else + usr << "\red The ewallet doesn't have enough money to pay for that." + src.currently_vending = R + src.updateUsrDialog() + else + src.currently_vending = R + src.updateUsrDialog() return else if (href_list["cancel_buying"]) diff --git a/code/modules/economy/ATM.dm b/code/modules/economy/ATM.dm index f8e6598b20..9e0aa81ad6 100644 --- a/code/modules/economy/ATM.dm +++ b/code/modules/economy/ATM.dm @@ -190,7 +190,7 @@ log transactions dat += "
" dat += "" dat += "" - dat += "" //fae change: fuck it, ewallet + dat += "" dat += "
" dat += "Change account security level
" dat += "Make transfer
" @@ -310,10 +310,8 @@ log transactions //remove the money authenticated_account.money -= amount - //fae change { // spawn_money(amount,src.loc) spawn_ewallet(amount,src.loc) - //} //create an entry in the account transaction log var/datum/transaction/T = new() @@ -407,9 +405,8 @@ log transactions human_user.put_in_hands(held_card) held_card = null -//fae change { + /obj/machinery/atm/proc/spawn_ewallet(var/sum, loc) var/obj/item/weapon/spacecash/ewallet/E = new /obj/item/weapon/spacecash/ewallet(loc) E.worth = sum E.owner_name = authenticated_account.owner_name -//} \ No newline at end of file diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm index e02741be3e..d13d62aa46 100644 --- a/code/modules/economy/EFTPOS.dm +++ b/code/modules/economy/EFTPOS.dm @@ -22,6 +22,7 @@ //create a short manual as well var/obj/item/weapon/paper/R = new(src.loc) R.name = "Steps to success: Correct EFTPOS Usage" + /* R.info += "When first setting up your EFTPOS device:" R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
" R.info += "2. Confirm that your EFTPOS device is connected to your local accounts database. For additional assistance with this step, contact NanoTrasen IT Support
" @@ -33,6 +34,17 @@ R.info += "4. If at this stage you wish to modify or cancel your transaction, you may simply reset (unlock) your EFTPOS device.
" R.info += "5. Give your EFTPOS device to the customer, they must authenticate the transaction by swiping their ID card and entering their PIN number.
" R.info += "6. If done correctly, the transaction will be logged to both accounts with the reference you have entered, the terminal ID of your EFTPOS device and the money transferred across accounts.
" + */ + //Temptative new manual: + R.info += "First EFTPOS setup:
" + R.info += "1. Memorise your EFTPOS command code (provided with all EFTPOS devices).
" + R.info += "2. Connect the EFTPOS to the account in which you want to receive the funds.

" + R.info += "When starting a new transaction:
" + R.info += "1. Enter the amount of money you want to charge and a purpose message for the new transaction.
" + R.info += "2. Lock the new transaction. If you want to modify or cancel the transaction, you simply have to reset your EFTPOS device.
" + R.info += "3. Give the EFTPOS device to your customer, he/she must finish the transaction by swiping their ID card or a charge card with enough funds.
" + R.info += "4. If everything is done correctly, the money will be transferred. To unlock the device you will have to reset the EFTPOS device.
" + //stamp the paper var/image/stampoverlay = image('icons/obj/bureaucracy.dmi') @@ -102,7 +114,6 @@ scan_card(I) else usr << "\icon[src]Unable to connect to linked account." - //fae changes { else if (istype(O, /obj/item/weapon/spacecash/ewallet)) var/obj/item/weapon/spacecash/ewallet/E = O if (linked_account) @@ -119,21 +130,20 @@ //create entry in the EFTPOS linked account transaction log var/datum/transaction/T = new() - T = new() T.target_name = E.owner_name //D.owner_name T.purpose = transaction_purpose - T.amount = "[transaction_amount]" + T.amount = transaction_amount T.source_terminal = machine_id T.date = current_date_string T.time = worldtime2text() linked_account.transaction_log.Add(T) else - usr << "\icon[src]The e-wallet doesn't have that much money!" + usr << "\icon[src]The charge card doesn't have that much money!" else usr << "\icon[src]Connected account has been suspended." else usr << "\icon[src]EFTPOS is not connected to an account." - //} + else ..() diff --git a/code/modules/economy/cash.dm b/code/modules/economy/cash.dm index c4a1a755f9..2a709e731a 100644 --- a/code/modules/economy/cash.dm +++ b/code/modules/economy/cash.dm @@ -73,9 +73,14 @@ proc/spawn_money(var/sum, spawnloc) new cash_type(spawnloc) return -//Fae changes /obj/item/weapon/spacecash/ewallet - name = "E-Wallet" + name = "Charge card" icon_state = "spacecash1000" - desc = "Worth: Some credits." - var/owner_name = "" \ No newline at end of file + desc = "A card that holds an amount of money." + var/owner_name = "" //So the ATM can set it so the EFTPOS can put a valid name on transactions. + +/obj/item/weapon/spacecash/ewallet/examine() + set src in view() + ..() + if (!(usr in view(2)) && usr!=src.loc) return + usr << "\blue Charge card's owner: [src.owner_name]. Credits remaining: [src.worth]." \ No newline at end of file