Skip to content

Commit

Permalink
Project ARES: Ticket Notifications (#5510)
Browse files Browse the repository at this point in the history
# About the pull request
Adds audio notifications for certain ticket interactions, played from
APOLLO consoles and WJ PDAs.
<!-- Remove this text and explain what the purpose of your PR is.

Mention if you have tested your changes. If you changed a map, make sure
you used the mapmerge tool.
If this is an Issue Correction, you can type "Fixes Issue #169420" to
link the PR to the corresponding Issue number #169420.

Remember: something that is self-evident to you might not be to others.
Explain your rationale fully, even if you feel it goes without saying.
-->

# Explain why it's good for the game
# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
soundadd: Added pda_ping.ogg, sourced from Paradise SS13
mailapproved.ogg
add: Added notification sounds from certain APOLLO ticket interactions.
add: People making an access ticket request are now notified of the
status changes.
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
realforest2001 and Drulikar authored Mar 12, 2024
1 parent 135e111 commit 02350b6
Show file tree
Hide file tree
Showing 6 changed files with 143 additions and 70 deletions.
54 changes: 27 additions & 27 deletions code/game/machinery/ARES/ARES_interface.dm
Original file line number Diff line number Diff line change
Expand Up @@ -218,17 +218,17 @@
return

playsound(src, "keyboard_alt", 15, 1)
var/mob/living/carbon/human/operator = ui.user

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

if("login")
var/mob/living/carbon/human/operator = usr
var/obj/item/card/id/idcard = operator.get_active_hand()
if(istype(idcard))
authentication = get_ares_access(idcard)
Expand All @@ -239,22 +239,22 @@
authentication = get_ares_access(idcard)
last_login = idcard.registered_name
else
to_chat(usr, SPAN_WARNING("You require an ID card to access this terminal!"))
to_chat(operator, SPAN_WARNING("You require an ID card to access this terminal!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(authentication)
datacore.interface_access_list += "[last_login] at [worldtime2text()], Access Level [authentication] - [ares_auth_to_text(authentication)]."
current_menu = "main"

if("sudo")
var/new_user = tgui_input_text(usr, "Enter Sudo Username", "Sudo User", encode = FALSE)
var/new_user = tgui_input_text(operator, "Enter Sudo Username", "Sudo User", encode = FALSE)
if(new_user)
if(new_user == sudo_holder)
last_login = sudo_holder
sudo_holder = null
return FALSE
if(new_user == last_login)
to_chat(usr, SPAN_WARNING("Already remote logged in as this user."))
to_chat(operator, SPAN_WARNING("Already remote logged in as this user."))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
sudo_holder = last_login
Expand Down Expand Up @@ -370,9 +370,9 @@
datacore.records_talking -= conversation

if("message_ares")
var/message = tgui_input_text(usr, "What do you wish to say to ARES?", "ARES Message", encode = FALSE)
var/message = tgui_input_text(operator, "What do you wish to say to ARES?", "ARES Message", encode = FALSE)
if(message)
message_ares(message, usr, params["active_convo"])
message_ares(message, operator, params["active_convo"])

if("read_record")
var/datum/ares_record/deleted_talk/conversation = locate(params["record"])
Expand All @@ -385,90 +385,90 @@
// -- Emergency Buttons -- //
if("general_quarters")
if(!COOLDOWN_FINISHED(datacore, ares_quarters_cooldown))
to_chat(usr, SPAN_WARNING("It has not been long enough since the last General Quarters call!"))
to_chat(operator, SPAN_WARNING("It has not been long enough since the last General Quarters call!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(GLOB.security_level < SEC_LEVEL_RED)
set_security_level(SEC_LEVEL_RED, no_sound = TRUE, announce = FALSE)
shipwide_ai_announcement("ATTENTION! GENERAL QUARTERS. ALL HANDS, MAN YOUR BATTLESTATIONS.", MAIN_AI_SYSTEM, 'sound/effects/GQfullcall.ogg')
log_game("[key_name(usr)] has called for general quarters via ARES.")
message_admins("[key_name_admin(usr)] has called for general quarters via ARES.")
log_game("[key_name(operator)] has called for general quarters via ARES.")
message_admins("[key_name_admin(operator)] has called for general quarters via ARES.")
log_ares_security("General Quarters", "[last_login] has called for general quarters via ARES.")
COOLDOWN_START(datacore, ares_quarters_cooldown, 10 MINUTES)
. = TRUE

if("evacuation_start")
if(GLOB.security_level < SEC_LEVEL_RED)
to_chat(usr, SPAN_WARNING("The ship must be under red alert in order to enact evacuation procedures."))
to_chat(operator, SPAN_WARNING("The ship must be under red alert in order to enact evacuation procedures."))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

if(SShijack.evac_admin_denied)
to_chat(usr, SPAN_WARNING("The USCM has placed a lock on deploying the evacuation pods."))
to_chat(operator, SPAN_WARNING("The USCM has placed a lock on deploying the evacuation pods."))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

if(!SShijack.initiate_evacuation())
to_chat(usr, SPAN_WARNING("You are unable to initiate an evacuation procedure right now!"))
to_chat(operator, SPAN_WARNING("You are unable to initiate an evacuation procedure right now!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

log_game("[key_name(usr)] has called for an emergency evacuation via ARES.")
message_admins("[key_name_admin(usr)] has called for an emergency evacuation via ARES.")
log_game("[key_name(operator)] has called for an emergency evacuation via ARES.")
message_admins("[key_name_admin(operator)] has called for an emergency evacuation via ARES.")
log_ares_security("Initiate Evacuation", "[last_login] has called for an emergency evacuation via ARES.")
. = TRUE

if("distress")
if(!SSticker.mode)
return FALSE //Not a game mode?
if(world.time < DISTRESS_TIME_LOCK)
to_chat(usr, SPAN_WARNING("You have been here for less than six minutes... what could you possibly have done!"))
to_chat(operator, SPAN_WARNING("You have been here for less than six minutes... what could you possibly have done!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(!COOLDOWN_FINISHED(datacore, ares_distress_cooldown))
to_chat(usr, SPAN_WARNING("The distress launcher is cooling down!"))
to_chat(operator, SPAN_WARNING("The distress launcher is cooling down!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(GLOB.security_level == SEC_LEVEL_DELTA)
to_chat(usr, SPAN_WARNING("The ship is already undergoing self destruct procedures!"))
to_chat(operator, SPAN_WARNING("The ship is already undergoing self destruct procedures!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(GLOB.security_level < SEC_LEVEL_RED)
to_chat(usr, SPAN_WARNING("The ship must be under red alert to launch a distress beacon!"))
to_chat(operator, SPAN_WARNING("The ship must be under red alert to launch a distress beacon!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE

for(var/client/admin in GLOB.admins)
if((R_ADMIN|R_MOD) & admin.admin_holder.rights)
playsound_client(admin,'sound/effects/sos-morse-code.ogg',10)
SSticker.mode.request_ert(usr, TRUE)
to_chat(usr, SPAN_NOTICE("A distress beacon request has been sent to USCM High Command."))
SSticker.mode.request_ert(operator, TRUE)
to_chat(operator, SPAN_NOTICE("A distress beacon request has been sent to USCM High Command."))
COOLDOWN_START(datacore, ares_distress_cooldown, COOLDOWN_COMM_REQUEST)
return TRUE

if("nuclearbomb")
if(!SSticker.mode)
return FALSE //Not a game mode?
if(world.time < NUCLEAR_TIME_LOCK)
to_chat(usr, SPAN_WARNING("It is too soon to request Nuclear Ordnance!"))
to_chat(operator, SPAN_WARNING("It is too soon to request Nuclear Ordnance!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(!COOLDOWN_FINISHED(datacore, ares_nuclear_cooldown))
to_chat(usr, SPAN_WARNING("The ordnance request frequency is garbled, wait for reset!"))
to_chat(operator, SPAN_WARNING("The ordnance request frequency is garbled, wait for reset!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
if(GLOB.security_level == SEC_LEVEL_DELTA || SSticker.mode.is_in_endgame)
to_chat(usr, SPAN_WARNING("The mission has failed catastrophically, what do you want a nuke for?!"))
to_chat(operator, SPAN_WARNING("The mission has failed catastrophically, what do you want a nuke for?!"))
playsound(src, 'sound/machines/buzz-two.ogg', 15, 1)
return FALSE
var/reason = tgui_input_text(usr, "Please enter reason nuclear ordnance is required.", "Reason for Nuclear Ordnance")
var/reason = tgui_input_text(operator, "Please enter reason nuclear ordnance is required.", "Reason for Nuclear Ordnance")
if(!reason)
return FALSE
for(var/client/admin in GLOB.admins)
if((R_ADMIN|R_MOD) & admin.admin_holder.rights)
playsound_client(admin,'sound/effects/sos-morse-code.ogg',10)
message_admins("[key_name(usr)] has requested use of Nuclear Ordnance (via ARES)! Reason: <b>[reason]</b> [CC_MARK(usr)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukeapprove=\ref[usr]'>APPROVE</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukedeny=\ref[usr]'>DENY</A>) [ADMIN_JMP_USER(usr)] [CC_REPLY(usr)]")
to_chat(usr, SPAN_NOTICE("A nuclear ordnance request has been sent to USCM High Command for the following reason: [reason]"))
message_admins("[key_name(operator)] has requested use of Nuclear Ordnance (via ARES)! Reason: <b>[reason]</b> [CC_MARK(operator)] (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukeapprove=\ref[operator]'>APPROVE</A>) (<A HREF='?_src_=admin_holder;[HrefToken(forceGlobal = TRUE)];nukedeny=\ref[operator]'>DENY</A>) [ADMIN_JMP_USER(operator)] [CC_REPLY(operator)]")
to_chat(operator, SPAN_NOTICE("A nuclear ordnance request has been sent to USCM High Command for the following reason: [reason]"))
log_ares_security("Nuclear Ordnance Request", "[last_login] has sent a request for nuclear ordnance for the following reason: [reason]")
if(ares_can_interface())
ai_silent_announcement("[last_login] has sent a request for nuclear ordnance to USCM High Command.", ".V")
Expand Down
76 changes: 54 additions & 22 deletions code/game/machinery/ARES/ARES_interface_apollo.dm
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@
/// The last person to login.
var/last_login

/// Notification sound
var/notify_sounds = TRUE


/obj/structure/machinery/computer/working_joe/proc/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
if(link && !override)
Expand All @@ -34,6 +37,16 @@
link_systems(override = FALSE)
. = ..()

/obj/structure/machinery/computer/working_joe/proc/notify()
if(notify_sounds)
playsound(src, 'sound/machines/pda_ping.ogg', 25, 0)

/obj/structure/machinery/computer/working_joe/proc/send_notifcation()
for(var/obj/structure/machinery/computer/working_joe/ticketer as anything in link.ticket_computers)
if(ticketer == src)
continue
ticketer.notify()

/obj/structure/machinery/computer/working_joe/proc/delink()
if(link)
link.ticket_computers -= src
Expand Down Expand Up @@ -76,8 +89,9 @@
data["access_log"] = list()
data["access_log"] += datacore.apollo_login_list

data["apollo_log"] = list()
data["apollo_log"] += datacore.apollo_log
data["apollo_log"] = datacore.apollo_log

data["notify_sounds"] = notify_sounds

var/list/logged_maintenance = list()
for(var/datum/ares_ticket/maintenance/maint_ticket as anything in link.tickets_maintenance)
Expand Down Expand Up @@ -142,12 +156,12 @@
return

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

switch (action)
if("go_back")
if(!last_menu)
return to_chat(usr, SPAN_WARNING("Error, no previous page detected."))
return to_chat(operator, SPAN_WARNING("Error, no previous page detected."))
var/temp_holder = current_menu
current_menu = last_menu
last_menu = temp_holder
Expand Down Expand Up @@ -198,6 +212,9 @@
last_menu = current_menu
current_menu = "maint_claim"

if("toggle_sound")
notify_sounds = !notify_sounds

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)
Expand All @@ -223,6 +240,8 @@
link.tickets_maintenance += maint_ticket
if(priority_report)
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]'.")
return TRUE
return FALSE
Expand All @@ -235,14 +254,14 @@
var/assigned = ticket.ticket_assignee
if(assigned)
if(assigned == last_login)
var/prompt = tgui_alert(usr, "You already claimed this ticket! Do you wish to drop your claim?", "Unclaim ticket", list("Yes", "No"))
var/prompt = tgui_alert(operator, "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(usr, "This ticket has already been claimed by [assigned]! Do you wish to override their claim?", "Claim Override", list("Yes", "No"))
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"))
if(choice != "Yes")
claim = FALSE
if(claim)
Expand All @@ -255,22 +274,24 @@
if(!istype(ticket))
return FALSE
if(ticket.ticket_submitter != last_login)
to_chat(usr, SPAN_WARNING("You cannot cancel a ticket that does not belong to you!"))
to_chat(operator, SPAN_WARNING("You cannot cancel a ticket that does not belong to you!"))
return FALSE
to_chat(usr, SPAN_WARNING("[ticket.ticket_type] [ticket.ticket_id] has been cancelled."))
to_chat(operator, 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.")
else
send_notifcation()
return TRUE

if("mark_ticket")
var/datum/ares_ticket/ticket = locate(params["ticket"])
if(!istype(ticket))
return FALSE
if(ticket.ticket_assignee != last_login && ticket.ticket_assignee) //must be claimed by you or unclaimed.)
to_chat(usr, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
to_chat(operator, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
return FALSE
var/choice = tgui_alert(usr, "What do you wish to mark the ticket as?", "Mark", list(TICKET_COMPLETED, TICKET_REJECTED), 20 SECONDS)
var/choice = tgui_alert(operator, "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 @@ -280,7 +301,9 @@
return FALSE
if(ticket.ticket_priority)
ares_apollo_talk("Priority [ticket.ticket_type] [ticket.ticket_id] has been [choice] by [last_login].")
to_chat(usr, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
else
send_notifcation()
to_chat(operator, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
return TRUE

if("new_access")
Expand Down Expand Up @@ -328,8 +351,6 @@
break

for(var/obj/item/card/id/identification in link.active_ids)
if(!istype(identification))
continue
if(identification.registered_gid != access_ticket.user_id_num)
continue

Expand All @@ -353,11 +374,9 @@
if("auth_access")
playsound = FALSE
var/datum/ares_ticket/access/access_ticket = locate(params["ticket"])
if(!access_ticket)
if(!istype(access_ticket))
return FALSE
for(var/obj/item/card/id/identification in link.waiting_ids)
if(!istype(identification))
continue
if(identification.registered_gid != access_ticket.user_id_num)
continue
identification.handle_ares_access(last_login, operator)
Expand All @@ -366,8 +385,6 @@
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(!istype(identification))
continue
if(identification.registered_gid != access_ticket.user_id_num)
continue
identification.handle_ares_access(last_login, operator)
Expand All @@ -382,33 +399,48 @@
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(usr, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
to_chat(operator, SPAN_WARNING("You cannot update a ticket that is not assigned to you!"))
return FALSE
access_ticket.ticket_status = TICKET_REJECTED
to_chat(usr, SPAN_NOTICE("[access_ticket.ticket_type] [access_ticket.ticket_id] marked as rejected."))
to_chat(operator, 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)
continue
var/mob/living/carbon/human/id_owner = identification.registered_ref?.resolve()
if(id_owner)
to_chat(id_owner, SPAN_WARNING("AI visitation access rejected."))
playsound_client(id_owner?.client, 'sound/machines/pda_ping.ogg', src, 25, 0)
return TRUE

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

/obj/item/card/id/proc/handle_ares_access(logged_in, mob/user)
/obj/item/card/id/proc/handle_ares_access(logged_in = MAIN_AI_SYSTEM, mob/user)
var/operator = key_name(user)
var/datum/ares_link/link = GLOB.ares_link
if(logged_in == MAIN_AI_SYSTEM)
if(!user)
operator = "[MAIN_AI_SYSTEM] (Sensor Trip)"
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]"
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]"
to_chat(user, SPAN_NOTICE("Access granted to [registered_name]."))
link.waiting_ids -= src
link.active_ids += src
var/mob/living/carbon/human/id_owner = registered_ref?.resolve()
if(id_owner)
to_chat(id_owner, SPAN_HELPFUL("AI visitation access granted."))
playsound_client(id_owner?.client, 'sound/machines/pda_ping.ogg', src, 25, 0)
return TRUE
Loading

0 comments on commit 02350b6

Please sign in to comment.