Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Project ARES: Ticket Notifications #5510

Merged
merged 9 commits into from
Mar 12, 2024
Merged
Show file tree
Hide file tree
Changes from 4 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
45 changes: 43 additions & 2 deletions code/game/machinery/ARES/ARES_interface_apollo.dm
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved


/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 @@ -79,6 +92,8 @@
data["apollo_log"] = list()
data["apollo_log"] += datacore.apollo_log
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved

data["notify_sounds"] = notify_sounds

var/list/logged_maintenance = list()
for(var/datum/ares_ticket/maintenance/maint_ticket as anything in link.tickets_maintenance)
if(!istype(maint_ticket))
Expand Down Expand Up @@ -198,6 +213,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 +241,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 Down Expand Up @@ -261,6 +281,8 @@
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")
Expand All @@ -280,6 +302,8 @@
return FALSE
if(ticket.ticket_priority)
ares_apollo_talk("Priority [ticket.ticket_type] [ticket.ticket_id] has been [choice] by [last_login].")
else
send_notifcation()
to_chat(usr, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
return TRUE

Expand Down Expand Up @@ -387,28 +411,45 @@
access_ticket.ticket_status = TICKET_REJECTED
to_chat(usr, 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(!istype(identification))
continue
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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
33 changes: 33 additions & 0 deletions code/game/machinery/ARES/apollo_pda.dm
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,9 @@
/// The last person to login.
var/last_login

/// Notification sound
var/notify_sounds = TRUE


/obj/item/device/working_joe_pda/proc/link_systems(datum/ares_link/new_link = GLOB.ares_link, override)
if(link && !override)
Expand All @@ -35,6 +38,16 @@
link_systems(override = FALSE)
. = ..()

/obj/item/device/working_joe_pda/proc/notify()
if(notify_sounds)
playsound(src, 'sound/machines/pda_ping.ogg', 25, 0)

/obj/item/device/working_joe_pda/proc/send_notifcation()
for(var/obj/item/device/working_joe_pda/ticketer as anything in link.ticket_computers)
if(ticketer == src)
continue
ticketer.notify()

/obj/item/device/working_joe_pda/proc/delink()
if(link)
link.ticket_computers -= src
Expand Down Expand Up @@ -103,6 +116,8 @@
data["apollo_log"] = list()
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)
if(!istype(maint_ticket))
Expand Down Expand Up @@ -223,6 +238,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 @@ -248,6 +266,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 Down Expand Up @@ -286,6 +306,8 @@
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")
Expand All @@ -305,6 +327,8 @@
return FALSE
if(ticket.ticket_priority)
ares_apollo_talk("Priority [ticket.ticket_type] [ticket.ticket_id] has been [choice] by [last_login].")
else
send_notifcation()
to_chat(usr, SPAN_NOTICE("[ticket.ticket_type] [ticket.ticket_id] marked as [choice]."))
return TRUE

Expand Down Expand Up @@ -412,6 +436,15 @@
access_ticket.ticket_status = TICKET_REJECTED
to_chat(usr, 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(!istype(identification))
continue
realforest2001 marked this conversation as resolved.
Show resolved Hide resolved
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)
Expand Down
2 changes: 1 addition & 1 deletion code/game/objects/items/cards_ids.dm
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@

/// The name registered_name on the card
var/registered_name = "Unknown"
var/registered_ref = null
var/datum/weakref/registered_ref = null
var/registered_gid = 0
flags_equip_slot = SLOT_ID

Expand Down
Binary file added sound/machines/pda_ping.ogg
Binary file not shown.
22 changes: 19 additions & 3 deletions tgui/packages/tgui/interfaces/WorkingJoe.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -63,12 +63,22 @@ const Login = (props) => {

const MainMenu = (props) => {
const { data, act } = useBackend();
const { logged_in, access_text, last_page, current_menu, access_level } =
data;
const {
logged_in,
access_text,
last_page,
current_menu,
access_level,
notify_sounds,
} = data;
let can_request_access = 'Yes';
if (access_level > 2) {
can_request_access = 'No';
}
let soundicon = 'volume-high';
if (!notify_sounds) {
soundicon = 'volume-xmark';
}

return (
<>
Expand All @@ -86,11 +96,17 @@ const MainMenu = (props) => {
<Button
icon="house"
ml="auto"
mr="1rem"
tooltip="Navigation Menu"
onClick={() => act('home')}
disabled={current_menu === 'main'}
/>
<Button
icon={soundicon}
ml="auto"
mr="1rem"
tooltip="Mute/Un-Mute notifcation sounds."
onClick={() => act('toggle_sound')}
/>
</Box>

<h3>
Expand Down
Loading