mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-29 15:08:02 +01:00
Request Console Unread Messages Reminder (#23897)
* Refactor createMessage out of message server * Change radio message * Add reminder * Fix linting errors * Fix more linting errors --------- Co-authored-by: Arthri <41360489+a@users.noreply.github.com>
This commit is contained in:
@@ -65,6 +65,7 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
var/print_cooldown = 0 //cooldown on shipping label printer, stores the in-game time of when the printer will next be ready
|
||||
var/obj/item/radio/Radio
|
||||
var/radiochannel = ""
|
||||
var/reminder_timer_id = TIMER_ID_NULL
|
||||
|
||||
/obj/machinery/requests_console/power_change()
|
||||
if(!..())
|
||||
@@ -243,7 +244,7 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
else if(recipient in SUPPLY_ROLES)
|
||||
radiochannel = "Supply"
|
||||
message_log.Add(list(list("Message sent to [recipient] at [station_time_timestamp()]", "[message]")))
|
||||
Radio.autosay("Alert; a new requests console message received for [recipient] from [department]", null, "[radiochannel]")
|
||||
Radio.autosay("Alert; a new message has been received from [department]", "[recipient] Requests Console", "[radiochannel]")
|
||||
else
|
||||
atom_say("No server detected!")
|
||||
|
||||
@@ -259,6 +260,9 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
Console.newmessagepriority = RQ_NONEW_MESSAGES
|
||||
Console.update_icon(UPDATE_OVERLAYS)
|
||||
Console.set_light(1)
|
||||
if(reminder_timer_id != TIMER_ID_NULL)
|
||||
deltimer(reminder_timer_id)
|
||||
reminder_timer_id = TIMER_ID_NULL
|
||||
if(tempScreen == RCS_MAINMENU)
|
||||
reset_message()
|
||||
screen = tempScreen
|
||||
@@ -332,29 +336,40 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
if(mainmenu)
|
||||
screen = RCS_MAINMENU
|
||||
|
||||
/obj/machinery/requests_console/proc/createMessage(source, title, message, priority)
|
||||
/obj/machinery/requests_console/proc/createMessage(source, title, message, priority, forced = FALSE)
|
||||
var/linkedSender
|
||||
if(inoperable() && !forced)
|
||||
message_log.Add(list(list("Message lost due to console failure. Please contact [station_name()]'s system administrator or AI for technical assistance.")))
|
||||
return
|
||||
if(istype(source, /obj/machinery/requests_console))
|
||||
var/obj/machinery/requests_console/sender = source
|
||||
linkedSender = sender.department
|
||||
else
|
||||
capitalize(source)
|
||||
linkedSender = source
|
||||
capitalize(title)
|
||||
if(newmessagepriority < priority)
|
||||
newmessagepriority = priority
|
||||
update_icon(UPDATE_ICON_STATE | UPDATE_OVERLAYS)
|
||||
if(!silent)
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 50, TRUE)
|
||||
atom_say(title)
|
||||
if(reminder_timer_id == TIMER_ID_NULL)
|
||||
reminder_timer_id = addtimer(CALLBACK(src, PROC_REF(remind_unread_messages)), 5 MINUTES, TIMER_STOPPABLE | TIMER_LOOP)
|
||||
|
||||
switch(priority)
|
||||
if(RQ_HIGHPRIORITY) // High
|
||||
message_log.Add(list(list("High Priority - From: [linkedSender]") + message)) // List in a list for passing into TGUI
|
||||
message_log.Add(list(list("High Priority - From: [linkedSender]", message))) // List in a list for passing into TGUI
|
||||
else // Normal
|
||||
message_log.Add(list(list("From: [linkedSender]") + message)) // List in a list for passing into TGUI
|
||||
message_log.Add(list(list("From: [linkedSender]", message))) // List in a list for passing into TGUI
|
||||
set_light(2)
|
||||
|
||||
/obj/machinery/requests_console/proc/remind_unread_messages()
|
||||
if(newmessagepriority == RQ_NONEW_MESSAGES)
|
||||
deltimer(reminder_timer_id)
|
||||
reminder_timer_id = TIMER_ID_NULL
|
||||
return
|
||||
|
||||
atom_say("Unread message(s) available.")
|
||||
|
||||
/obj/machinery/requests_console/proc/print_label(tag_name, tag_index)
|
||||
var/obj/item/shippingPackage/sp = new /obj/item/shippingPackage(get_turf(src))
|
||||
sp.sortTag = tag_index
|
||||
|
||||
@@ -92,24 +92,13 @@ GLOBAL_LIST_EMPTY(message_servers)
|
||||
for(var/C in GLOB.allRequestConsoles)
|
||||
var/obj/machinery/requests_console/RC = C
|
||||
if(ckey(RC.department) == ckey(recipient))
|
||||
if(RC.inoperable())
|
||||
RC.message_log.Add(list(list("Message lost due to console failure. Please contact [station_name()]'s system administrator or AI for technical assistance.")))
|
||||
continue
|
||||
if(RC.newmessagepriority < priority)
|
||||
RC.newmessagepriority = priority
|
||||
RC.update_icon(UPDATE_OVERLAYS)
|
||||
var/title
|
||||
switch(priority)
|
||||
if(2)
|
||||
if(!RC.silent)
|
||||
playsound(RC.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
RC.atom_say("PRIORITY Alert in [sender]")
|
||||
RC.message_log.Add(list(list("High Priority message from [sender]:", "[authmsg]")))
|
||||
title = "PRIORITY Alert in [sender]"
|
||||
else
|
||||
if(!RC.silent)
|
||||
playsound(RC.loc, 'sound/machines/twobeep.ogg', 50, 1)
|
||||
RC.atom_say("Message from [sender]")
|
||||
RC.message_log.Add(list(list("Message [sender]:", "[authmsg]")))
|
||||
RC.set_light(2)
|
||||
title = "Message from [sender]"
|
||||
RC.createMessage(sender, title, authmsg, priority)
|
||||
|
||||
/obj/machinery/message_server/attack_hand(user as mob)
|
||||
to_chat(user, "You toggle PDA message passing from [active ? "On" : "Off"] to [active ? "Off" : "On"]")
|
||||
|
||||
Reference in New Issue
Block a user