EFTPOS scanners now work with IDs in PDAs and wallets

Vending machine code revised slightly

"\the" added to visible messages where applicable
This commit is contained in:
RavingManiac
2015-04-07 14:48:59 +10:00
parent adf39aaace
commit 6482dfb374
3 changed files with 32 additions and 27 deletions

View File

@@ -210,7 +210,7 @@
return
else if (istype(W, /obj/item/weapon/card/emag))
src.emagged = 1
user << "You short out the product lock on [src]"
user << "You short out the product lock on \the [src]"
return
else if(istype(W, /obj/item/weapon/screwdriver))
src.panel_open = !src.panel_open
@@ -230,7 +230,7 @@
W.loc = src
coin = W
categories |= CAT_COIN
user << "\blue You insert the [W] into the [src]"
user << "\blue You insert \the [W] into \the [src]"
nanomanager.update_uis(src)
return
else if(istype(W, /obj/item/weapon/wrench))
@@ -240,9 +240,9 @@
switch (anchored)
if (0)
anchored = 1
user.visible_message("[user] tightens the bolts securing \the [src] to the floor.", "You tighten the bolts securing \the [src] to the floor.")
user.visible_message("\The [user] tightens the bolts securing \the [src] to the floor.", "You tighten the bolts securing \the [src] to the floor.")
if (1)
user.visible_message("[user] unfastens the bolts securing \the [src] to the floor.", "You unfasten the bolts securing \the [src] to the floor.")
user.visible_message("\The [user] unfastens the bolts securing \the [src] to the floor.", "You unfasten the bolts securing \the [src] to the floor.")
anchored = 0
return
@@ -272,7 +272,7 @@
if(istype(cashmoney, /obj/item/weapon/spacecash/bundle))
// Bundles can just have money subtracted, and will work
visible_message("<span class='info'>[usr] inserts some cash into [src].</span>")
visible_message("<span class='info'>\The [usr] inserts some cash into \the [src].</span>")
var/obj/item/weapon/spacecash/bundle/cashmoney_bundle = cashmoney
cashmoney_bundle.worth -= currently_vending.price
@@ -287,7 +287,7 @@
// This is really dirty, but there's no superclass for all bills, so we
// just assume that all spacecash that's not something else is a bill
visible_message("<span class='info'>[usr] inserts a bill into [src].</span>")
visible_message("<span class='info'>\The [usr] inserts a bill into \the [src].</span>")
var/left = cashmoney.worth - currently_vending.price
usr.drop_from_inventory(cashmoney)
del(cashmoney)
@@ -306,7 +306,7 @@
* successful, 0 if failed.
*/
/obj/machinery/vending/proc/pay_with_ewallet(var/obj/item/weapon/spacecash/ewallet/wallet)
visible_message("<span class='info'>[usr] swipes [wallet] through [src].</span>")
visible_message("<span class='info'>\The [usr] swipes \the [wallet] through \the [src].</span>")
if(currently_vending.price > wallet.worth)
src.status_message = "Insufficient funds on chargecard."
src.status_error = 1
@@ -323,10 +323,10 @@
* successful, 0 if failed
*/
/obj/machinery/vending/proc/pay_with_card(var/obj/item/weapon/card/id/I, var/obj/item/ID_container)
if(ID_container)
visible_message("<span class='info'>[usr] swipes [ID_container] through [src].</span>")
if(I==ID_container || ID_container == null)
visible_message("<span class='info'>\The [usr] swipes \the [I] through \the [src].</span>")
else
visible_message("<span class='info'>[usr] swipes [I] through [src].</span>")
visible_message("<span class='info'>\The [usr] swipes \the [ID_container] through \the [src].</span>")
var/datum/money_account/customer_account = get_account(I.associated_account_number)
if (!customer_account)
src.status_message = "Error: Unable to access account. Please contact technical support if problem persists."
@@ -538,7 +538,7 @@
return
if(coin.string_attached)
if(prob(50))
user << "\blue You successfully pull the coin out before the [src] could swallow it."
user << "\blue You successfully pull the coin out before \the [src] could swallow it."
else
user << "\blue You weren't able to pull the coin out fast enough, the machine ate it, string and all."
del(coin)
@@ -567,7 +567,7 @@
/obj/machinery/vending/proc/stock(var/datum/data/vending_product/R, var/mob/user)
if(src.panel_open)
user << "\blue You stock the [src] with \a [R.product_name]"
user << "\blue You stock \the [src] with \a [R.product_name]"
R.amount++
nanomanager.update_uis(src)
@@ -601,7 +601,7 @@
return
for(var/mob/O in hearers(src, null))
O.show_message("<span class='game say'><span class='name'>[src]</span> beeps, \"[message]\"",2)
O.show_message("<span class='game say'><span class='name'>\The [src]</span> beeps, \"[message]\"",2)
return
/obj/machinery/vending/power_change()

View File

@@ -1,5 +1,5 @@
/obj/item/device/eftpos
name = "EFTPOS scanner"
name = "\improper EFTPOS scanner"
desc = "Swipe your ID card to make purchases electronically."
icon = 'icons/obj/device.dmi'
icon_state = "eftpos"
@@ -110,11 +110,13 @@
else
user << browse(null,"window=eftpos")
/obj/item/device/eftpos/attackby(O as obj, user as mob)
if(istype(O, /obj/item/weapon/card))
/obj/item/device/eftpos/attackby(obj/item/O as obj, user as mob)
var/obj/item/weapon/card/id/I = O.GetID()
if(I)
if(linked_account)
var/obj/item/weapon/card/I = O
scan_card(I)
scan_card(I, O)
else
usr << "\icon[src]<span class='warning'>Unable to connect to linked account.</span>"
else if (istype(O, /obj/item/weapon/spacecash/ewallet))
@@ -124,7 +126,7 @@
if(transaction_locked && !transaction_paid)
if(transaction_amount <= E.worth)
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.visible_message("\icon[src] The [src] chimes.")
src.visible_message("\icon[src] \The [src] chimes.")
transaction_paid = 1
//transfer the money
@@ -141,7 +143,7 @@
T.time = worldtime2text()
linked_account.transaction_log.Add(T)
else
usr << "\icon[src]<span class='warning'>The charge card doesn't have that much money!</span>"
usr << "\icon[src]<span class='warning'>\The [O] doesn't have that much money!</span>"
else
usr << "\icon[src]<span class='warning'>Connected account has been suspended.</span>"
else
@@ -225,10 +227,13 @@
src.attack_self(usr)
/obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I)
/obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I, var/obj/item/ID_container)
if (istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
if(I==ID_container || ID_container == null)
usr.visible_message("<span class='info'>\The [usr] swipes a card through \the [src].</span>")
else
usr.visible_message("<span class='info'>\The [usr] swipes \the [ID_container] through \the [src].</span>")
if(transaction_locked && !transaction_paid)
if(linked_account)
if(!linked_account.suspended)
@@ -242,7 +247,7 @@
if(!D.suspended)
if(transaction_amount <= D.money)
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.visible_message("\icon[src] The [src] chimes.")
src.visible_message("\icon[src] \The [src] chimes.")
transaction_paid = 1
//transfer the money
@@ -283,13 +288,13 @@
else if (istype(I, /obj/item/weapon/card/emag))
if(transaction_locked)
if(transaction_paid)
usr << "\icon[src]<span class='info'>You stealthily swipe [I] through [src].</span>"
usr << "\icon[src]<span class='info'>You stealthily swipe \the [I] through \the [src].</span>"
transaction_locked = 0
transaction_paid = 0
else
visible_message("<span class='info'>[usr] swipes a card through [src].</span>")
usr.visible_message("<span class='info'>\The [usr] swipes a card through \the [src].</span>")
playsound(src, 'sound/machines/chime.ogg', 50, 1)
src.visible_message("\icon[src] The [src] chimes.")
src.visible_message("\icon[src] \The [src] chimes.")
transaction_paid = 1
else
..()