Skip to content

Commit

Permalink
Merge branch 'project/ares/wjnotifs' into project/ares/tm_holder
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Feb 26, 2024
2 parents 2d87496 + 0846eb1 commit 2841015
Show file tree
Hide file tree
Showing 5 changed files with 92 additions and 18 deletions.
49 changes: 41 additions & 8 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 @@ -79,6 +92,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 @@ -220,6 +235,9 @@
last_menu = current_menu
current_menu = "core_security_gas"

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 @@ -245,6 +263,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 @@ -283,6 +303,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 @@ -302,6 +324,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 @@ -350,8 +374,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 @@ -378,8 +400,6 @@
if(!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 @@ -388,8 +408,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 @@ -409,6 +427,13 @@
access_ticket.ticket_status = TICKET_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("trigger_vent")
Expand All @@ -433,23 +458,31 @@
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
37 changes: 31 additions & 6 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 @@ -245,6 +260,9 @@
last_menu = current_menu
current_menu = "core_security_gas"

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 @@ -270,6 +288,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 @@ -308,6 +328,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 @@ -327,6 +349,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 @@ -375,8 +399,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 @@ -403,8 +425,6 @@
if(!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 @@ -413,8 +433,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 @@ -434,6 +452,13 @@
access_ticket.ticket_status = TICKET_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("trigger_vent")
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 @@ -64,12 +64,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 @@ -87,11 +97,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

0 comments on commit 2841015

Please sign in to comment.