[TGUI] Communications Console

This commit is contained in:
Kyep
2020-08-28 02:43:35 -07:00
parent ebba3a322b
commit 4f2c185bc7
14 changed files with 412 additions and 681 deletions
+1 -1
View File
@@ -192,7 +192,7 @@ SUBSYSTEM_DEF(shuttle)
var/obj/machinery/computer/communications/C = thing
if(C.stat & BROKEN)
continue
else if(istype(thing, /datum/computer_file/program/comm) || istype(thing, /obj/item/circuitboard/communications))
else if(istype(thing, /obj/item/circuitboard/communications))
continue
var/turf/T = get_turf(thing)
+1 -1
View File
@@ -40,7 +40,7 @@
aiPlayer.set_zeroth_law(law)
to_chat(aiPlayer, "Laws Updated: [law]")
print_command_report(intercepttext, interceptname)
print_command_report(intercepttext, interceptname, FALSE)
GLOB.event_announcement.Announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg', from = "[command_name()] Update")
/datum/station_state
+1 -1
View File
@@ -507,7 +507,7 @@ proc/display_roundstart_logout_report()
message_text += G.get_report()
message_text += "<hr>"
print_command_report(message_text, "[command_name()] Orders")
print_command_report(message_text, "[command_name()] Orders", FALSE)
/datum/game_mode/proc/declare_station_goal_completion()
for(var/V in station_goals)
@@ -7,7 +7,7 @@
var/swarmer_report = "<font size=3><b>[command_name()] High-Priority Update</b></span>"
swarmer_report += "<br><br>Our long-range sensors have detected an odd signal emanating from your station's gateway. We recommend immediate investigation of your gateway, as something may have come \
through."
print_command_report(swarmer_report, "Classified [command_name()] Update")
print_command_report(swarmer_report, "Classified [command_name()] Update", FALSE)
GLOB.event_announcement.Announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg')
/datum/event/spawn_swarmer/start()
+102 -141
View File
@@ -1,7 +1,6 @@
#define COMM_SCREEN_MAIN 1
#define COMM_SCREEN_STAT 2
#define COMM_SCREEN_MESSAGES 3
#define COMM_SCREEN_SECLEVEL 4
#define COMM_AUTHENTICATION_NONE 0
#define COMM_AUTHENTICATION_MIN 1
@@ -16,20 +15,23 @@
req_access = list(ACCESS_HEADS)
circuit = /obj/item/circuitboard/communications
var/prints_intercept = 1
var/authenticated = COMM_AUTHENTICATION_NONE
var/list/messagetitle = list()
var/list/messagetext = list()
var/currmsg = 0
var/aicurrmsg = 0
var/authenticated = COMM_AUTHENTICATION_NONE
var/menu_state = COMM_SCREEN_MAIN
var/ai_menu_state = COMM_SCREEN_MAIN
var/aicurrmsg = 0
var/message_cooldown = 0
var/centcomm_message_cooldown = 0
var/tmp_alertlevel = 0
var/stat_msg1
var/stat_msg2
var/display_type="blank"
var/display_type = "blank"
var/display_icon
var/datum/announcement/priority/crew_announcement = new
@@ -70,73 +72,66 @@
feedback_inc("alert_comms_blue",1)
tmp_alertlevel = 0
/obj/machinery/computer/communications/Topic(href, href_list)
if(..(href, href_list))
return 1
if(!is_secure_level(src.z))
/obj/machinery/computer/communications/tgui_act(action, params)
if(..())
return
if(!is_secure_level(z))
to_chat(usr, "<span class='warning'>Unable to establish a connection: You're too far away from the station!</span>")
return 1
return
if(href_list["login"])
. = TRUE
if(action == "auth")
if(!ishuman(usr))
to_chat(usr, "<span class='warning'>Access denied.</span>")
return FALSE
// Logout function.
if(authenticated != COMM_AUTHENTICATION_NONE)
authenticated = COMM_AUTHENTICATION_NONE
crew_announcement.announcer = null
setMenuState(usr, COMM_SCREEN_MAIN)
return
// Login function.
var/list/access = usr.get_access()
if(allowed(usr))
authenticated = COMM_AUTHENTICATION_MIN
if(ACCESS_CAPTAIN in access)
authenticated = COMM_AUTHENTICATION_MAX
var/mob/living/carbon/human/H = usr
var/obj/item/card/id = H.get_idcard(TRUE)
if(istype(id))
crew_announcement.announcer = GetNameAndAssignmentFromId(id)
SSnanoui.update_uis(src)
return
if(href_list["logout"])
authenticated = COMM_AUTHENTICATION_NONE
crew_announcement.announcer = ""
setMenuState(usr,COMM_SCREEN_MAIN)
SSnanoui.update_uis(src)
if(authenticated == COMM_AUTHENTICATION_NONE)
to_chat(usr, "<span class='warning'>You need to swipe your ID.</span>")
return
// All functions below this point require authentication.
if(!is_authenticated(usr))
return 1
return FALSE
switch(href_list["operation"])
switch(action)
if("main")
setMenuState(usr,COMM_SCREEN_MAIN)
if("changeseclevel")
setMenuState(usr,COMM_SCREEN_SECLEVEL)
setMenuState(usr, COMM_SCREEN_MAIN)
if("newalertlevel")
if(isAI(usr) || isrobot(usr))
to_chat(usr, "<span class='warning'>Firewalls prevent you from changing the alert level.</span>")
return 1
return
else if(usr.can_admin_interact())
change_security_level(text2num(href_list["level"]))
return 1
change_security_level(text2num(params["level"]))
return
else if(!ishuman(usr))
to_chat(usr, "<span class='warning'>Security measures prevent you from changing the alert level.</span>")
return 1
return
var/mob/living/carbon/human/L = usr
var/obj/item/card = L.get_active_hand()
var/obj/item/card/id/I = (card && card.GetID()) || L.wear_id || L.wear_pda
if(istype(I, /obj/item/pda))
var/obj/item/pda/pda = I
I = pda.id
if(I && istype(I))
var/mob/living/carbon/human/H = usr
var/obj/item/card/id/I = H.get_idcard(TRUE)
if(istype(I))
if(ACCESS_CAPTAIN in I.access)
change_security_level(text2num(href_list["level"]))
change_security_level(text2num(params["level"]))
else
to_chat(usr, "<span class='warning'>You are not authorized to do this.</span>")
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
else
to_chat(usr, "<span class='warning'>You need to swipe your ID.</span>")
@@ -144,11 +139,9 @@
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(message_cooldown)
to_chat(usr, "<span class='warning'>Please allow at least one minute to pass between announcements.</span>")
SSnanoui.update_uis(src)
return
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
if(!input || message_cooldown || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return
crew_announcement.Announce(input)
message_cooldown = 1
@@ -158,35 +151,34 @@
if("callshuttle")
var/input = clean_input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","")
if(!input || ..() || !is_authenticated(usr))
SSnanoui.update_uis(src)
return
call_shuttle_proc(usr, input)
if(SSshuttle.emergency.timer)
post_status("shuttle")
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
if("cancelshuttle")
if(isAI(usr) || isrobot(usr))
to_chat(usr, "<span class='warning'>Firewalls prevent you from recalling the shuttle.</span>")
SSnanoui.update_uis(src)
return 1
return
var/response = alert("Are you sure you wish to recall the shuttle?", "Confirm", "Yes", "No")
if(response == "Yes")
cancel_call_proc(usr)
if(SSshuttle.emergency.timer)
post_status("shuttle")
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
if("messagelist")
currmsg = 0
if(href_list["msgid"])
setCurrentMessage(usr, text2num(href_list["msgid"]))
setMenuState(usr,COMM_SCREEN_MESSAGES)
aicurrmsg = 0
if(params["msgid"])
setCurrentMessage(usr, text2num(params["msgid"]))
setMenuState(usr, COMM_SCREEN_MESSAGES)
if("delmessage")
if(href_list["msgid"])
currmsg = text2num(href_list["msgid"])
if(params["msgid"])
currmsg = text2num(params["msgid"])
var/response = alert("Are you sure you wish to delete this message?", "Confirm", "Yes", "No")
if(response == "Yes")
if(currmsg)
@@ -199,40 +191,41 @@
currmsg = 0
if(aicurrmsg == id)
aicurrmsg = 0
setMenuState(usr,COMM_SCREEN_MESSAGES)
setMenuState(usr, COMM_SCREEN_MESSAGES)
if("status")
setMenuState(usr,COMM_SCREEN_STAT)
setMenuState(usr, COMM_SCREEN_STAT)
// Status display stuff
if("setstat")
display_type=href_list["statdisp"]
display_type = params["statdisp"]
switch(display_type)
if("message")
display_icon = null
post_status("message", stat_msg1, stat_msg2, usr)
if("alert")
post_status("alert", href_list["alert"], user = usr)
display_icon = params["alert"]
post_status("alert", params["alert"], user = usr)
else
post_status(href_list["statdisp"], user = usr)
setMenuState(usr,COMM_SCREEN_STAT)
display_icon = null
post_status(params["statdisp"], user = usr)
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg1")
stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1)
setMenuState(usr,COMM_SCREEN_STAT)
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg2")
stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2)
setMenuState(usr,COMM_SCREEN_STAT)
setMenuState(usr, COMM_SCREEN_STAT)
if("nukerequest")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(centcomm_message_cooldown)
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
SSnanoui.update_uis(src)
return
var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return
Nuke_request(input, usr)
to_chat(usr, "<span class='notice'>Request sent.</span>")
@@ -241,17 +234,15 @@
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
if("MessageCentcomm")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(centcomm_message_cooldown)
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
SSnanoui.update_uis(src)
return
var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return
Centcomm_announce(input, usr)
print_centcom_report(input, station_time_timestamp() + " Captain's Message")
@@ -260,18 +251,16 @@
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
// OMG SYNDICATE ...LETTERHEAD
if("MessageSyndicate")
if((is_authenticated(usr) == COMM_AUTHENTICATION_MAX) && (src.emagged))
if(centcomm_message_cooldown)
to_chat(usr, "Arrays recycling. Please stand by.")
SSnanoui.update_uis(src)
return
var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return
Syndicate_announce(input, usr)
to_chat(usr, "Message transmitted.")
@@ -279,12 +268,12 @@
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
if("RestoreBackup")
to_chat(usr, "Backup routing data restored!")
src.emagged = 0
setMenuState(usr,COMM_SCREEN_MAIN)
setMenuState(usr, COMM_SCREEN_MAIN)
if("RestartNanoMob")
if(SSmob_hunt)
@@ -298,14 +287,13 @@
else
to_chat(usr, "<span class='danger'>Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.</span>")
SSnanoui.update_uis(src)
return 1
/obj/machinery/computer/communications/emag_act(user as mob)
if(!emagged)
src.emagged = 1
to_chat(user, "<span class='notice'>You scramble the communication routing circuits!</span>")
SSnanoui.update_uis(src)
SStgui.update_uis(src)
/obj/machinery/computer/communications/attack_ai(var/mob/user as mob)
return src.attack_hand(user)
@@ -321,28 +309,25 @@
to_chat(user, "<span class='warning'>Unable to establish a connection: You're too far away from the station!</span>")
return
ui_interact(user)
tgui_interact(user)
/obj/machinery/computer/communications/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
// update the ui if it exists, returns null if no ui is passed/found
ui = SSnanoui.try_update_ui(user, src, ui_key, ui)
/obj/machinery/computer/communications/tgui_interact(mob/user, ui_key = "main", datum/tgui/ui = null, force_open = TRUE, datum/tgui/master_ui = null, datum/tgui_state/state = GLOB.tgui_default_state)
ui = SStgui.try_update_ui(user, src, ui_key, ui, force_open)
if(!ui)
// the ui does not exist, so we'll create a new() one
// for a list of parameters and their descriptions see the code docs in \code\modules\nano\nanoui.dm
ui = new(user, src, ui_key, "comm_console.tmpl", "Communications Console", 400, 500)
// open the new ui window
ui = new(user, src, ui_key, "CommunicationsComputer", name, 500, 600, master_ui, state)
ui.open()
/obj/machinery/computer/communications/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
var/data[0]
data["is_ai"] = isAI(user) || isrobot(user)
data["menu_state"] = data["is_ai"] ? ai_menu_state : menu_state
data["emagged"] = emagged
data["authenticated"] = is_authenticated(user, 0)
data["screen"] = getMenuState(usr)
/obj/machinery/computer/communications/tgui_data(mob/user)
. = list()
.["is_ai"] = isAI(user) || isrobot(user)
.["menu_state"] = .["is_ai"] ? ai_menu_state : menu_state
.["emagged"] = emagged
.["authenticated"] = is_authenticated(user, 0)
.["authmax"] = .["authenticated"] == COMM_AUTHENTICATION_MAX ? TRUE : FALSE
data["stat_display"] = list(
.["stat_display"] = list(
"type" = display_type,
"icon" = display_icon,
"line_1" = (stat_msg1 ? stat_msg1 : "-----"),
"line_2" = (stat_msg2 ? stat_msg2 : "-----"),
@@ -360,39 +345,36 @@
)
)
data["security_level"] = GLOB.security_level
data["str_security_level"] = capitalize(get_security_level())
data["levels"] = list(
list("id" = SEC_LEVEL_GREEN, "name" = "Green"),
list("id" = SEC_LEVEL_BLUE, "name" = "Blue"),
//SEC_LEVEL_RED = list("name"="Red"),
.["security_level"] = GLOB.security_level
.["str_security_level"] = capitalize(get_security_level())
.["levels"] = list(
list("id" = SEC_LEVEL_GREEN, "name" = "Green", "icon" = "dove"),
list("id" = SEC_LEVEL_BLUE, "name" = "Blue", "icon" = "eye"),
)
var/list/msg_data = list()
for(var/i = 1; i <= messagetext.len; i++)
msg_data.Add(list(list("title" = messagetitle[i], "body" = messagetext[i], "id" = i)))
data["messages"] = msg_data
if((data["is_ai"] && aicurrmsg) || (!data["is_ai"] && currmsg))
data["current_message"] = data["is_ai"] ? messagetext[aicurrmsg] : messagetext[currmsg]
data["current_message_title"] = data["is_ai"] ? messagetitle[aicurrmsg] : messagetitle[currmsg]
.["messages"] = msg_data
data["lastCallLoc"] = SSshuttle.emergencyLastCallLoc ? format_text(SSshuttle.emergencyLastCallLoc.name) : null
.["current_message"] = null
.["current_message_title"] = null
if((.["is_ai"] && aicurrmsg) || (!.["is_ai"] && currmsg))
.["current_message"] = .["is_ai"] ? messagetext[aicurrmsg] : messagetext[currmsg]
.["current_message_title"] = .["is_ai"] ? messagetitle[aicurrmsg] : messagetitle[currmsg]
var/shuttle[0]
switch(SSshuttle.emergency.mode)
if(SHUTTLE_IDLE, SHUTTLE_RECALL)
shuttle["callStatus"] = 2 //#define
else
shuttle["callStatus"] = 1
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
.["lastCallLoc"] = SSshuttle.emergencyLastCallLoc ? format_text(SSshuttle.emergencyLastCallLoc.name) : null
.["msg_cooldown"] = message_cooldown ? TRUE : FALSE
.["cc_cooldown"] = centcomm_message_cooldown ? TRUE : FALSE
.["esc_callable"] = SSshuttle.emergency.mode == SHUTTLE_IDLE ? TRUE : FALSE
.["esc_recallable"] = SSshuttle.emergency.mode == SHUTTLE_CALL ? TRUE : FALSE
.["esc_status"] = FALSE
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
var/timeleft = SSshuttle.emergency.timeLeft()
shuttle["eta"] = "[timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]"
data["shuttle"] = shuttle
return data
.["esc_status"] = SSshuttle.emergency.mode == SHUTTLE_CALL ? "ETA:" : "RECALLING:"
.["esc_status"] += " [timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]"
/obj/machinery/computer/communications/proc/setCurrentMessage(var/mob/user,var/value)
if(isAI(user) || isrobot(user))
@@ -412,12 +394,6 @@
else
menu_state=value
/obj/machinery/computer/communications/proc/getMenuState(var/mob/user)
if(isAI(user) || isrobot(user))
return ai_menu_state
else
return menu_state
/proc/call_shuttle_proc(var/mob/user, var/reason)
if(GLOB.sent_strike_team == 1)
to_chat(user, "<span class='warning'>Central Command will not allow the shuttle to be called. Consider all contracts terminated.</span>")
@@ -521,24 +497,16 @@
SSshuttle.autoEvac()
return ..()
/proc/print_command_report(text = "", title = "Central Command Update")
/proc/print_command_report(text = "", title = "Central Command Update", add_to_records = TRUE)
for(var/obj/machinery/computer/communications/C in GLOB.shuttle_caller_list)
if(!(C.stat & (BROKEN|NOPOWER)) && is_station_contact(C.z))
var/obj/item/paper/P = new /obj/item/paper(C.loc)
P.name = "paper- '[title]'"
P.info = text
P.update_icon()
C.messagetitle.Add("[title]")
C.messagetext.Add(text)
for(var/datum/computer_file/program/comm/P in GLOB.shuttle_caller_list)
var/turf/T = get_turf(P.computer)
if(T && P.program_state != PROGRAM_STATE_KILLED && is_station_contact(T.z))
if(P.computer)
var/obj/item/computer_hardware/printer/printer = P.computer.all_components[MC_PRINT]
if(printer)
printer.print_text(text, "paper- '[title]'")
P.messagetitle.Add("[title]")
P.messagetext.Add(text)
if(add_to_records)
C.messagetitle.Add("[title]")
C.messagetext.Add(text)
/proc/print_centcom_report(text = "", title = "Incoming Message")
for(var/obj/machinery/computer/communications/C in GLOB.shuttle_caller_list)
@@ -549,12 +517,5 @@
P.update_icon()
C.messagetitle.Add("[title]")
C.messagetext.Add(text)
for(var/datum/computer_file/program/comm/P in GLOB.shuttle_caller_list)
var/turf/T = get_turf(P.computer)
if(T && P.program_state != PROGRAM_STATE_KILLED && is_admin_level(T.z))
if(P.computer)
var/obj/item/computer_hardware/printer/printer = P.computer.all_components[MC_PRINT]
if(printer)
printer.print_text(text, "paper- '[title]'")
P.messagetitle.Add("[title]")
P.messagetext.Add(text)
+2 -2
View File
@@ -624,11 +624,11 @@ Traitors and the like can also be revived with the previous role mostly intact.
var/beepsound = input(usr, "What sound should the announcement make?", "Announcement Sound", "") as anything in MsgSound
GLOB.command_announcement.Announce(input, customname, MsgSound[beepsound], , , type)
print_command_report(input, "[command_name()] Update")
print_command_report(input, customname)
if("No")
//same thing as the blob stuff - it's not public, so it's classified, dammit
GLOB.command_announcer.autosay("A classified message has been printed out at all communication consoles.")
print_command_report(input, "Classified [command_name()] Update")
print_command_report(input, "Classified: [customname]")
else
return
+1 -1
View File
@@ -39,7 +39,7 @@
SA.health = SA.maxHealth
SA.del_on_death = FALSE
greet_sentient(SA)
print_command_report(sentience_report, "[command_name()] Update")
print_command_report(sentience_report, "[command_name()] Update", FALSE)
processing = TRUE // Let it naturally end, if it runs successfully
/datum/event/sentience/proc/greet_sentient(var/mob/living/carbon/human/M)
@@ -63,7 +63,6 @@
var/obj/item/computer_hardware/hard_drive/hard_drive = cpu.all_components[MC_HDD]
hard_drive.store_file(new/datum/computer_file/program/chatclient())
hard_drive.store_file(new/datum/computer_file/program/card_mod())
hard_drive.store_file(new/datum/computer_file/program/comm())
// ===== CIVILIAN CONSOLE =====
/obj/machinery/modular_computer/console/preset/civilian
@@ -1,385 +0,0 @@
/datum/computer_file/program/comm
filename = "comm"
filedesc = "Command and communications"
program_icon_state = "comm"
extended_desc = "Used to command and control the station. Can relay long-range communications. This program can not be run on tablet computers."
required_access = ACCESS_HEADS
requires_ntnet = 1
size = 12
usage_flags = PROGRAM_CONSOLE | PROGRAM_LAPTOP
network_destination = "station long-range communication array"
var/authenticated = COMM_AUTHENTICATION_NONE
var/list/messagetitle = list()
var/list/messagetext = list()
var/currmsg = 0
var/aicurrmsg = 0
var/menu_state = COMM_SCREEN_MAIN
var/ai_menu_state = COMM_SCREEN_MAIN
var/message_cooldown = 0
var/centcomm_message_cooldown = 0
var/tmp_alertlevel = 0
var/stat_msg1
var/stat_msg2
var/display_type="blank"
var/datum/announcement/priority/crew_announcement = new
/datum/computer_file/program/comm/New()
GLOB.shuttle_caller_list += src
..()
crew_announcement.newscast = 0
/datum/computer_file/program/comm/Destroy()
GLOB.shuttle_caller_list -= src
SSshuttle.autoEvac()
return ..()
/datum/computer_file/program/comm/proc/is_authenticated(mob/user, loud = 1)
if(authenticated == COMM_AUTHENTICATION_MAX)
return COMM_AUTHENTICATION_MAX
else if(user.can_admin_interact())
return COMM_AUTHENTICATION_MAX
else if(authenticated)
return COMM_AUTHENTICATION_MIN
else
if(loud)
to_chat(user, "<span class='warning'>Access denied.</span>")
return COMM_AUTHENTICATION_NONE
/datum/computer_file/program/comm/proc/change_security_level(mob/user, new_level)
tmp_alertlevel = new_level
var/old_level = GLOB.security_level
if(!tmp_alertlevel)
tmp_alertlevel = SEC_LEVEL_GREEN
if(tmp_alertlevel < SEC_LEVEL_GREEN)
tmp_alertlevel = SEC_LEVEL_GREEN
if(tmp_alertlevel > SEC_LEVEL_BLUE)
tmp_alertlevel = SEC_LEVEL_BLUE //Cannot engage delta with this
set_security_level(tmp_alertlevel)
if(GLOB.security_level != old_level)
log_game("[key_name(user)] has changed the security level to [get_security_level()].")
message_admins("[key_name_admin(user)] has changed the security level to [get_security_level()].")
switch(GLOB.security_level)
if(SEC_LEVEL_GREEN)
feedback_inc("alert_comms_green", 1)
if(SEC_LEVEL_BLUE)
feedback_inc("alert_comms_blue", 1)
tmp_alertlevel = 0
/datum/computer_file/program/comm/proc/setCurrentMessage(mob/user, value)
if(isAI(user) || isrobot(user))
aicurrmsg = value
else
currmsg = value
/datum/computer_file/program/comm/proc/getCurrentMessage(mob/user)
if(isAI(user) || isrobot(user))
return aicurrmsg
else
return currmsg
/datum/computer_file/program/comm/proc/setMenuState(mob/user, value)
if(isAI(user) || isrobot(user))
ai_menu_state=value
else
menu_state=value
/datum/computer_file/program/comm/proc/getMenuState(mob/user)
if(isAI(user) || isrobot(user))
return ai_menu_state
else
return menu_state
/datum/computer_file/program/comm/ui_interact(mob/user, ui_key = "main", var/datum/nanoui/ui = null)
ui = SSnanoui.try_update_ui(user, src, ui_key, ui)
if(!ui)
var/datum/asset/assets = get_asset_datum(/datum/asset/simple/headers)
assets.send(user)
ui = new(user, src, ui_key, "comm_program.tmpl", "Command and communications program", 575, 500)
ui.set_layout_key("program")
ui.open()
/datum/computer_file/program/comm/ui_data(mob/user, ui_key = "main", datum/topic_state/state = GLOB.default_state)
var/list/data = get_header_data()
data["is_ai"] = isAI(user) || isrobot(user)
data["menu_state"] = data["is_ai"] ? ai_menu_state : menu_state
data["emagged"] = computer ? computer.emagged : null
data["authenticated"] = is_authenticated(user, 0)
data["screen"] = getMenuState(usr)
data["stat_display"] = list(
"type" = display_type,
"line_1" = (stat_msg1 ? stat_msg1 : "-----"),
"line_2" = (stat_msg2 ? stat_msg2 : "-----"),
"presets" = list(
list("name" = "blank", "label" = "Clear", "desc" = "Blank slate"),
list("name" = "shuttle", "label" = "Shuttle ETA", "desc" = "Display how much time is left."),
list("name" = "message", "label" = "Message", "desc" = "A custom message.")
),
"alerts"=list(
list("alert" = "default", "label" = "Nanotrasen", "desc" = "Oh god."),
list("alert" = "redalert", "label" = "Red Alert", "desc" = "Nothing to do with communists."),
list("alert" = "lockdown", "label" = "Lockdown", "desc" = "Let everyone know they're on lockdown."),
list("alert" = "biohazard", "label" = "Biohazard", "desc" = "Great for virus outbreaks and parties."),
)
)
data["security_level"] = GLOB.security_level
data["str_security_level"] = capitalize(get_security_level())
data["levels"] = list(
list("id" = SEC_LEVEL_GREEN, "name" = "Green"),
list("id" = SEC_LEVEL_BLUE, "name" = "Blue"),
)
var/list/msg_data = list()
for(var/i = 1; i <= messagetext.len; i++)
msg_data.Add(list(list("title" = messagetitle[i], "body" = messagetext[i], "id" = i)))
data["messages"] = msg_data
if((data["is_ai"] && aicurrmsg) || (!data["is_ai"] && currmsg))
data["current_message"] = data["is_ai"] ? messagetext[aicurrmsg] : messagetext[currmsg]
data["current_message_title"] = data["is_ai"] ? messagetitle[aicurrmsg] : messagetitle[currmsg]
data["lastCallLoc"] = SSshuttle.emergencyLastCallLoc ? format_text(SSshuttle.emergencyLastCallLoc.name) : null
var/shuttle[0]
switch(SSshuttle.emergency.mode)
if(SHUTTLE_IDLE, SHUTTLE_RECALL)
shuttle["callStatus"] = 2 //#define
else
shuttle["callStatus"] = 1
if(SSshuttle.emergency.mode == SHUTTLE_CALL)
var/timeleft = SSshuttle.emergency.timeLeft()
shuttle["eta"] = "[timeleft / 60 % 60]:[add_zero(num2text(timeleft % 60), 2)]"
data["shuttle"] = shuttle
return data
/datum/computer_file/program/comm/Topic(href, href_list)
if(..())
return 1
var/turf/T = get_turf(computer)
if(!is_secure_level(T.z))
to_chat(usr, "<span class='warning'>Unable to establish a connection: You're too far away from the station!</span>")
return 1
if(href_list["PRG_login"])
if(!ishuman(usr))
to_chat(usr, "<span class='warning'>Access denied.</span>")
return
var/list/access = usr.get_access()
if(ACCESS_HEADS in access)
authenticated = COMM_AUTHENTICATION_MIN
if(ACCESS_CAPTAIN in access)
authenticated = COMM_AUTHENTICATION_MAX
var/mob/living/carbon/human/H = usr
var/obj/item/card/id = H.get_idcard(TRUE)
if(istype(id))
crew_announcement.announcer = GetNameAndAssignmentFromId(id)
SSnanoui.update_uis(src)
return 1
if(href_list["PRG_logout"])
authenticated = COMM_AUTHENTICATION_NONE
crew_announcement.announcer = ""
setMenuState(usr, COMM_SCREEN_MAIN)
SSnanoui.update_uis(src)
return 1
if(is_authenticated(usr))
switch(href_list["PRG_operation"])
if("main")
setMenuState(usr, COMM_SCREEN_MAIN)
if("changeseclevel")
setMenuState(usr,COMM_SCREEN_SECLEVEL)
if("newalertlevel")
if(isAI(usr) || isrobot(usr))
to_chat(usr, "<span class='warning'>Firewalls prevent you from changing the alert level.</span>")
return 1
else if(usr.can_admin_interact())
change_security_level(usr, text2num(href_list["level"]))
return 1
else if(!ishuman(usr))
to_chat(usr, "<span class='warning'>Security measures prevent you from changing the alert level.</span>")
return 1
var/mob/living/carbon/human/L = usr
var/obj/item/card = L.get_active_hand()
var/obj/item/card/id/I = (card && card.GetID()) || L.wear_id || L.wear_pda
if(istype(I, /obj/item/pda))
var/obj/item/pda/pda = I
I = pda.id
if(I && istype(I))
if(ACCESS_CAPTAIN in I.access)
change_security_level(usr, text2num(href_list["level"]))
else
to_chat(usr, "<span class='warning'>You are not authorized to do this.</span>")
setMenuState(usr, COMM_SCREEN_MAIN)
else
to_chat(usr, "<span class='warning'>You need to swipe your ID.</span>")
if("announce")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(message_cooldown)
to_chat(usr, "<span class='warning'>Please allow at least one minute to pass between announcements.</span>")
SSnanoui.update_uis(src)
return 1
var/input = input(usr, "Please write a message to announce to the station crew.", "Priority Announcement")
if(!input || message_cooldown || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return 1
crew_announcement.Announce(input)
message_cooldown = 1
spawn(600)//One minute cooldown
message_cooldown = 0
if("callshuttle")
var/input = clean_input("Please enter the reason for calling the shuttle.", "Shuttle Call Reason.","")
if(!input || ..() || !is_authenticated(usr))
SSnanoui.update_uis(src)
return 1
call_shuttle_proc(usr, input)
if(SSshuttle.emergency.timer)
post_status("shuttle")
setMenuState(usr, COMM_SCREEN_MAIN)
if("cancelshuttle")
if(isAI(usr) || isrobot(usr))
to_chat(usr, "<span class='warning'>Firewalls prevent you from recalling the shuttle.</span>")
SSnanoui.update_uis(src)
return 1
var/response = alert("Are you sure you wish to recall the shuttle?", "Confirm", "Yes", "No")
if(response == "Yes")
cancel_call_proc(usr)
if(SSshuttle.emergency.timer)
post_status("shuttle")
setMenuState(usr, COMM_SCREEN_MAIN)
if("messagelist")
currmsg = 0
if(href_list["msgid"])
setCurrentMessage(usr, text2num(href_list["msgid"]))
setMenuState(usr,COMM_SCREEN_MESSAGES)
if("delmessage")
if(href_list["msgid"])
currmsg = text2num(href_list["msgid"])
var/response = alert("Are you sure you wish to delete this message?", "Confirm", "Yes", "No")
if(response == "Yes")
if(currmsg)
var/id = getCurrentMessage()
var/title = messagetitle[id]
var/text = messagetext[id]
messagetitle.Remove(title)
messagetext.Remove(text)
if(currmsg == id)
currmsg = 0
if(aicurrmsg == id)
aicurrmsg = 0
setMenuState(usr,COMM_SCREEN_MESSAGES)
if("status")
setMenuState(usr,COMM_SCREEN_STAT)
// Status display stuff
if("setstat")
display_type=href_list["statdisp"]
switch(display_type)
if("message")
post_status("message", stat_msg1, stat_msg2, usr)
if("alert")
post_status("alert", href_list["alert"], user = usr)
else
post_status(href_list["statdisp"], user = usr)
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg1")
stat_msg1 = clean_input("Line 1", "Enter Message Text", stat_msg1)
setMenuState(usr, COMM_SCREEN_STAT)
if("setmsg2")
stat_msg2 = clean_input("Line 2", "Enter Message Text", stat_msg2)
setMenuState(usr, COMM_SCREEN_STAT)
if("nukerequest")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(centcomm_message_cooldown)
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
SSnanoui.update_uis(src)
return 1
var/input = stripped_input(usr, "Please enter the reason for requesting the nuclear self-destruct codes. Misuse of the nuclear request system will not be tolerated under any circumstances. Transmission does not guarantee a response.", "Self Destruct Code Request.","")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return 1
Nuke_request(input, usr)
to_chat(usr, "<span class='notice'>Request sent.</span>")
log_game("[key_name(usr)] has requested the nuclear codes from Centcomm")
GLOB.priority_announcement.Announce("The codes for the on-station nuclear self-destruct have been requested by [usr]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self Destruct Codes Requested",'sound/AI/commandreport.ogg')
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
if("MessageCentcomm")
if(is_authenticated(usr) == COMM_AUTHENTICATION_MAX)
if(centcomm_message_cooldown)
to_chat(usr, "<span class='warning'>Arrays recycling. Please stand by.</span>")
SSnanoui.update_uis(src)
return 1
var/input = stripped_input(usr, "Please choose a message to transmit to Centcomm via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return 1
Centcomm_announce(input, usr)
to_chat(usr, "Message transmitted.")
log_game("[key_name(usr)] has made a Centcomm announcement: [input]")
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
// OMG SYNDICATE ...LETTERHEAD
if("MessageSyndicate")
if((is_authenticated(usr) == COMM_AUTHENTICATION_MAX) && (computer && computer.emagged))
if(centcomm_message_cooldown)
to_chat(usr, "Arrays recycling. Please stand by.")
SSnanoui.update_uis(src)
return 1
var/input = stripped_input(usr, "Please choose a message to transmit to \[ABNORMAL ROUTING CORDINATES\] via quantum entanglement. Please be aware that this process is very expensive, and abuse will lead to... termination. Transmission does not guarantee a response.", "To abort, send an empty message.", "")
if(!input || ..() || !(is_authenticated(usr) == COMM_AUTHENTICATION_MAX))
SSnanoui.update_uis(src)
return 1
Syndicate_announce(input, usr)
to_chat(usr, "Message transmitted.")
log_game("[key_name(usr)] has made a Syndicate announcement: [input]")
centcomm_message_cooldown = 1
spawn(6000)//10 minute cooldown
centcomm_message_cooldown = 0
setMenuState(usr,COMM_SCREEN_MAIN)
if("RestartNanoMob")
if(SSmob_hunt)
if(SSmob_hunt.manual_reboot())
var/loading_msg = pick("Respawning spawns", "Reticulating splines", "Flipping hat",
"Capturing all of them", "Fixing minor text issues", "Being the very best",
"Nerfing this", "Not communicating with playerbase", "Coding a ripoff in a 2D spaceman game")
to_chat(usr, "<span class='notice'>Restarting Nano-Mob Hunter GO! game server. [loading_msg]...</span>")
else
to_chat(usr, "<span class='warning'>Nano-Mob Hunter GO! game server reboot failed due to recent restart. Please wait before re-attempting.</span>")
else
to_chat(usr, "<span class='danger'>Nano-Mob Hunter GO! game server is offline for extended maintenance. Contact your Central Command administrators for more info if desired.</span>")
SSnanoui.update_uis(src)
return 1
+1 -1
View File
@@ -13,7 +13,7 @@
/datum/station_goal/proc/send_report()
GLOB.priority_announcement.Announce("Priority Nanotrasen directive received. Project \"[name]\" details inbound.", "Incoming Priority Message", 'sound/AI/commandreport.ogg')
print_command_report(get_report(), "Nanotrasen Directive [pick(GLOB.phonetic_alphabet)] \Roman[rand(1,50)]")
print_command_report(get_report(), "Nanotrasen Directive [pick(GLOB.phonetic_alphabet)] \Roman[rand(1,50)]", FALSE)
on_report()
/datum/station_goal/proc/on_report()
-142
View File
@@ -1,142 +0,0 @@
<!--
Title: Communications
Used In File(s): /code/game/machinery/computers/communications.dm
-->
<!--
#define COMM_SCREEN_MAIN 1
#define COMM_SCREEN_STAT 2
#define COMM_SCREEN_MESSAGES 3
#define COMM_SCREEN_SECLEVEL 4
-->
{{if !data.authenticated}}
<div class="notice">Please swipe your ID card. {{:helper.link('Log In','unlock',{'login':1},null,'fixed')}}</div>
{{else}}
{{if !data.is_ai}}
<div class="notice">Please remember to {{:helper.link('Log Out','lock',{'logout':1},null,'fixed')}}</div>
{{/if}}
{{if data.lastCallLoc}}
<div class="line">Most recent shuttle call/recall traced to: <b>{{:data.lastCallLoc}}</b></div>
{{else}}
<div class="line">Unable to trace most recent shuttle call/recall signal.</div>
{{/if}}
<div class="item">
<h3>Emergency Shuttle:</h3>
{{if data.shuttle.eta}}
<div class="itemLabel">ETA:</div>
<div class="itemContents">
{{>data.shuttle.eta}}
</div>
{{/if}}<!-- SHUTTLE ETA -->
<div class="itemLabel">Options:</div>
<div class="itemContents">
{{if data.shuttle.callStatus == 1 && !data.is_ai}}
{{:helper.link('Cancel Shuttle','arrow-left',{'operation':'cancelshuttle'})}}
{{else data.shuttle.callStatus == 2}}
{{:helper.link('Call Shuttle','arrow-circle-down',{'operation':'callshuttle'})}}
{{/if}}
</div>
</div>
{{if data.screen==1}}
<!-- MAIN SCREEN -->
<h3>Menu</h3>
<div class="item">
{{if data.authenticated==2}}
<div class="line">
{{:helper.link('Make an Announcement','info',{'operation':'announce'})}}
</div>
<div class="line">
{{if data.emagged}}
{{:helper.link('Message [UNKNOWN]','envelope',{'operation':'MessageSyndicate'})}}
</div>
<div class="line">
{{:helper.link('Reset Relays','refresh',{'operation':'RestoreBackup'})}}
{{else}}
{{:helper.link('Message CentComm','envelope',{'operation':'MessageCentcomm'})}}
{{/if}}
</div>
<div class="line">
{{:helper.link('Request Nuclear Authentication Codes','exclamation-triangle',{'operation':'nukerequest'})}}
</div>
{{/if}}
<div class="line">
{{:helper.link('Change Alert Level','signal',{'operation':'changeseclevel'})}}
</div>
<div class="line">
{{:helper.link('Change Status Displays','info',{'operation':'status'})}}
</div>
<div class="line">
{{:helper.link('Message List','comment',{'operation':'messagelist'})}}
</div>
<div class="line">
{{:helper.link('Restart Nano-Mob Hunter GO! Server','power-off',{'operation':'RestartNanoMob'})}}
</div>
</div>
{{else data.screen==2}}
<!-- STATUS DISPLAYS -->
<h2>Status Displays</h2>
{{:helper.link('Back','home',{'operation':'main'})}}
<h3>Presets</h3>
{{for data.stat_display.presets}}
<div class="line">
<div class="statusLabel">{{:helper.link(value.label,'info',{'operation':'setstat','statdisp':value.name},null,(name==data.stat_display.type?'linkOn':''))}}</div>
</div>
{{/for}}
<h3>Alerts</h3>
{{for data.stat_display.alerts}}
<div class="line">
<div class="statusLabel">{{:helper.link(value.label,'exclamation-triangle',{'operation':'setstat','statdisp':'alert','alert':value.alert},null,(value.alert==data.stat_display.type?'linkOn':''))}}</div>
</div>
{{/for}}
<h3>Messages</h3>
<div class="item">
{{if data.stat_display.type}}
<div class="line">
<div class="statusLabel">{{:helper.link('Line 1:','gear',{'operation':'setmsg1'})}}</div>
<div class="statusValue">{{>data.stat_display.line_1}}</div>
</div>
<div class="line">
<div class="statusLabel">{{:helper.link('Line 2:','gear',{'operation':'setmsg2'})}}</div>
<div class="statusValue">{{>data.stat_display.line_2}}</div>
</div>
{{/if}}
</div>
{{else data.screen==3}}
<!-- MESSAGES -->
<h3>Messages</h3>
{{if data.current_message}}
{{:helper.link('Messages','home',{'operation':'messagelist'})}}
<h3>{{:data.current_message_title}}</h3>
<div class="item">
{{:data.current_message}}
</div>
{{else}}
{{:helper.link('Back','home',{'operation':'main'})}}
{{for data.messages}}
<div class="line">
<b>{{:value.title}}</b><br>
{{:helper.link('Open','envelope-o',{'operation':'messagelist','msgid':value.id})}}
{{:helper.link('Delete','close',{'operation':'delmessage','msgid':value.id})}}
</div>
{{/for}}
{{/if}}
{{else data.screen==4}}
<!-- ALERT LEVEL -->
<h3>Security Level</h3>
{{:helper.link('Back','home',{'operation':'main'})}}
<div class="item">
<div class="line">
<div class="itemLabel">Security Level:</div>
<div class="itemContents">{{>data.str_security_level}}</div>
</div>
<div class="line">
<div class="itemLabel">Presets:</div>
<div class="itemContents">
{{for data.levels}}
{{:helper.link(value.name,'comment',{'operation':'newalertlevel','level':value.id},null,(value.id==data.security_level?'linkOn':''))}}
{{/for}}
</div>
</div>
</div>
{{/if}}<!-- SCREEN -->
{{/if}}<!-- AUTHENTICATED -->
-1
View File
@@ -2067,7 +2067,6 @@
#include "code\modules\modular_computers\file_system\programs\antagonist\dos.dm"
#include "code\modules\modular_computers\file_system\programs\antagonist\revelation.dm"
#include "code\modules\modular_computers\file_system\programs\command\card.dm"
#include "code\modules\modular_computers\file_system\programs\command\comms.dm"
#include "code\modules\modular_computers\file_system\programs\engineering\alarm.dm"
#include "code\modules\modular_computers\file_system\programs\engineering\power_monitor.dm"
#include "code\modules\modular_computers\file_system\programs\engineering\sm_monitor.dm"
@@ -0,0 +1,299 @@
import { Fragment } from 'inferno';
import { useBackend } from '../backend';
import { Button, LabeledList, Box, Section } from '../components';
import { Window } from '../layouts';
export const CommunicationsComputer = (props, context) => {
const { act, data } = useBackend(context);
let authReadable;
if (!data.authenticated) {
authReadable = "Not Logged In";
} else if (data.is_ai) {
authReadable = "AI";
} else if (data.authenticated === 1) {
authReadable = "Command";
} else if (data.authenticated === 2) {
authReadable = "Captain";
} else {
authReadable = "ERROR: Report This Bug!";
}
let reportText = "View (" + data.messages.length + ")";
let authBlock = (
<Fragment>
<Section title="Authentication">
<LabeledList>
{data.is_ai && (
<LabeledList.Item label="Access Level">
AI
</LabeledList.Item>
) || (
<LabeledList.Item label="Actions">
<Button
icon={data.authenticated ? 'sign-out-alt' : 'id-card'}
selected={data.authenticated}
content={data.authenticated
? "Log Out (" + authReadable + ")"
: 'Log In'}
onClick={() => act("auth")} />
</LabeledList.Item>
)}
</LabeledList>
</Section>
<Section title="Escape Shuttle">
<LabeledList>
{!!data.esc_status && (
<LabeledList.Item label="Status">
{data.esc_status}
</LabeledList.Item>
)}
{!!data.esc_callable && (
<LabeledList.Item label="Options">
<Button
icon="rocket"
content="Call Shuttle"
disabled={!data.authenticated}
onClick={() => act('callshuttle')} />
</LabeledList.Item>
)}
{!!data.esc_recallable && (
<LabeledList.Item label="Options">
<Button
icon="times"
content="Recall Shuttle"
disabled={!data.authenticated || data.is_ai}
onClick={() => act('cancelshuttle')} />
</LabeledList.Item>
)}
</LabeledList>
</Section>
</Fragment>
);
let alertLevelText = data.str_security_level;
let alertLevelButtons = data.levels.map(slevel => {
return (
<Button
key={slevel.name}
icon={slevel.icon}
content={slevel.name}
disabled={!data.authmax
|| slevel.id === data.security_level}
onClick={() => act('newalertlevel', { level: slevel.id })} />
);
});
let presetButtons = data.stat_display["presets"].map(pb => {
return (
<Button
key={pb.name}
content={pb.label}
selected={pb.name === data.stat_display.type}
disabled={!data.authenticated}
onClick={() => act('setstat', { statdisp: pb.name })} />
);
});
let iconButtons = data.stat_display["alerts"].map(ib => {
return (
<Button
key={ib.alert}
content={ib.label}
selected={ib.alert === data.stat_display.icon}
disabled={!data.authenticated}
onClick={() => act('setstat',
{ statdisp: "alert", alert: ib.alert })} />
);
});
let messageView;
if (data.current_message_title) {
messageView = (
<Section title={data.current_message_title} buttons={
<Button
icon="times"
content="Return To Message List"
disabled={!data.authenticated}
onClick={() => act('messagelist')} />
}>
<Box>
{data.current_message}
</Box>
</Section>
);
} else {
let messageRows = data.messages.map(m => {
return (
<LabeledList.Item key={m.id} label={m.title}>
<Button
icon="eye"
content="View"
disabled={!data.authenticated
|| data.current_message_title === m.title}
onClick={() => act('messagelist', { msgid: m.id })} />
<Button
icon="times"
content="Delete"
disabled={!data.authenticated}
onClick={() => act('delmessage', { msgid: m.id })} />
</LabeledList.Item>
);
});
messageView = (
<Section title="Messages Received" buttons={
<Button
icon="arrow-circle-left"
content="Back To Main Menu"
onClick={() => act('main')} />
}>
<LabeledList>
{messageRows}
</LabeledList>
</Section>
);
}
switch (data.menu_state) {
// 1 = main screen
case 1:
return (
<Window resizable>
<Window.Content scrollable>
{authBlock}
<Section title="Captain-Only Actions">
<LabeledList>
<LabeledList.Item label="Alert Level">
{alertLevelText} {alertLevelButtons}
</LabeledList.Item>
<LabeledList.Item label="Announcement">
<Button
icon="bullhorn"
content="Make Priority Announcement"
disabled={!data.authmax || data.msg_cooldown}
onClick={() => act('announce')} />
</LabeledList.Item>
{!!data.emagged && (
<LabeledList.Item label="Transmit">
<Button
icon="broadcast-tower"
color="red"
content="Message [UNKNOWN]"
disabled={!data.authmax}
onClick={() => act('MessageSyndicate')} />
<Button
icon="sync-alt"
content="Reset Relays"
disabled={!data.authmax}
onClick={() => act('RestoreBackup')} />
</LabeledList.Item>
) || (
<LabeledList.Item label="Transmit">
<Button
icon="broadcast-tower"
content={data.cc_cooldown
? "Arrays Re-aligning"
: "Message CentComm"}
disabled={!data.authmax || data.cc_cooldown}
onClick={() => act('MessageCentcomm')} />
</LabeledList.Item>
)}
<LabeledList.Item label="Nuclear Device">
<Button
icon="bomb"
content={data.cc_cooldown
? "Arrays Re-aligning"
: "Request Authentication Codes"}
disabled={!data.authmax || data.cc_cooldown}
onClick={() => act('nukerequest')} />
</LabeledList.Item>
</LabeledList>
</Section>
<Section title="Command Staff Actions">
<LabeledList>
<LabeledList.Item label="Displays">
<Button
icon="tv"
content="Change Status Displays"
disabled={!data.authenticated}
onClick={() => act('status')} />
</LabeledList.Item>
<LabeledList.Item label="Incoming Messages">
<Button
icon="folder-open"
content={reportText}
disabled={!data.authenticated}
onClick={() => act('messagelist')} />
</LabeledList.Item>
<LabeledList.Item label="Misc">
<Button
icon="sync-alt"
content="Restart Nano-Mob Hunter GO! Server"
disabled={!data.authenticated}
onClick={() => act('RestartNanoMob')} />
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
// 2 = status screen
case 2:
return (
<Window>
<Window.Content>
{authBlock}
<Section title="Modify Status Screens" buttons={
<Button
icon="arrow-circle-left"
content="Back To Main Menu"
onClick={() => act('main')} />
}>
<LabeledList>
<LabeledList.Item label="Presets">
{presetButtons}
</LabeledList.Item>
<LabeledList.Item label="Alerts">
{iconButtons}
</LabeledList.Item>
<LabeledList.Item label="Message Line 1">
<Button
icon="pencil-alt"
content={data.stat_display.line_1}
disabled={!data.authenticated}
onClick={() => act('setmsg1')} />
</LabeledList.Item>
<LabeledList.Item label="Message Line 2">
<Button
icon="pencil-alt"
content={data.stat_display.line_2}
disabled={!data.authenticated}
onClick={() => act('setmsg2')} />
</LabeledList.Item>
</LabeledList>
</Section>
</Window.Content>
</Window>
);
// 3 = messages screen
case 3:
return (
<Window>
<Window.Content>
{authBlock}
{messageView}
</Window.Content>
</Window>
);
default:
return (
<Window>
<Window.Content>
{authBlock}
ERRROR. Unknown menu_state: {data.menu_state}
</Window.Content>
</Window>
);
}
};
File diff suppressed because one or more lines are too long