diff --git a/code/game/machinery/requests_console.dm b/code/game/machinery/requests_console.dm
index ca0b150fe6..7e2d521698 100644
--- a/code/game/machinery/requests_console.dm
+++ b/code/game/machinery/requests_console.dm
@@ -7,6 +7,7 @@
#define RC_INFO 4 //Relay Info
//Request Console Screens
+#define RCS_MAINMENU 0 // Main menu
#define RCS_RQASSIST 1 // Request supplies
#define RCS_RQSUPPLY 2 // Request assistance
#define RCS_SENDINFO 3 // Relay information
@@ -15,7 +16,6 @@
#define RCS_VIEWMSGS 6 // View messages
#define RCS_MESSAUTH 7 // Authentication before sending
#define RCS_ANNOUNCE 8 // Send announcement
-#define RCS_MAINMENU 9 // Main menu
var/req_console_assistance = list()
var/req_console_supplies = list()
@@ -29,13 +29,12 @@ var/list/obj/machinery/requests_console/allConsoles = list()
icon = 'icons/obj/terminals.dmi'
icon_state = "req_comp0"
var/department = "Unknown" //The list of all departments on the station (Determined from this variable on each unit) Set this to the same thing if you want several consoles in one department
- var/list/messages = list() //List of all messages
+ var/list/message_log = list() //List of all messages
var/departmentType = 0 //Bitflag. Zero is reply-only. Map currently uses raw numbers instead of defines.
var/newmessagepriority = 0
// 0 = no new message
// 1 = normal priority
// 2 = high priority
- // 3 = extreme priority - not implemented, will probably require some hacking... everything needs to have a hidden feature in this game.
var/screen = RCS_MAINMENU
var/silent = 0 // set to 1 for it not to beep all the time
// var/hackState = 0
@@ -49,7 +48,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
var/msgVerified = "" //Will contain the name of the person who varified it
var/msgStamped = "" //If a message is stamped, this will contain the stamp name
var/message = "";
- var/dpt = ""; //the department which will be receiving the message
+ var/recipient = ""; //the department which will be receiving the message
var/priority = -1 ; //Priority of the message being sent
light_range = 0
var/datum/announcement/announcement = new
@@ -64,7 +63,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
icon_state = "req_comp_off"
else
if(icon_state == "req_comp_off")
- icon_state = "req_comp0"
+ icon_state = "req_comp[newmessagepriority]"
/obj/machinery/requests_console/New()
..()
@@ -80,6 +79,8 @@ var/list/obj/machinery/requests_console/allConsoles = list()
req_console_supplies |= department
if (departmentType & RC_INFO)
req_console_information |= department
+
+ set_light(1)
/obj/machinery/requests_console/Destroy()
allConsoles -= src
@@ -100,105 +101,34 @@ var/list/obj/machinery/requests_console/allConsoles = list()
/obj/machinery/requests_console/attack_hand(user as mob)
if(..(user))
return
- var/dat
- dat = text("
Requests Console[department] Requests Console
")
- if(!open)
- switch(screen)
- if(RCS_RQASSIST) //req. assistance
- dat += text("Which department do you need assistance from?
")
- for(var/dpt in req_console_assistance)
- if (dpt != department)
- dat += text("[dpt] (Message or ")
- dat += text("High Priority")
-// if (hackState == 1)
-// dat += text(" or EXTREME)")
- dat += text(")
")
- dat += text("
Back
")
+ ui_interact(user)
- if(RCS_RQSUPPLY) //req. supplies
- dat += text("Which department do you need supplies from?
")
- for(var/dpt in req_console_supplies)
- if (dpt != department)
- dat += text("[dpt] (Message or ")
- dat += text("High Priority")
-// if (hackState == 1)
-// dat += text(" or EXTREME)")
- dat += text(")
")
- dat += text("
Back
")
+/obj/machinery/requests_console/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null, var/force_open = 1)
+ var/data[0]
- if(RCS_SENDINFO) //relay information
- dat += text("Which department would you like to send information to?
")
- for(var/dpt in req_console_information)
- if (dpt != department)
- dat += text("[dpt] (Message or ")
- dat += text("High Priority")
-// if (hackState == 1)
-// dat += text(" or EXTREME)")
- dat += text(")
")
- dat += text("
Back
")
+ data["department"] = department
+ data["screen"] = screen
+ data["message_log"] = message_log
+ data["newmessagepriority"] = newmessagepriority
+ data["silent"] = silent
+ data["announcementConsole"] = announcementConsole
- if(RCS_SENTPASS) //sent successfully
- dat += text("Message sent
")
- dat += text("Continue
")
+ data["assist_dept"] = req_console_assistance
+ data["supply_dept"] = req_console_supplies
+ data["info_dept"] = req_console_information
- if(RCS_SENTFAIL) //unsuccessful; not sent
- dat += text("An error occurred.
")
- dat += text("Continue
")
+ data["message"] = message
+ data["recipient"] = recipient
+ data["priortiy"] = priority
+ data["msgStamped"] = msgStamped
+ data["msgVerified"] = msgVerified
+ data["announceAuth"] = announceAuth
- if(RCS_VIEWMSGS) //view messages
- for (var/obj/machinery/requests_console/Console in allConsoles)
- if (Console.department == department)
- Console.newmessagepriority = 0
- Console.icon_state = "req_comp0"
- Console.set_light(1)
- newmessagepriority = 0
- icon_state = "req_comp0"
- for(var/msg in messages)
- dat += text("[msg]
")
- dat += text("Back to main menu
")
-
- if(RCS_MESSAUTH) //authentication before sending
- dat += text("Message Authentication
")
- dat += text("Message for [dpt]: [message]
")
- dat += text("You may authenticate your message now by scanning your ID or your stamp
")
- dat += text("Validated by: [msgVerified]
");
- dat += text("Stamped by: [msgStamped]
");
- dat += text("Send
");
- dat += text("
Back
")
-
- if(RCS_ANNOUNCE) //send announcement
- dat += text("Station wide announcement
")
- if(announceAuth)
- dat += text("Authentication accepted
")
- else
- dat += text("Swipe your card to authenticate yourself.
")
- dat += text("Message: [message] Write
")
- if (announceAuth && message)
- dat += text("Announce
");
- dat += text("
Back
")
-
- else //main menu
- screen = RCS_MAINMENU
- reset_announce()
- if (newmessagepriority == 1)
- dat += text("There are new messages
")
- if (newmessagepriority == 2)
- dat += text("NEW PRIORITY MESSAGES
")
- dat += text("View Messages
")
-
- dat += text("Request Assistance
")
- dat += text("Request Supplies
")
- dat += text("Relay Anonymous Information
")
- if(announcementConsole)
- dat += text("Send station-wide announcement
")
- if (silent)
- dat += text("Speaker OFF")
- else
- dat += text("Speaker ON")
-
- user << browse("[dat]", "window=request_console")
- onclose(user, "req_console")
- return
+ ui = nanomanager.try_update_ui(user, src, ui_key, ui, data, force_open)
+ if (!ui)
+ ui = new(user, src, ui_key, "request_console.tmpl", "[department] Request Console", 520, 410)
+ ui.set_initial_data(data)
+ ui.open()
/obj/machinery/requests_console/Topic(href, href_list)
if(..()) return
@@ -206,38 +136,30 @@ var/list/obj/machinery/requests_console/allConsoles = list()
add_fingerprint(usr)
if(reject_bad_text(href_list["write"]))
- dpt = ckey(href_list["write"]) //write contains the string of the receiving department's name
+ recipient = href_list["write"] //write contains the string of the receiving department's name
var/new_message = sanitize(input("Write your message:", "Awaiting Input", ""))
if(new_message)
message = new_message
screen = RCS_MESSAUTH
switch(href_list["priority"])
+ if("1") priority = 1
if("2") priority = 2
- else priority = -1
+ else priority = 0
else
- dpt = "";
- msgVerified = ""
- msgStamped = ""
- screen = RCS_MAINMENU
- priority = -1
+ reset_message(1)
if(href_list["writeAnnouncement"])
var/new_message = sanitize(input("Write your message:", "Awaiting Input", ""))
if(new_message)
message = new_message
- switch(href_list["priority"])
- if("2") priority = 2
- else priority = -1
else
- reset_announce()
- screen = RCS_MAINMENU
+ reset_message(1)
if(href_list["sendAnnouncement"])
if(!announcementConsole) return
announcement.Announce(message, msg_sanitized = 1)
- reset_announce()
- screen = RCS_MAINMENU
+ reset_message(1)
if( href_list["department"] && message )
var/log_msg = message
@@ -245,38 +167,37 @@ var/list/obj/machinery/requests_console/allConsoles = list()
screen = RCS_SENTFAIL
for (var/obj/machinery/message_server/MS in world)
if(!MS.active) continue
- MS.send_rc_message(href_list["department"],department,log_msg,msgStamped,msgVerified,priority)
+ MS.send_rc_message(ckey(href_list["department"]),department,log_msg,msgStamped,msgVerified,priority)
pass = 1
if(pass)
screen = RCS_SENTPASS
- messages += "Message sent to [dpt]
[message]"
+ message_log += "Message sent to [recipient]
[message]"
else
audible_message(text("\icon[src] *The Requests Console beeps: 'NOTICE: No server detected!'"),,4)
-
//Handle screen switching
- var/tempScreen = text2num(href_list["setScreen"])
- if(tempScreen)
+ if(href_list["setScreen"])
+ var/tempScreen = text2num(href_list["setScreen"])
if(tempScreen == RCS_ANNOUNCE && !announcementConsole)
return
+ if(tempScreen == RCS_VIEWMSGS)
+ for (var/obj/machinery/requests_console/Console in allConsoles)
+ if (Console.department == department)
+ Console.newmessagepriority = 0
+ Console.icon_state = "req_comp0"
+ Console.set_light(1)
if(tempScreen == RCS_MAINMENU)
- dpt = ""
- msgVerified = ""
- msgStamped = ""
- message = ""
- priority = -1
+ reset_message()
screen = tempScreen
//Handle silencing the console
- switch( href_list["setSilent"] )
- if(null) //skip
- if("1") silent = 1
- else silent = 0
+ if(href_list["toggleSilent"])
+ silent = !silent
updateUsrDialog()
return
- //err... hacking code, which has no reason for existing... but anyway... it's supposed to unlock priority 3 messanging on that console (EXTREME priority...) the code for that actually exists.
+ //err... hacking code, which has no reason for existing... but anyway... it was once supposed to unlock priority 3 messanging on that console (EXTREME priority...), but the code for that was removed.
/obj/machinery/requests_console/attackby(var/obj/item/weapon/O as obj, var/mob/user as mob)
/*
if (istype(O, /obj/item/weapon/crowbar))
@@ -301,6 +222,7 @@ var/list/obj/machinery/requests_console/allConsoles = list()
user << "You can't do much with that."*/
if (istype(O, /obj/item/weapon/card/id))
+ if(inoperable(MAINT)) return
if(screen == RCS_MESSAUTH)
var/obj/item/weapon/card/id/T = O
msgVerified = text("Verified by [T.registered_name] ([T.assignment])")
@@ -311,27 +233,24 @@ var/list/obj/machinery/requests_console/allConsoles = list()
announceAuth = 1
announcement.announcer = ID.assignment ? "[ID.assignment] [ID.registered_name]" : ID.registered_name
else
- reset_announce()
+ reset_message()
user << "You are not authorized to send announcements."
updateUsrDialog()
if (istype(O, /obj/item/weapon/stamp))
+ if(inoperable(MAINT)) return
if(screen == RCS_MESSAUTH)
var/obj/item/weapon/stamp/T = O
msgStamped = text("Stamped with the [T.name]")
updateUsrDialog()
return
-/obj/machinery/requests_console/proc/reset_announce()
- announceAuth = 0
+/obj/machinery/requests_console/proc/reset_message(var/mainmenu = 0)
message = ""
+ recipient = ""
+ priority = 0
+ msgVerified = ""
+ msgStamped = ""
+ announceAuth = 0
announcement.announcer = ""
-
-#undef RCS_RQASSIST
-#undef RCS_RQSUPPLY
-#undef RCS_SENDINFO
-#undef RCS_SENTPASS
-#undef RCS_SENTFAIL
-#undef RCS_VIEWMSGS
-#undef RCS_MESSAUTH
-#undef RCS_ANNOUNCE
-#undef RCS_MAINMENU
+ if(mainmenu)
+ screen = RCS_MAINMENU
diff --git a/code/modules/events/prison_break.dm b/code/modules/events/prison_break.dm
index 99a69a36eb..d10659e24e 100644
--- a/code/modules/events/prison_break.dm
+++ b/code/modules/events/prison_break.dm
@@ -44,27 +44,12 @@
for(var/area/A in world)
if(is_type_in_list(A,areaType) && !is_type_in_list(A,areaNotType))
areas += A
+
if(areas && areas.len > 0)
- var/pass = 0
var/my_department = "[station_name()] firewall subroutines"
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [worldtime2text()]. Systems will be fully compromised within approximately three minutes. Direct intervention is required immediately.
"
for(var/obj/machinery/message_server/MS in world)
MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2)
- pass = 1
- if(pass) //This entire block should be handled by send_rc_message(). I'm not rewriting it.
- var/sending = rc_message + "Message dispatched by [my_department]."
- for (var/obj/machinery/requests_console/Console in allConsoles)
- var/keyed_department = ckey(Console.department)
- if(keyed_department == ckey("Engineering"))
- if(Console.newmessagepriority < 2)
- Console.newmessagepriority = 2
- Console.icon_state = "req_comp2"
- if(!Console.silent)
- playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
- for (var/mob/O in hearers(5, Console.loc))
- O.show_message(text("\icon[Console] *The Requests Console beeps: 'PRIORITY Alert in [my_department]'"))
- Console.messages += "High Priority message from [my_department]
[sending]"
-
for(var/mob/living/silicon/ai/A in player_list)
A << "Malicious program detected in the [english_list(areaName)] lighting and airlock control systems by [my_department]."
diff --git a/code/modules/research/message_server.dm b/code/modules/research/message_server.dm
index 7e3ec70149..f89e8a20cd 100644
--- a/code/modules/research/message_server.dm
+++ b/code/modules/research/message_server.dm
@@ -115,6 +115,9 @@ var/global/list/obj/machinery/message_server/message_servers = list()
authmsg += "[stamp]
"
for (var/obj/machinery/requests_console/Console in allConsoles)
if (ckey(Console.department) == ckey(recipient))
+ if(Console.inoperable())
+ Console.message_log += "Message lost due to console failure.
Please contact [station_name()] system adminsitrator or AI for technical assistance.
"
+ continue
if(Console.newmessagepriority < priority)
Console.newmessagepriority = priority
Console.icon_state = "req_comp[priority]"
@@ -123,17 +126,12 @@ var/global/list/obj/machinery/message_server/message_servers = list()
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("\icon[Console] *The Requests Console beeps: 'PRIORITY Alert in [sender]'"),,5)
- Console.messages += "High Priority message from [sender]
[authmsg]"
- if(3)
- if(!Console.silent)
- playsound(Console.loc, 'sound/machines/twobeep.ogg', 70, 1)
- Console.audible_message(text("\icon[Console] *The Requests Console yells: 'EXTREME PRIORITY alert in [sender]'"),,7)
- Console.messages += "Extreme Priority message from [sender]
[authmsg]"
+ Console.message_log += "High Priority message from [sender]
[authmsg]"
else
if(!Console.silent)
playsound(Console.loc, 'sound/machines/twobeep.ogg', 50, 1)
Console.audible_message(text("\icon[Console] *The Requests Console beeps: 'Message from [sender]'"),,4)
- Console.messages += "Message from [sender]
[authmsg]"
+ Console.message_log += "Message from [sender]
[authmsg]"
Console.set_light(2)
diff --git a/html/changelogs/Techhead-RCNanoUI.yml b/html/changelogs/Techhead-RCNanoUI.yml
new file mode 100644
index 0000000000..a8c5f425dc
--- /dev/null
+++ b/html/changelogs/Techhead-RCNanoUI.yml
@@ -0,0 +1,4 @@
+author: Techhead
+delete-after: True
+changes:
+ - rscadd: "Converted Request Console interface into NanoUI."
diff --git a/nano/templates/request_console.tmpl b/nano/templates/request_console.tmpl
new file mode 100644
index 0000000000..f14e27190f
--- /dev/null
+++ b/nano/templates/request_console.tmpl
@@ -0,0 +1,122 @@
+
+
+{{if data.screen == 1}}
+ Request assistance from another department.
+
+ {{for data.assist_dept}}
+ {{if value != data.department}}
+
+ {{:value}} - |
+ {{:helper.link('Message', null, { 'write' : value , 'priority' : 1 })}} |
+ {{:helper.link('High Priority', null, { 'write' : value , 'priority' : 2 })}} |
+
+ {{/if}}
+ {{empty}}
+ There are no available departments to request assistance from. |
+ {{/for}}
+
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+{{else data.screen == 2}}
+ Request supplies from another department.
+
+ {{for data.supply_dept}}
+ {{if value != data.department}}
+
+ {{:value}} - |
+ {{:helper.link('Message', null, { 'write' : value , 'priority' : 1 })}} |
+ {{:helper.link('High Priority', null, { 'write' : value , 'priority' : 2 })}} |
+
+ {{/if}}
+ {{empty}}
+ There are no available departments to request supplies from. |
+ {{/for}}
+
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+{{else data.screen == 3}}
+ Relay info to another department.
+
+ {{for data.info_dept}}
+ {{if value != data.department}}
+
+ {{:value}} - |
+ {{:helper.link('Message', null, { 'write' : value , 'priority' : 1 })}} |
+ {{:helper.link('High Priority', null, { 'write' : value , 'priority' : 2 })}} |
+
+ {{/if}}
+ {{empty}}
+ There are no available departments to relay information to. |
+ {{/for}}
+
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+{{else data.screen == 4}}
+ Message sent successfully.
+ {{:helper.link('Continue', 'arrowthick-1-e', { 'setScreen' : 0 })}}
+{{else data.screen == 5}}
+ An Error occured. Message not sent.
+ {{:helper.link('Continue', 'arrowthick-1-e', { 'setScreen' : 0 })}}
+{{else data.screen == 6}}
+
+ {{for data.message_log}}
+
{{:value}}
+ {{empty}}
+
No messages have been recieved.
+ {{/for}}
+
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+{{else data.screen == 7}}
+ Message Authentication
+
+
Message for {{:data.recipient}}: {{:data.message}}
+
Validated by: {{:data.msgVerified}}
+
Stamped by: {{:data.msgStamped}}
+
+
+ {{:helper.link('Send Message', 'arrowthick-1-e', { 'department' : data.recipient })}}
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+
+{{else data.screen == 8}}
+ Station wide announcement
+ Message: {{:data.message}} {{:helper.link('Write Message', 'pencil', { 'writeAnnouncement' : 1 })}}
+
+ {{if data.announceAuth}}
+ ID verified. Authentication accepted.
+ {{else}}
+ Swipe your ID card to authenticate yourself.
+ {{/if}}
+
+
+ {{:helper.link('Announce', 'signal-diag', { 'sendAnnouncement' : 1 }, (data.announceAuth && data.message) ? null : 'disabled' )}}
+ {{:helper.link('Back', 'arrowreturnthick-1-w', { 'setScreen' : 0 })}}
+
+{{else}}
+ {{if data.newmessagepriority == 1}}
+ There are new messages
+ {{else data.newmessagepriority == 2}}
+ NEW PRIORITY MESSAGES
+ {{/if}}
+ {{:helper.link('View Messages', data.newmessagepriority ? 'mail-closed' : 'mail-open', { 'setScreen' : 6 })}}
+
+ {{:helper.link('Request Assistance', 'gear', { 'setScreen' : 1 })}}
+ {{:helper.link('Request Supplies', 'gear', { 'setScreen' : 2 })}}
+ {{:helper.link('Relay Anonymous Information', 'gear', { 'setScreen' : 3})}}
+
+ {{if data.announcementConsole}}
+ {{:helper.link('Send Station-wide Announcement', 'signal-diag', { 'setScreen' : 8})}}
+
+ {{/if}}
+ {{:helper.link(data.silent ? 'Speaker OFF' : 'Speaker ON', data.silent ? 'volume-off' : 'volume-on', { 'toggleSilent' : 1})}}
+{{/if}}
\ No newline at end of file