mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-26 13:37:58 +01:00
Set Ore Redemption Machines to use Low Priority Messages (#26444)
* Refactor createMessage out of message server * Change radio message * Add reminder * Fix linting errors * Fix more linting errors * Update priorities * Add low priority icon * Lower indent * Fix switch statement * Add low priority icon * No reminders for low priority messages * Update priorities in frontend * Build and update /tg/ui * Fix typo * Clarify purpose of return * [ci skip] * Build and update /tg/ui * [ci skip] * Build and update /tg/ui --------- Co-authored-by: Arthri <41360489+a@users.noreply.github.com> Co-authored-by: /tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com>
This commit is contained in:
co-authored by
Arthri
/tg/ui Builder <41898282+github-actions[bot]@users.noreply.github.com>
parent
5a897730c2
commit
494704e323
@@ -600,8 +600,9 @@
|
||||
// Request console message priority defines
|
||||
|
||||
#define RQ_NONEW_MESSAGES 0 // RQ_NONEWMESSAGES = no new message
|
||||
#define RQ_NORMALPRIORITY 1 // RQ_NORMALPRIORITY = normal priority
|
||||
#define RQ_HIGHPRIORITY 2 // RQ_HIGHPRIORITY = high priority
|
||||
#define RQ_LOWPRIORITY 1 // RQ_LOWPRIORITY = low priority
|
||||
#define RQ_NORMALPRIORITY 2 // RQ_NORMALPRIORITY = normal priority
|
||||
#define RQ_HIGHPRIORITY 3 // RQ_HIGHPRIORITY = high priority
|
||||
|
||||
/**
|
||||
* Reading books can help with brain damage!
|
||||
|
||||
@@ -195,21 +195,26 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
|
||||
switch(action)
|
||||
if("writeInput")
|
||||
if(reject_bad_text(params["write"]))
|
||||
recipient = params["write"] //write contains the string of the receiving department's name
|
||||
var/new_message = tgui_input_text(usr, "Write your message:", "Awaiting Input", encode = FALSE)
|
||||
if(isnull(new_message))
|
||||
reset_message(FALSE)
|
||||
return
|
||||
message = new_message
|
||||
screen = RCS_MESSAUTH
|
||||
switch(params["priority"])
|
||||
if("1")
|
||||
priority = RQ_NORMALPRIORITY
|
||||
if("2")
|
||||
priority = RQ_HIGHPRIORITY
|
||||
else
|
||||
priority = RQ_NONEW_MESSAGES
|
||||
if(!reject_bad_text(params["write"]))
|
||||
return
|
||||
recipient = params["write"] //write contains the string of the receiving department's name
|
||||
var/new_message = tgui_input_text(usr, "Write your message:", "Awaiting Input", encode = FALSE)
|
||||
if(isnull(new_message))
|
||||
reset_message(FALSE)
|
||||
return
|
||||
message = new_message
|
||||
screen = RCS_MESSAUTH
|
||||
var/new_priority = text2num(params["priority"])
|
||||
switch(new_priority)
|
||||
if(RQ_LOWPRIORITY)
|
||||
priority = RQ_LOWPRIORITY
|
||||
if(RQ_NORMALPRIORITY)
|
||||
priority = RQ_NORMALPRIORITY
|
||||
if(RQ_HIGHPRIORITY)
|
||||
priority = RQ_HIGHPRIORITY
|
||||
else
|
||||
// Forcibly update UI state
|
||||
return TRUE
|
||||
|
||||
if("writeAnnouncement")
|
||||
var/new_message = tgui_input_text(usr, "Write your message:", "Awaiting Input", message, multiline = TRUE, encode = FALSE)
|
||||
@@ -354,7 +359,7 @@ GLOBAL_LIST_EMPTY(allRequestConsoles)
|
||||
if(!silent)
|
||||
playsound(loc, 'sound/machines/twobeep.ogg', 50, TRUE)
|
||||
atom_say(title)
|
||||
if(reminder_timer_id == TIMER_ID_NULL)
|
||||
if(reminder_timer_id == TIMER_ID_NULL && priority > RQ_LOWPRIORITY)
|
||||
reminder_timer_id = addtimer(CALLBACK(src, PROC_REF(remind_unread_messages)), 5 MINUTES, TIMER_STOPPABLE | TIMER_LOOP)
|
||||
|
||||
switch(priority)
|
||||
|
||||
@@ -160,7 +160,7 @@
|
||||
if(destination in announce_beacons)
|
||||
for(var/obj/machinery/requests_console/D in GLOB.allRequestConsoles)
|
||||
if(D.department in announce_beacons[destination])
|
||||
D.createMessage(name, "Your Crate has Arrived!", msg, 1)
|
||||
D.createMessage(name, "Your Crate has Arrived!", msg, RQ_NORMALPRIORITY)
|
||||
|
||||
/obj/structure/closet/crate/secure
|
||||
desc = "A secure crate."
|
||||
|
||||
@@ -46,7 +46,7 @@
|
||||
var/my_department = "[station_name()] firewall subroutines"
|
||||
var/rc_message = "An unknown malicious program has been detected in the [english_list(areaName)] lighting and airlock control systems at [station_time_timestamp()]. Systems will be fully compromised within approximately one minute. Direct intervention is required immediately.<br>"
|
||||
for(var/obj/machinery/message_server/MS in GLOB.machines)
|
||||
MS.send_rc_message("Engineering", my_department, rc_message, "", "", 2)
|
||||
MS.send_rc_message("Engineering", my_department, rc_message, "", "", RQ_HIGHPRIORITY)
|
||||
else
|
||||
stack_trace("Could not initiate grey-tide. Unable to find suitable containment area.")
|
||||
kill()
|
||||
|
||||
@@ -471,7 +471,7 @@
|
||||
if(!(C.department in supply_consoles))
|
||||
continue
|
||||
if(!supply_consoles[C.department] || length(supply_consoles[C.department] - mats_in_stock))
|
||||
C.createMessage("Ore Redemption Machine", "New Minerals Available!", msg, RQ_NORMALPRIORITY)
|
||||
C.createMessage("Ore Redemption Machine", "New Minerals Available!", msg, RQ_LOWPRIORITY)
|
||||
|
||||
/obj/machinery/mineral/ore_redemption/proc/try_refill_storage(mob/living/silicon/robot/robot)
|
||||
. = FALSE
|
||||
|
||||
@@ -82,7 +82,7 @@ GLOBAL_LIST_EMPTY(message_servers)
|
||||
/obj/machinery/message_server/proc/send_pda_message(recipient = "", sender = "", message = "")
|
||||
pda_msgs += new/datum/data_pda_msg(recipient,sender,message)
|
||||
|
||||
/obj/machinery/message_server/proc/send_rc_message(recipient = "", sender = "", message = list(), stamp = "Not stamped", id_auth = "Not verified", priority = 1)
|
||||
/obj/machinery/message_server/proc/send_rc_message(recipient = "", sender = "", message = list(), stamp = "Not stamped", id_auth = "Not verified", priority = RQ_NORMALPRIORITY)
|
||||
if(!islist(message))
|
||||
message = list(message)
|
||||
rc_msgs += new/datum/data_rc_msg(recipient,sender,message,stamp,id_auth)
|
||||
@@ -91,7 +91,7 @@ GLOBAL_LIST_EMPTY(message_servers)
|
||||
if(ckey(RC.department) == ckey(recipient))
|
||||
var/title
|
||||
switch(priority)
|
||||
if(2)
|
||||
if(RQ_HIGHPRIORITY)
|
||||
title = "PRIORITY Alert from [sender]"
|
||||
else
|
||||
title = "Message from [sender]"
|
||||
|
||||
Binary file not shown.
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 36 KiB |
@@ -2,6 +2,11 @@ import { useBackend } from '../backend';
|
||||
import { Button, LabeledList, Box, Section, Stack, Blink } from '../components';
|
||||
import { Window } from '../layouts';
|
||||
|
||||
const RQ_NONEW_MESSAGES = 0;
|
||||
const RQ_LOWPRIORITY = 1;
|
||||
const RQ_NORMALPRIORITY = 2;
|
||||
const RQ_HIGHPRIORITY = 3;
|
||||
|
||||
export const RequestConsole = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { screen, announcementConsole } = data;
|
||||
@@ -52,13 +57,13 @@ const MainMenu = (props, context) => {
|
||||
const { act, data } = useBackend(context);
|
||||
const { newmessagepriority, announcementConsole, silent } = data;
|
||||
let messageInfo;
|
||||
if (newmessagepriority === 1) {
|
||||
if (newmessagepriority >= RQ_NONEW_MESSAGES) {
|
||||
messageInfo = (
|
||||
<Box color="red" bold mb={1}>
|
||||
There are new messages
|
||||
</Box>
|
||||
);
|
||||
} else if (newmessagepriority === 2) {
|
||||
} else if (newmessagepriority === RQ_HIGHPRIORITY) {
|
||||
messageInfo = (
|
||||
<Blink>
|
||||
<Box color="red" bold mb={1}>
|
||||
@@ -96,7 +101,7 @@ const MainMenu = (props, context) => {
|
||||
lineHeight={3}
|
||||
color="translucent"
|
||||
content="View Messages"
|
||||
icon={newmessagepriority > 0 ? 'envelope-open-text' : 'envelope'}
|
||||
icon={newmessagepriority > RQ_NONEW_MESSAGES ? 'envelope-open-text' : 'envelope'}
|
||||
onClick={() => act('setScreen', { setScreen: 6 })}
|
||||
/>
|
||||
</Stack.Item>
|
||||
@@ -209,12 +214,12 @@ const DepartmentList = (props, context) => {
|
||||
<Button
|
||||
content="Message"
|
||||
icon="envelope"
|
||||
onClick={() => act('writeInput', { write: d, priority: '1' })}
|
||||
onClick={() => act('writeInput', { write: d, priority: RQ_NORMALPRIORITY })}
|
||||
/>
|
||||
<Button
|
||||
content="High Priority"
|
||||
icon="exclamation-circle"
|
||||
onClick={() => act('writeInput', { write: d, priority: '2' })}
|
||||
onClick={() => act('writeInput', { write: d, priority: RQ_HIGHPRIORITY })}
|
||||
/>
|
||||
</LabeledList.Item>
|
||||
))}
|
||||
|
||||
+30
-30
File diff suppressed because one or more lines are too long
Reference in New Issue
Block a user