diff --git a/code/modules/economy/EFTPOS.dm b/code/modules/economy/EFTPOS.dm
index bd7a25d12b3..babbac30b11 100644
--- a/code/modules/economy/EFTPOS.dm
+++ b/code/modules/economy/EFTPOS.dm
@@ -27,7 +27,7 @@
/obj/item/device/eftpos/proc/print_reference()
playsound(loc, 'sound/goonstation/machines/printer_thermal.ogg', 50, 1)
- var/obj/item/weapon/paper/R = new(src.loc)
+ var/obj/item/weapon/paper/R = new(loc)
R.name = "Reference: [eftpos_name]"
// AUTOFIXED BY fix_string_idiocy.py
@@ -45,7 +45,7 @@
R.overlays += stampoverlay
R.stamps += "
This paper has been stamped by the EFTPOS device."
var/obj/item/smallDelivery/D = new(R.loc)
- R.loc = D
+ R.forceMove(D)
D.wrapped = R
D.name = "small parcel - 'EFTPOS access code'"
@@ -54,70 +54,51 @@
if(!location)
return
- for(var/obj/machinery/computer/account_database/DB in world) //Hotfix until someone finds out why it isn't in 'machines'
+ for(var/obj/machinery/computer/account_database/DB in machines)
if(DB.z == location.z)
linked_db = DB
break
-/obj/item/device/eftpos/attack_self(mob/user as mob)
- if(get_dist(src,user) <= 1)
+/obj/item/device/eftpos/attack_self(mob/user)
+ ui_interact(user)
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:59: var/dat = "[eftpos_name]
"
- var/dat = {"[eftpos_name]
-This terminal is [machine_id]. Report this code when contacting Nanotrasen IT Support
"}
- // END AUTOFIX
- if(transaction_locked)
-
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:59: dat += "Reset[transaction_paid ? "" : " (authentication required)"]
"
- dat += {"Reset[transaction_paid ? "" : " (authentication required)"]
- Transaction purpose: [transaction_purpose]
- Value: $[transaction_amount]
- Linked account: [linked_account ? linked_account.owner_name : "None"]
"}
- // END AUTOFIX
- if(transaction_paid)
- dat += "This transaction has been processed successfully.
"
- else
-
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:67: dat += "Swipe your card below the line to finish this transaction.
"
- dat += {"Swipe your card below the line to finish this transaction.
- \[------\]"}
- // END AUTOFIX
- else
-
- // AUTOFIXED BY fix_string_idiocy.py
- // C:\Users\Rob\Documents\Projects\vgstation13\code\WorkInProgress\Cael_Aislinn\Economy\EFTPOS.dm:70: dat += "Lock in new transaction
"
- dat += {"Lock in new transaction
- Transaction purpose: [transaction_purpose]
- Value: $[transaction_amount]
- Linked account: [linked_account ? linked_account.owner_name : "None"]
- Change access code
- Change EFTPOS ID
- Scan card to reset access code \[------\]"}
- // END AUTOFIX
- user << browse(dat,"window=eftpos")
- else
- user << browse(null,"window=eftpos")
-
-/obj/item/device/eftpos/attackby(O as obj, user as mob, params)
+/obj/item/device/eftpos/attackby(obj/O, mob/user, params)
if(istype(O, /obj/item/weapon/card))
//attempt to connect to a new db, and if that doesn't work then fail
if(!linked_db)
reconnect_database()
if(linked_db)
if(linked_account)
- var/obj/item/weapon/card/I = O
- scan_card(I)
+ scan_card(O, user)
+ nanomanager.update_uis(src)
else
- to_chat(usr, "[bicon(src)]Unable to connect to linked account.")
+ to_chat(user, "[bicon(src)]Unable to connect to linked account.")
else
- to_chat(usr, "[bicon(src)]Unable to connect to accounts database.")
+ to_chat(user, "[bicon(src)]Unable to connect to accounts database.")
else
..()
-/obj/item/device/eftpos/Topic(var/href, var/href_list)
+/obj/item/device/eftpos/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
+ ui = nanomanager.try_update_ui(user, src, ui_key, ui, force_open)
+ if(!ui)
+ ui = new(user, src, ui_key, "eftpos.tmpl", name, 790, 310)
+ ui.open()
+
+/obj/item/device/eftpos/ui_data(mob/user, ui_key = "main", datum/topic_state/state = default_state)
+ var/data[0]
+ data["eftpos_name"] = eftpos_name
+ data["machine_id"] = machine_id
+ data["transaction_locked"] = transaction_locked
+ data["transaction_paid"] = transaction_paid
+ data["transaction_purpose"] = transaction_purpose
+ data["transaction_amount"] = transaction_amount
+ data["linked_account"] = linked_account ? linked_account.owner_name : null
+ return data
+
+/obj/item/device/eftpos/Topic(href, list/href_list)
+ if(..())
+ return 1
+
if(href_list["choice"])
switch(href_list["choice"])
if("change_code")
@@ -134,9 +115,9 @@
if("change_id")
var/attempt_code = text2num(input("Re-enter the current EFTPOS access code", "Confirm EFTPOS code"))
if(attempt_code == access_code)
- var name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") as text|null
+ var/name = input("Enter a new terminal ID for this device", "Enter new EFTPOS ID") as text|null
if(name)
- eftpos_name = name + " EFTPOS scanner"
+ eftpos_name = "[name] EFTPOS scanner"
print_reference()
else
to_chat(usr, "[bicon(src)]Incorrect code entered.")
@@ -150,11 +131,11 @@
else
to_chat(usr, "[bicon(src)]Unable to connect to accounts database.")
if("trans_purpose")
- var/purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose") as text|null
+ var/purpose = input("Enter reason for EFTPOS transaction", "Transaction purpose", transaction_purpose) as text|null
if(purpose)
transaction_purpose = purpose
if("trans_value")
- var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount") as num
+ var/try_num = input("Enter amount for EFTPOS transaction", "Transaction amount", transaction_amount) as num
if(try_num < 0)
alert("That is not a valid amount!")
else
@@ -168,7 +149,7 @@
else if(linked_account)
transaction_locked = 1
else
- to_chat(usr, "[bicon(src)] No account connected to send transactions to.")
+ to_chat(usr, "[bicon(src)]No account connected to send transactions to.")
if("scan_card")
//attempt to connect to a new db, and if that doesn't work then fail
if(!linked_db)
@@ -176,7 +157,7 @@
if(linked_db && linked_account)
var/obj/item/I = usr.get_active_hand()
if(istype(I, /obj/item/weapon/card))
- scan_card(I)
+ scan_card(I, usr)
else
to_chat(usr, "[bicon(src)]Unable to link accounts.")
if("reset")
@@ -191,12 +172,13 @@
access_code = 0
to_chat(usr, "[bicon(src)]Access code reset to 0.")
- src.attack_self(usr)
+ nanomanager.update_uis(src)
+ return 1
-/obj/item/device/eftpos/proc/scan_card(var/obj/item/weapon/card/I)
+/obj/item/device/eftpos/proc/scan_card(obj/item/weapon/card/I, mob/user)
if(istype(I, /obj/item/weapon/card/id))
var/obj/item/weapon/card/id/C = I
- visible_message("[usr] swipes a card through [src].")
+ visible_message("[user] swipes a card through [src].")
if(transaction_locked && !transaction_paid)
if(linked_account)
var/attempt_pin = input("Enter pin code", "EFTPOS transaction") as num
@@ -204,7 +186,7 @@
if(D)
if(transaction_amount <= D.money)
playsound(src, 'sound/machines/chime.ogg', 50, 1)
- src.visible_message("[bicon(src)] The [src] chimes.")
+ visible_message("[bicon(src)] The [src] chimes.")
transaction_paid = 1
//transfer the money
@@ -233,11 +215,11 @@
T.time = worldtime2text()
linked_account.transaction_log.Add(T)
else
- to_chat(usr, "[bicon(src)]You don't have that much money!")
+ to_chat(user, "[bicon(src)]You don't have that much money!")
else
- to_chat(usr, "[bicon(src)]Unable to access account. Check security settings and try again.")
+ to_chat(user, "[bicon(src)]Unable to access account. Check security settings and try again.")
else
- to_chat(usr, "[bicon(src)]EFTPOS is not connected to an account.")
+ to_chat(user, "[bicon(src)]EFTPOS is not connected to an account.")
else
..()
diff --git a/nano/templates/eftpos.tmpl b/nano/templates/eftpos.tmpl
new file mode 100644
index 00000000000..663f665d7f9
--- /dev/null
+++ b/nano/templates/eftpos.tmpl
@@ -0,0 +1,55 @@
+
+
+{{:data.eftpos_name}}
+This terminal is {{:data.machine_id}}. Report this code when contacting Nanotrasen IT Support
+{{if data.transaction_locked == 1}}
+ {{:helper.link(data.transaction_paid ? 'Reset' : 'Reset (authentication required)', 'unlock', {'choice' : 'toggle_lock'})}}
+
+
+
Transaction purpose:
+
{{:data.transaction_purpose}}
+
+
+
+
Value:
+
{{:data.transaction_amount}}
+
+
+
+
Linked account:
+
{{:data.linked_account ? data.linked_account : 'None'}}
+
+
+ {{if data.transaction_paid}}
+ This transaction has been processed successfully.
+ {{else}}
+ Swipe your card below the line to finish this transaction.
+ {{:helper.link('------', 'eject', {'choice' : 'scan_card'})}}
+ {{/if}}
+{{else}}
+ {{:helper.link('Lock in new transaction', 'lock', {'choice' : 'toggle_lock'})}}
+
+
+
Transaction purpose:
+
{{:helper.link(data.transaction_purpose, 'info', {'choice' : 'trans_purpose'})}}
+
+
+
+
Value:
+
{{:helper.link(data.transaction_amount, 'usd', {'choice' : 'trans_value'})}}
+
+
+
+
Linked account:
+
{{:helper.link(data.linked_account ? data.linked_account : 'None', data.linked_account ? 'user' : 'user-times', {'choice' : 'link_account'})}}
+
+
+
+
{{:helper.link('Change access code', 'key', {'choice' : 'change_code'})}}
+
{{:helper.link('Change EFTPOS ID', 'pencil', {'choice' : 'change_id'})}}
+
{{:helper.link('Scan card to reset acess code', 'refresh', {'choice' : 'reset'})}}
+
+{{/if}}
\ No newline at end of file