Skip to content

Custom Command Report Updates! #5353

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

Merged
merged 7 commits into from
Mar 27, 2025
Merged
Show file tree
Hide file tree
Changes from 2 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
10 changes: 5 additions & 5 deletions code/__HELPERS/priority_announce.dm
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@
* * encode_title - if TRUE, the title will be HTML encoded
* * encode_text - if TRUE, the text will be HTML encoded
*/
/proc/priority_announce(text, title = "", sound, type, sender_override, has_important_message = FALSE, list/mob/players = GLOB.player_list, encode_title = TRUE, encode_text = TRUE, color_override)
/proc/priority_announce(text, title = "", sound, type, sender_override, has_important_message = FALSE, list/mob/players = GLOB.player_list, encode_title = TRUE, encode_text = TRUE, color_override, append_update = TRUE)
if(!text)
return

Expand Down Expand Up @@ -74,7 +74,7 @@
header = MAJOR_ANNOUNCEMENT_TITLE("Station Announcement by [sender.name] (AI)")
// MONKESTATION ADDITION END
else
header += generate_unique_announcement_header(title, sender_override)
header += generate_unique_announcement_header(title, sender_override, append_update) // Monkestation edit - update append

announcement_strings += ANNOUNCEMENT_HEADER(header)

Expand All @@ -96,7 +96,7 @@
if(length(title) > 0)
GLOB.news_network.submit_article(title + "<br><br>" + text, "[command_name()]", "Station Announcements", null)
else
GLOB.news_network.submit_article(text, "[command_name()] Update", "Station Announcements", null)
GLOB.news_network.submit_article(text, "[command_name()][append_update ? " Update" : ""]", "Station Announcements", null)

/proc/print_command_report(text = "", title = null, announce=TRUE)
if(!title)
Expand Down Expand Up @@ -179,10 +179,10 @@

/// Proc that just generates a custom header based on variables fed into `priority_announce()`
/// Will return a string.
/proc/generate_unique_announcement_header(title, sender_override)
/proc/generate_unique_announcement_header(title, sender_override, append_update = TRUE)
var/list/returnable_strings = list()
if(isnull(sender_override))
returnable_strings += MAJOR_ANNOUNCEMENT_TITLE("[command_name()] Update")
returnable_strings += MAJOR_ANNOUNCEMENT_TITLE("[command_name()][append_update ? " Update" : ""]")
else
returnable_strings += MAJOR_ANNOUNCEMENT_TITLE(sender_override)

Expand Down
42 changes: 34 additions & 8 deletions code/modules/admin/verbs/commandreport.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
/// The default command report announcement sound.
#define DEFAULT_ANNOUNCEMENT_SOUND "default_announcement"
#define DEFAULT_COMMANDREPORT_SOUND "default_commandreport"
#define DEFAULT_ALERT_SOUND "default_alert"
#define CUSTOM_ALERT_SOUND "custom_alert"

/// Preset central command names to chose from for centcom reports.
#define CENTCOM_PRESET "Central Command"
Expand Down Expand Up @@ -49,7 +51,7 @@
/// Whether a copy of the report is printed at every console.
var/print_report = TRUE
/// The sound that's going to accompany our message.
var/played_sound = DEFAULT_ANNOUNCEMENT_SOUND
var/played_sound = DEFAULT_COMMANDREPORT_SOUND
/// The colour of the announcement when sent
var/announcement_color = "default"
/// The subheader to include when sending the announcement. Keep blank to not include a subheader
Expand Down Expand Up @@ -91,7 +93,7 @@
/datum/command_report_menu/ui_static_data(mob/user)
var/list/data = list()
data["command_name_presets"] = preset_names
data["announcer_sounds"] = list(DEFAULT_ANNOUNCEMENT_SOUND) + GLOB.announcer_keys
data["announcer_sounds"] = list(DEFAULT_COMMANDREPORT_SOUND, DEFAULT_ALERT_SOUND, CUSTOM_ALERT_SOUND) + GLOB.announcer_keys // Monkestation edit - custom alert sounds
data["announcement_colors"] = ANNOUNCEMENT_COLORS

return data
Expand All @@ -110,7 +112,17 @@

command_name = params["updated_name"]
if("set_report_sound")
played_sound = params["picked_sound"]
// monkestation start
if (params["picked_sound"] == CUSTOM_ALERT_SOUND)
var/soundInput = input(ui_user, "Please pick a sound file to play when you create the command report.", "Pick a Sound File") as null|sound
if (isnull(soundInput))
custom_played_sound = null
else
custom_played_sound = soundInput
played_sound = CUSTOM_ALERT_SOUND
else
played_sound = params["picked_sound"]
//monkestation end
if("toggle_announce")
announce_contents = !announce_contents
if("toggle_printing")
Expand Down Expand Up @@ -146,8 +158,20 @@

/// The sound we're going to play on report.
var/report_sound = played_sound
if(played_sound == DEFAULT_ANNOUNCEMENT_SOUND)
report_sound = SSstation.announcer.get_rand_report_sound()
// monkestation edit start - Custom alert sounds
switch(played_sound)
if (DEFAULT_COMMANDREPORT_SOUND)
report_sound = SSstation.announcer.get_rand_report_sound()
if (DEFAULT_ALERT_SOUND)
report_sound = SSstation.announcer.get_rand_alert_sound()
if (CUSTOM_ALERT_SOUND)
if (!isnull(custom_played_sound))
report_sound = custom_played_sound
else
to_chat(ui_user, span_danger("The custom sound you selected was not able to be played. Aborting..."))
change_command_name(original_command_name)
return
// monkestation end

if(announce_contents)
var/chosen_color = announcement_color
Expand All @@ -156,7 +180,7 @@
chosen_color = "red"
else if(command_name == WIZARD_PRESET)
chosen_color = "purple"
priority_announce(command_report_content, subheader == ""? null : subheader, report_sound, has_important_message = TRUE, color_override = chosen_color)
priority_announce(command_report_content, subheader == ""? null : subheader, report_sound, has_important_message = TRUE, color_override = chosen_color, append_update = append_update_name) //Monkestation edit - togglable "... Update"

if(!announce_contents || print_report)
print_command_report(command_report_content, "[announce_contents ? "" : "Classified "][command_name] Update", !announce_contents)
Expand All @@ -167,7 +191,9 @@
message_admins("[key_name_admin(ui_user)] has created a command report, sent from \"[command_name]\" with the sound \"[played_sound]\"")


#undef DEFAULT_ANNOUNCEMENT_SOUND
#undef DEFAULT_COMMANDREPORT_SOUND
#undef DEFAULT_ALERT_SOUND
#undef CUSTOM_ALERT_SOUND

#undef CENTCOM_PRESET
#undef SYNDICATE_PRESET
Expand Down
18 changes: 18 additions & 0 deletions monkestation/code/modules/admin/verbs/commandreport.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
/datum/command_report_menu
var/append_update_name = TRUE
var/custom_played_sound

/datum/command_report_menu/ui_static_data(mob/user)
. = ..()
.["append_update_name"] = append_update_name

/datum/command_report_menu/ui_data(mob/user)
. = ..()
.["append_update_name"] = append_update_name

/datum/command_report_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
switch(action)
if("toggle_update_append")
append_update_name = !append_update_name

. = ..()
1 change: 1 addition & 0 deletions tgstation.dme
Original file line number Diff line number Diff line change
Expand Up @@ -6255,6 +6255,7 @@
#include "monkestation\code\modules\admin\smites\smite.dm"
#include "monkestation\code\modules\admin\smites\swisscheese.dm"
#include "monkestation\code\modules\admin\smites\where_are_your_fingers.dm"
#include "monkestation\code\modules\admin\verbs\commandreport.dm"
#include "monkestation\code\modules\admin\verbs\getlogs.dm"
#include "monkestation\code\modules\admin\verbs\glowshrooms.dm"
#include "monkestation\code\modules\admin\verbs\kick_player_by_ckey.dm"
Expand Down
16 changes: 14 additions & 2 deletions tgui/packages/tgui/interfaces/CommandReport.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,15 @@ type Data = {
custom_name: string;
played_sound: string;
print_report: string;
append_update_name: boolean;
};

export const CommandReport = () => {
return (
<Window
title="Create Command Report"
width={325}
height={685}
height={715}
theme="admin"
>
<Window.Content>
Expand All @@ -54,7 +55,12 @@ export const CommandReport = () => {
/** Allows the user to set the "sender" of the message via dropdown */
const CentComName = (props) => {
const { act, data } = useBackend<Data>();
const { command_name, command_name_presets = [], custom_name } = data;
const {
command_name,
command_name_presets = [],
custom_name,
append_update_name,
} = data;

return (
<Section title="Set Central Command name" textAlign="center">
Expand All @@ -81,6 +87,12 @@ const CentComName = (props) => {
}
/>
)}
<Button.Checkbox
mt={1}
content='Append "Update" to command name'
checked={append_update_name}
onClick={() => act('toggle_update_append')}
/>
</Section>
);
};
Expand Down
Loading