Skip to content

Commit

Permalink
consoles
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Apr 24, 2024
1 parent 26cd128 commit fd58411
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 55 deletions.
7 changes: 7 additions & 0 deletions code/game/machinery/ARES/ARES_interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -522,5 +522,12 @@
sec_vent.create_gas(VENT_GAS_CN20_XENO, 6, 5 SECONDS)
log_admin("[key_name(user)] released nerve gas from Vent '[sec_vent.vent_tag]' via ARES.")

if("security_lockdown")
if(!COOLDOWN_FINISHED(datacore, aicore_lockdown))
to_chat(user, SPAN_BOLDWARNING("AI Core Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(datacore, aicore_lockdown)] seconds!"))
return FALSE
aicore_lockdown(user)
return TRUE

if(playsound)
playsound(src, "keyboard_alt", 15, 1)
97 changes: 51 additions & 46 deletions code/game/machinery/ARES/ARES_interface_apollo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -158,29 +158,29 @@
return

var/playsound = TRUE
var/mob/living/carbon/human/operator = ui.user
var/mob/living/carbon/human/user = ui.user

switch (action)
if("go_back")
if(!last_menu)
return to_chat(operator, SPAN_WARNING("Error, no previous page detected."))
return to_chat(user, SPAN_WARNING("Error, no previous page detected."))
var/temp_holder = current_menu
current_menu = last_menu
last_menu = temp_holder

if("login")

var/obj/item/card/id/idcard = operator.get_active_hand()
var/obj/item/card/id/idcard = user.get_active_hand()
if(istype(idcard))
authentication = get_ares_access(idcard)
last_login = idcard.registered_name
else if(operator.wear_id)
idcard = operator.wear_id
else if(user.wear_id)
idcard = user.wear_id
if(istype(idcard))
authentication = get_ares_access(idcard)
last_login = idcard.registered_name
else
to_chat(operator, SPAN_WARNING("You require an ID card to access this terminal!"))
to_chat(user, SPAN_WARNING("You require an ID card to access this terminal!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(authentication)
Expand Down Expand Up @@ -222,23 +222,23 @@

if("new_report")
var/priority_report = FALSE
var/maint_type = tgui_input_list(operator, "What is the type of maintenance item you wish to report?", "Report Category", GLOB.maintenance_categories, 30 SECONDS)
var/maint_type = tgui_input_list(user, "What is the type of maintenance item you wish to report?", "Report Category", GLOB.maintenance_categories, 30 SECONDS)
switch(maint_type)
if("Major Structural Damage", "Fire", "Communications Failure", "Power Generation Failure")
priority_report = TRUE

if(!maint_type)
return FALSE
var/details = tgui_input_text(operator, "What are the details for this report?", "Ticket Details", encode = FALSE)
var/details = tgui_input_text(user, "What are the details for this report?", "Ticket Details", encode = FALSE)
if(!details)
return FALSE

if((authentication >= APOLLO_ACCESS_REPORTER) && !priority_report)
var/is_priority = tgui_alert(operator, "Is this a priority report?", "Priority designation", list("Yes", "No"))
var/is_priority = tgui_alert(user, "Is this a priority report?", "Priority designation", list("Yes", "No"))
if(is_priority == "Yes")
priority_report = TRUE

var/confirm = alert(operator, "Please confirm the submission of your maintenance report. \n\n Priority: [priority_report ? "Yes" : "No"]\n Category: '[maint_type]'\n Details: '[details]'\n\n Is this correct?", "Confirmation", "Yes", "No")
var/confirm = alert(user, "Please confirm the submission of your maintenance report. \n\n Priority: [priority_report ? "Yes" : "No"]\n Category: '[maint_type]'\n Details: '[details]'\n\n Is this correct?", "Confirmation", "Yes", "No")
if(confirm == "Yes")
if(link)
var/datum/ares_ticket/maintenance/maint_ticket = new(last_login, maint_type, details, priority_report)
Expand All @@ -247,7 +247,7 @@
ares_apollo_talk("Priority Maintenance Report: [maint_type] - ID [maint_ticket.ticket_id]. Seek and resolve.")
else
send_notifcation()
log_game("ARES: Maintenance Ticket '\ref[maint_ticket]' created by [key_name(operator)] as [last_login] with Category '[maint_type]' and Details of '[details]'.")
log_game("ARES: Maintenance Ticket '\ref[maint_ticket]' created by [key_name(user)] as [last_login] with Category '[maint_type]' and Details of '[details]'.")
return TRUE
return FALSE

Expand All @@ -259,14 +259,14 @@
var/assigned = ticket.ticket_assignee
if(assigned)
if(assigned == last_login)
var/prompt = tgui_alert(operator, "You already claimed this ticket! Do you wish to drop your claim?", "Unclaim ticket", list("Yes", "No"))
var/prompt = tgui_alert(user, "You already claimed this ticket! Do you wish to drop your claim?", "Unclaim ticket", list("Yes", "No"))
if(prompt != "Yes")
return FALSE
/// set ticket back to pending
ticket.ticket_assignee = null
ticket.ticket_status = TICKET_PENDING
return claim
var/choice = tgui_alert(operator, "This ticket has already been claimed by [assigned]! Do you wish to override their claim?", "Claim Override", list("Yes", "No"))
var/choice = tgui_alert(user, "This ticket has already been claimed by [assigned]! Do you wish to override their claim?", "Claim Override", list("Yes", "No"))
if(choice != "Yes")
claim = FALSE
if(claim)
Expand All @@ -279,9 +279,9 @@
if(!istype(ticket))
return FALSE
if(ticket.ticket_submitter != last_login)
to_chat(operator, SPAN_WARNING("You cannot cancel a ticket that does not belong to you!"))
to_chat(user, SPAN_WARNING("You cannot cancel a ticket that does not belong to you!"))
return FALSE
to_chat(operator, SPAN_WARNING("[ticket.ticket_type] [ticket.ticket_id] has been cancelled."))
to_chat(user, SPAN_WARNING("[ticket.ticket_type] [ticket.ticket_id] has been cancelled."))
ticket.ticket_status = TICKET_CANCELLED
if(ticket.ticket_priority)
ares_apollo_talk("Priority [ticket.ticket_type] [ticket.ticket_id] has been cancelled.")
Expand All @@ -294,9 +294,9 @@
if(!istype(ticket))
return FALSE
if(ticket.ticket_assignee != last_login && ticket.ticket_assignee) //must be claimed by you or unclaimed.)
to_chat(operator, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
to_chat(user, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
return FALSE
var/choice = tgui_alert(operator, "What do you wish to mark the ticket as?", "Mark", list(TICKET_COMPLETED, TICKET_REJECTED), 20 SECONDS)
var/choice = tgui_alert(user, "What do you wish to mark the ticket as?", "Mark", list(TICKET_COMPLETED, TICKET_REJECTED), 20 SECONDS)
switch(choice)
if(TICKET_COMPLETED)
ticket.ticket_status = TICKET_COMPLETED
Expand All @@ -308,39 +308,39 @@
ares_apollo_talk("Priority [ticket.ticket_type] [ticket.ticket_id] has been [choice] by [last_login].")
else
send_notifcation()
to_chat(operator, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
to_chat(user, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
return TRUE

if("new_access")
var/obj/item/card/id/idcard = operator.get_active_hand()
var/obj/item/card/id/idcard = user.get_active_hand()
var/has_id = FALSE
if(istype(idcard))
has_id = TRUE
else if(operator.wear_id)
idcard = operator.wear_id
else if(user.wear_id)
idcard = user.wear_id
if(istype(idcard))
has_id = TRUE
if(!has_id)
to_chat(operator, SPAN_WARNING("You require an ID card to request an access ticket!"))
to_chat(user, SPAN_WARNING("You require an ID card to request an access ticket!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(idcard.registered_name != last_login)
to_chat(operator, SPAN_WARNING("This ID card does not match the active login!"))
to_chat(user, SPAN_WARNING("This ID card does not match the active login!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

var/details = tgui_input_text(operator, "What is the purpose of this access ticket?", "Ticket Details", encode = FALSE)
var/details = tgui_input_text(user, "What is the purpose of this access ticket?", "Ticket Details", encode = FALSE)
if(!details)
return FALSE

var/confirm = alert(operator, "Please confirm the submission of your access ticket request.\n\nHolder: '[last_login]'\nDetails: '[details]'\n\nIs this correct?", "Confirmation", "Yes", "No")
var/confirm = alert(user, "Please confirm the submission of your access ticket request.\n\nHolder: '[last_login]'\nDetails: '[details]'\n\nIs this correct?", "Confirmation", "Yes", "No")
if(confirm != "Yes" || !link)
return FALSE
var/datum/ares_ticket/access/access_ticket = new(last_login, details, FALSE, idcard.registered_gid)
link.waiting_ids += idcard
link.tickets_access += access_ticket
log_game("ARES: Access Ticket '\ref[access_ticket]' created by [key_name(operator)] as [last_login] with Details of '[details]'.")
message_admins(SPAN_STAFF_IC("[key_name_admin(operator)] created a new ARES Access Ticket."), 1)
log_game("ARES: Access Ticket '\ref[access_ticket]' created by [key_name(user)] as [last_login] with Details of '[details]'.")
message_admins(SPAN_STAFF_IC("[key_name_admin(user)] created a new ARES Access Ticket."), 1)
ares_apollo_talk("Access Ticket [access_ticket.ticket_id]: [access_ticket.ticket_submitter] requesting access for '[details].")
return TRUE

Expand All @@ -361,9 +361,9 @@

access_ticket.ticket_status = TICKET_RETURNED
identification.access -= ACCESS_MARINE_AI_TEMP
identification.modification_log += "Temporary AI Access self-returned by [key_name(operator)]."
identification.modification_log += "Temporary AI Access self-returned by [key_name(user)]."

to_chat(operator, SPAN_NOTICE("Temporary Access Ticket surrendered."))
to_chat(user, SPAN_NOTICE("Temporary Access Ticket surrendered."))
playsound(src, 'sound/machines/chime.ogg', 15, 1)
ares_apollo_talk("Access Ticket [access_ticket.ticket_id]: [access_ticket.ticket_submitter] surrendered their access.")

Expand All @@ -372,7 +372,7 @@
datacore.apollo_login_list += "[last_login] at [worldtime2text()], Surrendered Temporary Access Ticket."
return TRUE

to_chat(operator, SPAN_WARNING("This ID card does not have an access ticket!"))
to_chat(user, SPAN_WARNING("This ID card does not have an access ticket!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

Expand All @@ -384,15 +384,15 @@
for(var/obj/item/card/id/identification in link.waiting_ids)
if(identification.registered_gid != access_ticket.user_id_num)
continue
identification.handle_ares_access(last_login, operator)
identification.handle_ares_access(last_login, user)
access_ticket.ticket_status = TICKET_GRANTED
playsound(src, 'sound/machines/chime.ogg', 15, 1)
ares_apollo_talk("Access Ticket [access_ticket.ticket_id]: [access_ticket.ticket_submitter] was granted access by [last_login].")
return TRUE
for(var/obj/item/card/id/identification in link.active_ids)
if(identification.registered_gid != access_ticket.user_id_num)
continue
identification.handle_ares_access(last_login, operator)
identification.handle_ares_access(last_login, user)
access_ticket.ticket_status = TICKET_REVOKED
playsound(src, 'sound/machines/chime.ogg', 15, 1)
ares_apollo_talk("Access Ticket [access_ticket.ticket_id]: [access_ticket.ticket_submitter] had access revoked by [last_login].")
Expand All @@ -404,10 +404,10 @@
if(!istype(access_ticket))
return FALSE
if(access_ticket.ticket_assignee != last_login && access_ticket.ticket_assignee) //must be claimed by you or unclaimed.)
to_chat(operator, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
to_chat(user, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
return FALSE
access_ticket.ticket_status = TICKET_REJECTED
to_chat(operator, SPAN_NOTICE("[access_ticket.ticket_type] [access_ticket.ticket_id] marked as rejected."))
to_chat(user, SPAN_NOTICE("[access_ticket.ticket_type] [access_ticket.ticket_id] marked as rejected."))
ares_apollo_talk("Access Ticket [access_ticket.ticket_id]: [access_ticket.ticket_submitter] was rejected access by [last_login].")
for(var/obj/item/card/id/identification in link.waiting_ids)
if(identification.registered_gid != access_ticket.user_id_num)
Expand All @@ -422,44 +422,49 @@
playsound = FALSE
var/obj/structure/pipes/vents/pump/no_boom/gas/sec_vent = locate(params["vent"])
if(!istype(sec_vent) || sec_vent.welded)
to_chat(operator, SPAN_WARNING("ERROR: Gas release failure."))
to_chat(user, SPAN_WARNING("ERROR: Gas release failure."))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(!COOLDOWN_FINISHED(sec_vent, vent_trigger_cooldown))
to_chat(operator, SPAN_WARNING("ERROR: Insufficient gas reserve for this vent."))
to_chat(user, SPAN_WARNING("ERROR: Insufficient gas reserve for this vent."))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
to_chat(operator, SPAN_WARNING("Initiating gas release from [sec_vent.vent_tag]."))
to_chat(user, SPAN_WARNING("Initiating gas release from [sec_vent.vent_tag]."))
playsound(src, 'sound/machines/chime.ogg', 15, 1)
COOLDOWN_START(sec_vent, vent_trigger_cooldown, COOLDOWN_ARES_VENT)
ares_apollo_talk("Nerve Gas release imminent from [sec_vent.vent_tag].")
log_ares_security("Nerve Gas Release", "[last_login] released Nerve Gas from Vent '[sec_vent.vent_tag]'.")
sec_vent.create_gas(VENT_GAS_CN20_XENO, 6, 5 SECONDS)
log_admin("[key_name(operator)] released nerve gas from Vent '[sec_vent.vent_tag]' via ARES.")
log_admin("[key_name(user)] released nerve gas from Vent '[sec_vent.vent_tag]' via ARES.")

if("security_lockdown")
if(!COOLDOWN_FINISHED(datacore, aicore_lockdown))
to_chat(user, SPAN_BOLDWARNING("AI Core Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(datacore, aicore_lockdown)] seconds!"))
return FALSE
aicore_lockdown(user)
return TRUE

if(playsound)
playsound(src, "keyboard_alt", 15, 1)

/obj/item/card/id/proc/handle_ares_access(logged_in = MAIN_AI_SYSTEM, mob/user)
var/operator = key_name(user)
var/changer = logged_in
if(user)
changer = key_name(user)
var/datum/ares_link/link = GLOB.ares_link
if(logged_in == MAIN_AI_SYSTEM)
if(!user)
operator = "[MAIN_AI_SYSTEM] (Automated)"
else
operator = "[user.ckey]/([MAIN_AI_SYSTEM])"

if(ACCESS_MARINE_AI_TEMP in access)
access -= ACCESS_MARINE_AI_TEMP
link.active_ids -= src
modification_log += "Temporary AI access revoked by [operator]"
log_idmod(src, "Temporary AI access revoked by [logged_in]", changer)
to_chat(user, SPAN_NOTICE("Access revoked from [registered_name]."))
var/mob/living/carbon/human/id_owner = registered_ref?.resolve()
if(id_owner)
to_chat(id_owner, SPAN_WARNING("AI visitation access revoked."))
playsound_client(id_owner?.client, 'sound/machines/pda_ping.ogg', src, 25, 0)
else
access += ACCESS_MARINE_AI_TEMP
modification_log += "Temporary AI access granted by [operator]"
log_idmod(src, "Temporary AI access granted by [logged_in]", changer)
to_chat(user, SPAN_NOTICE("Access granted to [registered_name]."))
link.waiting_ids -= src
link.active_ids += src
Expand Down
7 changes: 7 additions & 0 deletions code/game/machinery/ARES/apollo_pda.dm
Original file line number Diff line number Diff line change
Expand Up @@ -463,6 +463,13 @@
sec_vent.create_gas(VENT_GAS_CN20_XENO, 6, 5 SECONDS)
log_admin("[key_name(operator)] released nerve gas from Vent '[sec_vent.vent_tag]' via ARES.")

if("security_lockdown")
if(!COOLDOWN_FINISHED(datacore, aicore_lockdown))
to_chat(user, SPAN_BOLDWARNING("AI Core Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(datacore, aicore_lockdown)] seconds!"))
return FALSE
aicore_lockdown(user)
return TRUE

if(playsound)
var/sound = pick('sound/machines/pda_button1.ogg', 'sound/machines/pda_button2.ogg')
playsound(src, sound, 15, TRUE)
24 changes: 15 additions & 9 deletions code/game/machinery/aicore_lockdown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@

add_fingerprint(user)
aicore_lockdown(user)
COOLDOWN_START(GLOB.ares_datacore, aicore_lockdown, 2 MINUTES)

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown
name = "ARES Emergency Lockdown Shutter"
Expand Down Expand Up @@ -63,12 +62,17 @@
if(!admin_holder ||!check_rights(R_EVENT))
return FALSE

var/prompt = tgui_alert(src, "Are you sure you want to trigger an AI Core lockdown alert? This will force red alert, and lockdown the AI Core.", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt != "Yes")
var/prompt = "Are you sure you want to trigger an AI Core lockdown? This will raise to red alert, and lockdown the AI Core."

if(GLOB.ares_datacore.ai_lockdown_state == ARES_LOCKDOWN_ACTIVE)
prompt = "Are you sure you want to lift the AI Core lockdown? This will lower to blue alert."

var/choice = tgui_alert(src, prompt, "Choose.", list("Yes", "No"), 20 SECONDS)
if(choice != "Yes")
return FALSE

prompt = tgui_alert(src, "Do you want to use a custom announcement?", "Choose.", list("Yes", "No"), 20 SECONDS)
if(prompt == "Yes")
choice = tgui_alert(src, "Do you want to use a custom announcement?", "Choose.", list("Yes", "No"), 20 SECONDS)
if(choice == "Yes")
var/whattoannounce = tgui_input_text(src, "Please enter announcement text.", "what?")
aicore_lockdown(usr, whattoannounce, TRUE)
else
Expand All @@ -81,9 +85,7 @@

var/log = "[key_name(user)] triggered AI core lockdown!"
var/ares_log = "[user.name] triggered triggered AI Core Emergency Lockdown."
if(!message)
message = "ATTENTION! \n\nCORE SECURITY ALERT. \n\nAI CORE UNDER LOCKDOWN."
else
if(message)
log = "[key_name(user)] triggered AI core emergency lockdown! (Using a custom announcement)."
if(admin)
log += " (Admin Triggered)."
Expand All @@ -92,12 +94,15 @@
switch(GLOB.ares_datacore.ai_lockdown_state)
if(ARES_LOCKDOWN_READY)
GLOB.ares_datacore.ai_lockdown_state = ARES_LOCKDOWN_ACTIVE
if(!message)
message = "ATTENTION! \n\nCORE SECURITY ALERT. \n\nAI CORE UNDER LOCKDOWN."
if(GLOB.security_level < SEC_LEVEL_RED)
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_AICORE_LOCKDOWN)
if(ARES_LOCKDOWN_ACTIVE)
GLOB.ares_datacore.ai_lockdown_state = ARES_LOCKDOWN_READY
message = "ATTENTION! \n\nAI CORE EMERGENCY LOCKDOWN LIFTED."
if(!message)
message = "ATTENTION! \n\nAI CORE EMERGENCY LOCKDOWN LIFTED."
log = "[key_name(user)] lifted AI core lockdown!"
ares_log = "[user.name] lifted AI Core Emergency Lockdown."
if(admin)
Expand All @@ -108,6 +113,7 @@
set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_AICORE_LIFT)

COOLDOWN_START(GLOB.ares_datacore, aicore_lockdown, 2 MINUTES)
shipwide_ai_announcement(message, MAIN_AI_SYSTEM, 'sound/effects/biohazard.ogg')
message_admins(log)
log_ares_security("AI Core Lockdown", ares_log)
14 changes: 14 additions & 0 deletions tgui/packages/tgui/interfaces/AresInterface.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -386,6 +386,20 @@ const MainMenu = (props) => {
onClick={() => act('page_core_sec')}
/>
</Stack.Item>
<Stack.Item grow>
<Button.Confirm
content="AI Core Lockdown"
align="center"
tooltip="Activate/Deactivate the AI Core Lockdown."
icon="lock"
color="red"
ml="auto"
px="2rem"
width="100%"
bold
onClick={() => act('security_lockdown')}
/>
</Stack.Item>
</Stack>
</Section>
)}
Expand Down
Loading

0 comments on commit fd58411

Please sign in to comment.