diff --git a/code/modules/paperwork/faxmachine.dm b/code/modules/paperwork/faxmachine.dm
index a727a3f59c3..7638cc2ea93 100644
--- a/code/modules/paperwork/faxmachine.dm
+++ b/code/modules/paperwork/faxmachine.dm
@@ -22,6 +22,8 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
var/department = "Unknown" // our department
var/destination = "Central Command" // the department we're sending to
+
+ var/data[0]
/obj/machinery/photocopier/faxmachine/New()
..()
@@ -31,60 +33,50 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
alldepartments |= department
/obj/machinery/photocopier/faxmachine/attack_hand(mob/user as mob)
- user.set_machine(src)
-
- var/dat = "Fax Machine
"
-
- var/scan_name
+ ui_interact(user)
+
+/obj/machinery/photocopier/faxmachine/attackby(obj/item/weapon/item, mob/user)
+ if(istype(item,/obj/item/weapon/card/id) && !scan)
+ scan(item)
+ else if(istype(item, /obj/item/weapon/paper) || istype(item, /obj/item/weapon/photo) || istype(item, /obj/item/weapon/paper_bundle))
+ ..()
+ nanomanager.update_uis(src)
+ else
+ return ..()
+
+/obj/machinery/photocopier/faxmachine/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
if(scan)
- scan_name = scan.name
+ data["scan_name"] = scan.name
else
- scan_name = "--------"
-
- dat += "Confirm Identity: [scan_name]
"
-
- if(authenticated)
- dat += "{Log Out}"
+ data["scan_name"] = "-----"
+ data["authenticated"] = authenticated
+ if(!authenticated)
+ data["network"] = "Disconnected"
+ else if(!emagged)
+ data["network"] = "Central Command Quantum Entanglement Network"
else
- dat += "{Log In}"
-
- dat += "
"
-
- if(authenticated)
- dat += "Logged in to: Central Command Quantum Entanglement Network
"
-
- if(copyitem)
- dat += "Remove Item
"
-
- if(sendcooldown)
- dat += "Transmitter arrays realigning. Please stand by.
"
-
- else
-
- dat += "Send
"
- dat += "Currently sending: [copyitem.name]
"
- dat += "Sending to: [destination]
"
-
- else
- if(sendcooldown)
- dat += "Please insert paper to send via secure connection.
"
- dat += "Transmitter arrays realigning. Please stand by.
"
- else
- dat += "Please insert paper to send via secure connection.
"
-
+ data["network"] = "ERR?*!!*"
+ if(copyitem)
+ data["paper"] = copyitem.name
+ data["paperinserted"] = 1
else
- dat += "Proper authentication is required to use this device.
"
+ data["paper"] = "-----"
+ data["paperinserted"] = 0
+ data["destination"] = destination
+ data["cooldown"] = sendcooldown
- if(copyitem)
- dat += "Remove Item
"
-
- user << browse(dat, "window=copier")
- onclose(user, "copier")
- return
+ ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
+ if (!ui)
+ ui = new(user, src, ui_key, "faxmachine.tmpl", "Fax Machine UI", 540, 450)
+ ui.set_initial_data(data)
+ ui.open()
/obj/machinery/photocopier/faxmachine/Topic(href, href_list)
+ if(..())
+ return 1
+
if(href_list["send"])
- if(copyitem)
+ if(copyitem && authenticated)
if (destination in admin_departments)
send_admin_fax(usr, destination)
else
@@ -93,47 +85,78 @@ var/list/adminfaxes = list() //cache for faxes that have been sent to admins
if (sendcooldown)
spawn(sendcooldown) // cooldown time
sendcooldown = 0
+ nanomanager.update_uis(src)
- else if(href_list["remove"])
+ if(href_list["paper"])
if(copyitem)
copyitem.loc = usr.loc
usr.put_in_hands(copyitem)
usr << "You take \the [copyitem] out of \the [src]."
copyitem = null
- updateUsrDialog()
+ else
+ var/obj/item/I = usr.get_active_hand()
+ if (istype(I, /obj/item/weapon/paper) || istype(I, /obj/item/weapon/photo) || istype(I, /obj/item/weapon/paper_bundle))
+ usr.drop_item()
+ copyitem = I
+ I.loc = src
+ usr << "You insert \the [I] into \the [src]."
+ flick(insert_anim, src)
if(href_list["scan"])
- if (scan)
- if(ishuman(usr))
- scan.loc = usr.loc
- if(!usr.get_active_hand())
- usr.put_in_hands(scan)
- scan = null
- else
- scan.loc = src.loc
- scan = null
+ scan()
+
+ if(href_list["dept"])
+ if(authenticated)
+ var/lastdestination = destination
+ destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
+ if(!destination)
+ destination = lastdestination
+
+ if(href_list["auth"])
+ if((!authenticated) && scan)
+ if(check_access(scan))
+ authenticated = 1
+ else if(authenticated)
+ authenticated = 0
+
+ if(href_list["rename"])
+ if(copyitem)
+ var/n_name = copytext(sanitize(input(usr, "What would you like to label the fax?", "Fax Labelling", copyitem.name) as text), 1, MAX_MESSAGE_LEN)
+ if((copyitem && copyitem.loc == src && usr.stat == 0))
+ if (istype(copyitem, /obj/item/weapon/paper))
+ copyitem.name = "[(n_name ? text("[n_name]") : initial(copyitem.name))]"
+ copyitem.desc = "This is a paper titled '" + copyitem.name + "'."
+ else if(istype(copyitem, /obj/item/weapon/photo))
+ copyitem.name = "[(n_name ? text("[n_name]") : "photo")]"
+ else if(istype(copyitem, /obj/item/weapon/paper_bundle))
+ copyitem.name = "[(n_name ? text("[n_name]") : "paper")]"
+ data["name"] = copyitem.name
+
+ nanomanager.update_uis(src)
+
+/obj/machinery/photocopier/faxmachine/proc/scan(var/obj/item/weapon/card/id/card = null)
+ if (scan) // Card is in machine
+ if(ishuman(usr))
+ scan.loc = usr.loc
+ if(!usr.get_active_hand())
+ usr.put_in_hands(scan)
+ scan = null
else
+ scan.loc = src.loc
+ scan = null
+ else
+ if(!card)
var/obj/item/I = usr.get_active_hand()
if (istype(I, /obj/item/weapon/card/id))
usr.drop_item()
I.loc = src
scan = I
- authenticated = 0
-
- if(href_list["dept"])
- var/lastdestination = destination
- destination = input(usr, "Which department?", "Choose a department", "") as null|anything in (alldepartments + admin_departments)
- if(!destination) destination = lastdestination
-
- if(href_list["auth"])
- if ( (!( authenticated ) && (scan)) )
- if (check_access(scan))
- authenticated = 1
-
- if(href_list["logout"])
- authenticated = 0
-
- updateUsrDialog()
+ else
+ if(istype(card))
+ usr.drop_item()
+ card.loc = src
+ scan = card
+ nanomanager.update_uis(src)
/obj/machinery/photocopier/faxmachine/proc/sendfax(var/destination)
if(stat & (BROKEN|NOPOWER))
diff --git a/code/modules/paperwork/paper.dm b/code/modules/paperwork/paper.dm
index edbe96a1cdc..a1cf50822a5 100644
--- a/code/modules/paperwork/paper.dm
+++ b/code/modules/paperwork/paper.dm
@@ -76,7 +76,7 @@
if((M_CLUMSY in usr.mutations) && prob(50))
usr << "You cut yourself on the paper."
return
- var/n_name = copytext(sanitize(input(usr, "What would you like to label the paper?", "Paper Labelling", null) as text), 1, MAX_MESSAGE_LEN)
+ var/n_name = copytext(sanitize(input(usr, "What would you like to label the paper?", "Paper Labelling", name) as text), 1, MAX_MESSAGE_LEN)
if((loc == usr && usr.stat == 0))
name = "[(n_name ? text("[n_name]") : initial(name))]"
if(name != "paper")
diff --git a/code/modules/paperwork/paper_bundle.dm b/code/modules/paperwork/paper_bundle.dm
index c3ddfb3cbbb..2e834fe0562 100644
--- a/code/modules/paperwork/paper_bundle.dm
+++ b/code/modules/paperwork/paper_bundle.dm
@@ -189,9 +189,9 @@
set category = "Object"
set src in usr
- var/n_name = copytext(sanitize(input(usr, "What would you like to label the bundle?", "Bundle Labelling", null) as text), 1, MAX_MESSAGE_LEN)
+ var/n_name = copytext(sanitize(input(usr, "What would you like to label the bundle?", "Bundle Labelling", name) as text), 1, MAX_MESSAGE_LEN)
if((loc == usr && usr.stat == 0))
- name = "[(n_name ? text("[n_name]") : "paper")]"
+ name = "[(n_name ? text("[n_name]") : "paper bundle")]"
add_fingerprint(usr)
return
diff --git a/code/modules/paperwork/photography.dm b/code/modules/paperwork/photography.dm
index 59973b019f8..e7ee680586a 100644
--- a/code/modules/paperwork/photography.dm
+++ b/code/modules/paperwork/photography.dm
@@ -90,7 +90,7 @@
set category = "Object"
set src in usr
- var/n_name = copytext(sanitize(input(usr, "What would you like to label the photo?", "Photo Labelling", null) as text), 1, MAX_MESSAGE_LEN)
+ var/n_name = copytext(sanitize(input(usr, "What would you like to label the photo?", "Photo Labelling", name) as text), 1, MAX_MESSAGE_LEN)
//loc.loc check is for making possible renaming photos in clipboards
if(( (loc == usr || (loc.loc && loc.loc == usr)) && usr.stat == 0))
name = "[(n_name ? text("[n_name]") : "photo")]"
diff --git a/maps/cyberiad.dmm b/maps/cyberiad.dmm
index 8d56da4d315..1473b41ca08 100644
--- a/maps/cyberiad.dmm
+++ b/maps/cyberiad.dmm
@@ -1308,7 +1308,7 @@
"azh" = (/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 4},/obj/structure/cable{d1 = 4; d2 = 8; icon_state = "4-8"; pixel_x = 0; tag = ""},/turf/simulated/floor/carpet,/area/magistrateoffice)
"azi" = (/obj/machinery/atmospherics/pipe/manifold/hidden/supply{level = 1},/obj/structure/stool/bed/chair/comfy/black,/obj/structure/cable{d1 = 4; d2 = 8; icon_state = "4-8"; pixel_x = 0; tag = ""},/turf/simulated/floor/carpet,/area/magistrateoffice)
"azj" = (/obj/machinery/atmospherics/pipe/simple/hidden/supply{dir = 9; pixel_y = 0},/obj/structure/table/reinforced,/obj/item/device/megaphone,/obj/structure/cable{d1 = 1; d2 = 8; icon_state = "1-8"; tag = ""},/turf/simulated/floor/carpet,/area/magistrateoffice)
-"azk" = (/obj/structure/table/reinforced,/obj/machinery/photocopier/faxmachine{department = "Internal Affairs"},/turf/simulated/floor{tag = "icon-cult"; icon_state = "cult"; dir = 2},/area/lawoffice)
+"azk" = (/obj/structure/table/reinforced,/obj/machinery/photocopier/faxmachine{department = "Internal Affairs Office"},/turf/simulated/floor{tag = "icon-cult"; icon_state = "cult"; dir = 2},/area/lawoffice)
"azl" = (/obj/machinery/atmospherics/unary/vent_pump{dir = 2; on = 1},/turf/simulated/floor{tag = "icon-cult"; icon_state = "cult"; dir = 2},/area/lawoffice)
"azm" = (/obj/structure/stool/bed/chair/office/dark{dir = 4},/obj/effect/landmark/start{name = "Internal Affairs Agent"},/turf/simulated/floor{tag = "icon-cult"; icon_state = "cult"; dir = 2},/area/lawoffice)
"azn" = (/obj/structure/table/reinforced,/turf/simulated/floor{tag = "icon-cult"; icon_state = "cult"; dir = 2},/area/lawoffice)
diff --git a/nano/templates/faxmachine.tmpl b/nano/templates/faxmachine.tmpl
new file mode 100644
index 00000000000..1e00c559b28
--- /dev/null
+++ b/nano/templates/faxmachine.tmpl
@@ -0,0 +1,67 @@
+
+
+
Authorization
+
+
+
+ Confirm identity:
+
+
+ {{:helper.link(data.scan_name, 'eject', {'scan' : 1})}}
+
+
+
+
+ Authorize:
+
+
+ {{:helper.link(data.authenticated ? 'Log Out' : 'Log In', data.authenticated ? 'unlocked' : 'locked', {'auth' : 1})}}
+
+
+
+
+
Fax Menu
+
+
+
+ Network:
+
+
+
+ {{:data.network}}
+
+
+
+
+ Currently sending:
+
+
+ {{:helper.link(data.paper, 'eject', {'paper' : 1})}}
+ {{if data.paperinserted}}
+ {{:helper.link('Rename', 'pencil', {'rename' : 1})}}
+ {{/if}}
+
+
+
+
+ Sending to:
+
+
+ {{:helper.link(data.destination, 'print', {'dept' : 1}, !data.authenticated ? 'disabled' : '')}}
+
+
+
+
+ Action:
+
+
+ {{if data.authenticated}}
+ {{:helper.link(data.cooldown ? "Realigning" : "Send", data.cooldown ? 'clock' : "mail-closed", {'send' : 1}, data.cooldown ? 'disabled' : "")}}
+ {{else}}
+ {{:helper.link(data.cooldown ? "Realigning" : "Send", data.cooldown ? 'clock' : "mail-closed", null, !data.authenticated ? 'disabled' : "")}}
+ {{/if}}
+
+
\ No newline at end of file