[PORT] - Ports TG's Chat announcement style (#20914)

* imagine dragons

radioactive

* YOU SHOULD

TGUI YOURSELF

* fuck me

forgot basemap again

* makes it work

hopefullyu

* mom found the TTS drawer

bye

* mom found the achievement drawer

* adds this

it was requested

* fixes all the sounds

and stuff

* moved it

all of it

* bye empty file

dumbass

* bring it BACK

we're so back

* we're so back

yeah

* its done

actually makes it work fuck me thhank you baiomu
This commit is contained in:
cowbot92
2023-11-26 18:47:39 -05:00
committed by GitHub
parent 50b671f652
commit c9f9223043
25 changed files with 2985 additions and 133 deletions

View File

@@ -0,0 +1,7 @@
// Priority-type announcement messages for `priority_announcement()`
/// Prefix this announcement with "Priority Announcement"
#define ANNOUNCEMENT_TYPE_PRIORITY "Priority"
/// Make it sound like it's coming from the Captain
#define ANNOUNCEMENT_TYPE_CAPTAIN "Captain"
/// Make it sound like it's coming from the Syndicate
#define ANNOUNCEMENT_TYPE_SYNDICATE "Syndicate"

View File

@@ -87,3 +87,12 @@
///Check for arena shuttle, if the bubblegum has died this round
GLOBAL_VAR_INIT(bubblegum_dead, FALSE)
// Alert level related for new thing im porting --- cowbot93
#define ALERT_COEFF_AUTOEVAC_NORMAL 6
#define ALERT_COEFF_GREEN 5
#define ALERT_COEFF_BLUE 4
#define ALERT_COEFF_RED 3
#define ALERT_COEFF_AUTOEVAC_CRITICAL 2
#define ALERT_COEFF_DELTA 1
#define ALERT_COEFF_GAMMA 0
#define ALERT_COEFF_EPSILON -1

View File

@@ -117,3 +117,23 @@
#define ANNOUNCER_SHUTTLEDOCK "announcer_shuttledock"
#define ANNOUNCER_SHUTTLERECALLED "announcer_shuttlerecalled"
#define ANNOUNCER_SPANOMALIES "announcer_spanomalies"
/// Global list of all of our announcer keys.
GLOBAL_LIST_INIT(announcer_keys, list(
ANNOUNCER_AIMALF,
ANNOUNCER_ALIENS,
ANNOUNCER_ANIMES,
ANNOUNCER_GRANOMALIES,
ANNOUNCER_INTERCEPT,
ANNOUNCER_IONSTORM,
ANNOUNCER_METEORS,
ANNOUNCER_OUTBREAK5,
ANNOUNCER_OUTBREAK7,
ANNOUNCER_POWEROFF,
ANNOUNCER_POWERON,
ANNOUNCER_RADIATION,
ANNOUNCER_SHUTTLECALLED,
ANNOUNCER_SHUTTLEDOCK,
ANNOUNCER_SHUTTLERECALLED,
ANNOUNCER_SPANOMALIES,
))

View File

@@ -1,106 +1,206 @@
#define RANDOM_REPORT_SOUND "random_report_sound"
// please don't use these defines outside of this file in order to ensure a unified framework. unless you have a really good reason to make them global, then whatever
/proc/priority_announce(text, title = "", sound, type, sender_override, has_important_message, sanitize = TRUE)
// these four are just text spans that furnish the TEXT itself with the appropriate CSS classes
#define MAJOR_ANNOUNCEMENT_TITLE(string) ("<span class='major_announcement_title'>" + string + "</span>")
#define SUBHEADER_ANNOUNCEMENT_TITLE(string) ("<span class='subheader_announcement_text'>" + string + "</span>")
#define MAJOR_ANNOUNCEMENT_TEXT(string) ("<span class='major_announcement_text'>" + string + "</span>")
#define MINOR_ANNOUNCEMENT_TITLE(string) ("<span class='minor_announcement_title'>" + string + "</span>")
#define MINOR_ANNOUNCEMENT_TEXT(string) ("<span class='minor_announcement_text'>" + string + "</span>")
#define ANNOUNCEMENT_HEADER(string) ("<span class='announcement_header'>" + string + "</span>")
// these two are the ones that actually give the striped background
#define CHAT_ALERT_DEFAULT_SPAN(string) ("<div class='chat_alert_default'>" + string + "</div>")
#define CHAT_ALERT_COLORED_SPAN(color, string) ("<div class='chat_alert_" + color + "'>" + string + "</div>")
#define ANNOUNCEMENT_COLORS list("default", "green", "blue", "pink", "yellow", "orange", "red", "purple")
/**
* Make a big red text announcement to
*
* Formatted like:
*
* " Message from sender "
*
* " Title "
*
* " Text "
*
* Arguments
* * text - required, the text to announce
* * title - optional, the title of the announcement.
* * sound - optional, the sound played accompanying the announcement
* * type - optional, the type of the announcement, for some "preset" announcement templates. See __DEFINES/announcements.dm
* * sender_override - optional, modifies the sender of the announcement
* * has_important_message - is this message critical to the game (and should not be overridden by station traits), or not
* * players - a list of all players to send the message to. defaults to all players (not including new players)
* * 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)
if(!text)
return
var/announcement
var/default_sound
if(encode_title && title && length(title) > 0)
title = html_encode(title)
if(encode_text)
text = html_encode(text)
if(!length(text))
return
var/list/announcement_strings = list()
if(!sound)
sound = SSstation.announcer.get_rand_alert_sound()
default_sound = SSstation.default_announcer.get_rand_alert_sound()
else if(SSstation.announcer.event_sounds[sound])
sound = SSstation.announcer.event_sounds[sound]
if(SSstation.default_announcer.event_sounds[sound])
default_sound = SSstation.default_announcer.event_sounds[sound]
if(sound == RANDOM_REPORT_SOUND)
sound = SSstation.announcer.get_rand_report_sound()
default_sound = SSstation.default_announcer.get_rand_report_sound()
if(type == "Priority")
announcement += "<h1 class='alert'>Priority Announcement</h1>"
if (title && length(title) > 0)
announcement += "<br><h2 class='alert'>[sanitize ? html_encode(title) : title]</h2>"
else if(type == "Captain")
announcement += "<h1 class='alert'>Captain Announces</h1>"
GLOB.news_network.SubmitArticle(text, "Captain's Announcement", "Station Announcements", null)
else
if(!sender_override)
announcement += "<h1 class='alert'>[command_name()] Update</h1>"
var/header
switch(type)
if(ANNOUNCEMENT_TYPE_PRIORITY)
header = MAJOR_ANNOUNCEMENT_TITLE("Priority Announcement")
if(length(title) > 0)
header += SUBHEADER_ANNOUNCEMENT_TITLE(title)
if(ANNOUNCEMENT_TYPE_CAPTAIN)
header = MAJOR_ANNOUNCEMENT_TITLE("Captain's Announcement")
GLOB.news_network.SubmitArticle(text, "Captain's Announcement", "Station Announcements", null)
if(ANNOUNCEMENT_TYPE_SYNDICATE)
header = MAJOR_ANNOUNCEMENT_TITLE("Syndicate Captain's Announcement")
else
announcement += "<h1 class='alert'>[sender_override]</h1>"
if (title && length(title) > 0)
announcement += "<br><h2 class='alert'>[sanitize ? html_encode(title) : title]</h2>"
header += generate_unique_announcement_header(title, sender_override)
if(!sender_override)
if(title == "")
GLOB.news_network.SubmitArticle(text, "Central Command Update", "Station Announcements", null)
else
GLOB.news_network.SubmitArticle(title + "<br><br>" + text, "Central Command", "Station Announcements", null)
announcement_strings += ANNOUNCEMENT_HEADER(header)
///If the announcer overrides alert messages, use that message.
if(SSstation.announcer.custom_alert_message && !has_important_message)
announcement += SSstation.announcer.custom_alert_message
announcement_strings += MAJOR_ANNOUNCEMENT_TEXT(SSstation.announcer.custom_alert_message)
else
announcement += "<br>[span_alert("[sanitize ? html_encode(text) : text]")]<br>"
announcement += "<br>"
announcement_strings += MAJOR_ANNOUNCEMENT_TEXT(text)
var/s = sound(sound)
var/default_s = s
if(!istype(SSstation.announcer, /datum/centcom_announcer/default))
default_s = sound(default_sound)
for(var/mob/M in GLOB.player_list)
if(!isnewplayer(M) && M.can_hear())
if(isliving(M) && M.stat != DEAD)
var/mob/living/L = M
if(!L.IsUnconscious())
to_chat(L, announcement)
else
to_chat(M, announcement)
if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS)
if(M.client.prefs.read_preference(/datum/preference/toggle/disable_alternative_announcers))
SEND_SOUND(M, default_s)
else
SEND_SOUND(M, s)
var/finalized_announcement
if(color_override)
finalized_announcement = CHAT_ALERT_COLORED_SPAN(color_override, jointext(announcement_strings, ""))
else
finalized_announcement = CHAT_ALERT_DEFAULT_SPAN(jointext(announcement_strings, ""))
dispatch_announcement_to_players(finalized_announcement, players, sound)
if(isnull(sender_override) && players == GLOB.player_list)
if(length(title) > 0)
GLOB.news_network.SubmitArticle(title + "<br><br>" + text, "[command_name()]", "Station Announcements", null)
else
GLOB.news_network.SubmitArticle(text, "[command_name()] Update", "Station Announcements", null)
/proc/print_command_report(text = "", title = null, announce=TRUE)
if(!title)
title = "Classified [command_name()] Update"
if(announce)
priority_announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", RANDOM_REPORT_SOUND, has_important_message = TRUE)
priority_announce(
text = "A report has been downloaded and printed out at all communications consoles.",
title = "Incoming Classified Message",
sound = SSstation.announcer.get_rand_report_sound(),
has_important_message = TRUE,
)
var/datum/comm_message/M = new
M.title = title
M.content = text
var/datum/comm_message/message = new
message.title = title
message.content = text
SScommunications.send_message(M)
SScommunications.send_message(message)
/proc/minor_announce(message, title = "Attention:", alert, custom_alert_sound)
/**
* Sends a minor annoucement to players.
* Minor announcements are large text, with the title in red and message in white.
* Only mobs that can hear can see the announcements.
*
* message - the message contents of the announcement.
* title - the title of the announcement, which is often "who sent it".
* alert - whether this announcement is an alert, or just a notice. Only changes the sound that is played by default.
* html_encode - if TRUE, we will html encode our title and message before sending it, to prevent player input abuse.
* players - optional, a list mobs to send the announcement to. If unset, sends to all palyers.
* sound_override - optional, use the passed sound file instead of the default notice sounds.
* should_play_sound - Whether the notice sound should be played or not.
* color_override - optional, use the passed color instead of the default notice color.
*/
/proc/minor_announce(message, title = "Attention:", alert = FALSE, html_encode = TRUE, list/players, sound_override, should_play_sound = TRUE, color_override)
if(!message)
return
for(var/mob/M in GLOB.player_list)
if(!isnewplayer(M) && M.can_hear())
if(isliving(M) && M.stat != DEAD)
var/mob/living/L = M
if(!L.IsUnconscious())
to_chat(L, "<span class='big bold'><font color = red>[html_encode(title)]</font color><BR>[html_encode(message)]</span><BR>")
else
to_chat(M, "<span class='big bold'><font color = red>[html_encode(title)]</font color><BR>[html_encode(message)]</span><BR>")
if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS)
var/s = sound(custom_alert_sound)
if(custom_alert_sound)
SEND_SOUND(M, s)
else
if(alert)
SEND_SOUND(M, sound('sound/misc/notice1.ogg'))
else
SEND_SOUND(M, sound('sound/misc/notice2.ogg'))
if (html_encode)
title = html_encode(title)
message = html_encode(message)
var/list/minor_announcement_strings = list()
if(title != null && title != "")
minor_announcement_strings += ANNOUNCEMENT_HEADER(MINOR_ANNOUNCEMENT_TITLE(title))
minor_announcement_strings += MINOR_ANNOUNCEMENT_TEXT(message)
var/finalized_announcement
if(color_override)
finalized_announcement = CHAT_ALERT_COLORED_SPAN(color_override, jointext(minor_announcement_strings, ""))
else
finalized_announcement = CHAT_ALERT_DEFAULT_SPAN(jointext(minor_announcement_strings, ""))
var/custom_sound = sound_override || (alert ? 'sound/misc/notice1.ogg' : 'sound/misc/notice2.ogg')
dispatch_announcement_to_players(finalized_announcement, players, custom_sound, should_play_sound)
/// Sends an announcement about the level changing to players. Uses the passed in datum and the subsystem's previous security level to generate the message.
/proc/level_announce(datum/security_level/selected_level, previous_level_number)
var/current_level_number = selected_level.number_level
var/current_level_name = selected_level.name
var/current_level_color = selected_level.announcement_color
var/current_level_sound = selected_level.sound
var/title
var/message
if(current_level_number > previous_level_number)
title = "Attention! Security level elevated to [current_level_name]:"
message = selected_level.elevating_to_announcement
else
title = "Attention! Security level lowered to [current_level_name]:"
message = selected_level.lowering_to_announcement
var/list/level_announcement_strings = list()
level_announcement_strings += ANNOUNCEMENT_HEADER(MINOR_ANNOUNCEMENT_TITLE(title))
level_announcement_strings += MINOR_ANNOUNCEMENT_TEXT(message)
var/finalized_announcement = CHAT_ALERT_COLORED_SPAN(current_level_color, jointext(level_announcement_strings, ""))
dispatch_announcement_to_players(finalized_announcement, GLOB.player_list, current_level_sound)
/// 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)
var/list/returnable_strings = list()
if(isnull(sender_override))
returnable_strings += MAJOR_ANNOUNCEMENT_TITLE("[command_name()] Update")
else
returnable_strings += MAJOR_ANNOUNCEMENT_TITLE(sender_override)
if(length(title) > 0)
returnable_strings += SUBHEADER_ANNOUNCEMENT_TITLE(title)
return jointext(returnable_strings, "")
/// Proc that just dispatches the announcement to our applicable audience. Only the announcement is a mandatory arg.
/proc/dispatch_announcement_to_players(announcement, list/players = GLOB.player_list, sound_override = null, should_play_sound = TRUE)
var/sound_to_play = !isnull(sound_override) ? sound_override : 'sound/misc/notice2.ogg'
for(var/mob/target in players)
if(isnewplayer(target) || !target.can_hear())
continue
to_chat(target, announcement)
if(!should_play_sound)
continue
SEND_SOUND(target, sound(sound_to_play))
#undef MAJOR_ANNOUNCEMENT_TITLE
#undef MAJOR_ANNOUNCEMENT_TEXT
#undef MINOR_ANNOUNCEMENT_TITLE
#undef MINOR_ANNOUNCEMENT_TEXT
#undef CHAT_ALERT_DEFAULT_SPAN
#undef CHAT_ALERT_COLORED_SPAN

View File

@@ -12,12 +12,12 @@
var/custom_alert_message
/datum/centcom_announcer/proc/get_rand_welcome_sound()
return pick(welcome_sounds)
/datum/centcom_announcer/proc/get_rand_alert_sound()
return pick(alert_sounds)
/datum/centcom_announcer/proc/get_rand_report_sound()
return pick(command_report_sounds)
return pick(command_report_sounds)

View File

@@ -32,4 +32,4 @@
. += greenshift_message
print_command_report(., "Central Command Status Summary", announce = FALSE)
priority_announce(greenshift_message, "Security Report", RANDOM_REPORT_SOUND)
priority_announce(greenshift_message, "Security Report", SSstation.announcer.get_rand_report_sound())

View File

@@ -252,7 +252,7 @@
nuke_request(reason, usr)
to_chat(usr, span_notice("Request sent."))
usr.log_message("has requested the nuclear codes from CentCom with reason \"[reason]\"", LOG_SAY)
priority_announce("The codes for the on-station nuclear self-destruct have been requested by [authorize_name]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self-Destruct Codes Requested", RANDOM_REPORT_SOUND)
priority_announce("The codes for the on-station nuclear self-destruct have been requested by [authorize_name]. Confirmation or denial of this request will be sent shortly.", "Nuclear Self-Destruct Codes Requested", SSstation.announcer.get_rand_report_sound())
playsound(src, 'sound/machines/terminal_prompt.ogg', 50, FALSE)
COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN)
if ("restoreBackupRoutingData")
@@ -364,7 +364,7 @@
playsound(loc, 'sound/items/poster_being_created.ogg', 100, 1)
new /obj/item/card/id/captains_spare/temporary(loc)
COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN)
priority_announce("The emergency spare ID has been printed by [authorize_name].", "Emergency Spare ID Warning System", RANDOM_REPORT_SOUND)
priority_announce("The emergency spare ID has been printed by [authorize_name].", "Emergency Spare ID Warning System", SSstation.announcer.get_rand_report_sound())
if("printAIControlCode")
if(authenticated_as_non_silicon_head(usr))
if(!COOLDOWN_FINISHED(src, important_action_cooldown))
@@ -373,7 +373,7 @@
GLOB.ai_control_code = random_nukecode(6)
new /obj/item/paper/ai_control_code(loc)
COOLDOWN_START(src, important_action_cooldown, IMPORTANT_ACTION_COOLDOWN)
priority_announce("The AI Control Code been printed by [authorize_name]. All previous codes have been invalidated.", "Central Tech Support", RANDOM_REPORT_SOUND)
priority_announce("The AI Control Code been printed by [authorize_name]. All previous codes have been invalidated.", "Central Tech Support", SSstation.announcer.get_rand_report_sound())
/obj/machinery/computer/communications/ui_data(mob/user)

View File

@@ -470,7 +470,7 @@
if(is_station_level(W.z) && !istype(get_area(W), /area/bridge) && !istype(get_area(W), /area/crew_quarters) && !istype(get_area(W), /area/security/prison))
W.req_access = list()
message_admins("[key_name_admin(mob_user)] activated Egalitarian Station mode (All doors are open access)")
priority_announce("CentCom airlock control override activated. Please take this time to get acquainted with your coworkers.", null, RANDOM_REPORT_SOUND)
priority_announce("CentCom airlock control override activated. Please take this time to get acquainted with your coworkers.", null, SSstation.announcer.get_rand_report_sound())
if("ancap")
if(!check_rights_for(rights, R_FUN))
@@ -479,9 +479,9 @@
SSeconomy.full_ancap = !SSeconomy.full_ancap
message_admins("[key_name_admin(mob_user)] toggled Anarcho-capitalist mode")
if(SSeconomy.full_ancap)
priority_announce("The NAP is now in full effect.", null, RANDOM_REPORT_SOUND)
priority_announce("The NAP is now in full effect.", null, SSstation.announcer.get_rand_report_sound())
else
priority_announce("The NAP has been revoked.", null, RANDOM_REPORT_SOUND)
priority_announce("The NAP has been revoked.", null, SSstation.announcer.get_rand_report_sound())
if("dorf")
if(!check_rights_for(rights, R_FUN))

View File

@@ -0,0 +1,175 @@
/// The default command report announcement sound.
#define DEFAULT_ANNOUNCEMENT_SOUND "default_announcement"
/// Preset central command names to chose from for centcom reports.
#define CENTCOM_PRESET "Central Command"
#define SYNDICATE_PRESET "The Syndicate"
#define WIZARD_PRESET "The Wizard Federation"
#define CUSTOM_PRESET "Custom Command Name"
/// Verb to change the global command name.
/client/proc/cmd_change_command_name()
set category = "Admin.Round Interaction"
set name = "Change Command Name"
if(!check_rights(R_ADMIN))
return
var/input = input(usr, "Please input a new name for Central Command.", "What?", "") as text|null
if(!input)
return
change_command_name(input)
message_admins("[key_name_admin(src)] has changed Central Command's name to [input]")
log_admin("[key_name(src)] has changed the Central Command name to: [input]")
/// Verb to open the create command report window and send command reports.
/client/proc/cmd_admin_create_centcom_report()
set category = "Admin.Round Interaction"
set name = "Create Command Report"
if(!check_rights(R_ADMIN))
return
SSblackbox.record_feedback("tally", "admin_verb", 1, "Create Command Report") // If you are copy-pasting this, ensure the 4th parameter is unique to the new proc!
var/datum/command_report_menu/tgui = new(usr)
tgui.ui_interact(usr)
/// Datum for holding the TGUI window for command reports.
/datum/command_report_menu
/// The mob using the UI.
var/mob/ui_user
/// The name of central command that will accompany our report
var/command_name = CENTCOM_PRESET
/// Whether we are using a custom name instead of a preset.
var/custom_name
/// The actual contents of the report we're going to send.
var/command_report_content
/// Whether the report's contents are announced.
var/announce_contents = TRUE
/// 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
/// 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
var/subheader = ""
/// A static list of preset names that can be chosen.
var/list/preset_names = list(CENTCOM_PRESET, SYNDICATE_PRESET, WIZARD_PRESET, CUSTOM_PRESET)
/datum/command_report_menu/New(mob/user)
ui_user = user
if(command_name() != CENTCOM_PRESET)
command_name = command_name()
preset_names.Insert(1, command_name())
/datum/command_report_menu/ui_state(mob/user)
return GLOB.admin_state
/datum/command_report_menu/ui_close()
qdel(src)
/datum/command_report_menu/ui_interact(mob/user, datum/tgui/ui)
ui = SStgui.try_update_ui(user, src, ui)
if(!ui)
ui = new(user, src, "CommandReport")
ui.open()
/datum/command_report_menu/ui_data(mob/user)
var/list/data = list()
data["command_name"] = command_name
data["custom_name"] = custom_name
data["command_report_content"] = command_report_content
data["announce_contents"] = announce_contents
data["print_report"] = print_report
data["played_sound"] = played_sound
data["announcement_color"] = announcement_color
data["subheader"] = subheader
return data
/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["announcement_colors"] = ANNOUNCEMENT_COLORS
return data
/datum/command_report_menu/ui_act(action, list/params, datum/tgui/ui, datum/ui_state/state)
. = ..()
if(.)
return
switch(action)
if("update_command_name")
if(params["updated_name"] == CUSTOM_PRESET)
custom_name = TRUE
else if (params["updated_name"] in preset_names)
custom_name = FALSE
command_name = params["updated_name"]
if("set_report_sound")
played_sound = params["picked_sound"]
if("toggle_announce")
announce_contents = !announce_contents
if("toggle_printing")
print_report = !print_report
if("update_announcement_color")
var/colors = ANNOUNCEMENT_COLORS
var/chosen_color = params["updated_announcement_color"]
if(chosen_color in colors)
announcement_color = chosen_color
if("set_subheader")
subheader = params["new_subheader"]
if("submit_report")
if(!command_name)
to_chat(ui_user, span_danger("You can't send a report with no command name."))
return
if(!params["report"])
to_chat(ui_user, span_danger("You can't send a report with no contents."))
return
command_report_content = params["report"]
send_announcement()
return TRUE
/*
* The actual proc that sends the priority announcement and reports
*
* Uses the variables set by the user on our datum as the arguments for the report.
*/
/datum/command_report_menu/proc/send_announcement()
/// Our current command name to swap back to after sending the report.
var/original_command_name = command_name()
change_command_name(command_name)
/// 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()
if(announce_contents)
var/chosen_color = announcement_color
if(chosen_color == "default")
if(command_name == SYNDICATE_PRESET)
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)
if(!announce_contents || print_report)
print_command_report(command_report_content, "[announce_contents ? "" : "Classified "][command_name] Update", !announce_contents)
change_command_name(original_command_name)
log_admin("[key_name(ui_user)] has created a command report: \"[command_report_content]\", sent from \"[command_name]\" with the sound \"[played_sound]\".")
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 CENTCOM_PRESET
#undef SYNDICATE_PRESET
#undef WIZARD_PRESET
#undef CUSTOM_PRESET

View File

@@ -617,47 +617,6 @@ Traitors and the like can also be revived with the previous role mostly intact.
L?.mind?.name = newname
SSblackbox.record_feedback("tally", "admin_verb", 1, "Offer Mob Rename") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc
/client/proc/cmd_admin_create_centcom_report()
set category = "Admin.Round Interaction"
set name = "Create Command Report"
if(!check_rights(R_ADMIN))
return
var/input = input(usr, "Enter a Command Report. Ensure it makes sense IC.", "What?", "") as message|null
if(!input)
return
var/confirm = alert(src, "Do you want to announce the contents of the report to the crew?", "Announce", "Yes", "No", "Cancel")
var/announce_command_report = TRUE
var/senderOverride = input(src, "Please input the sender of the report", "Sender", "[command_name()] Update")
switch(confirm)
if("Yes")
priority_announce(input, null, RANDOM_REPORT_SOUND, sender_override = senderOverride, sanitize = FALSE)
announce_command_report = FALSE
if("Cancel")
return
print_command_report(input, "[announce_command_report ? "Classified " : ""][senderOverride]", announce_command_report)
log_admin("[key_name(src)] has created a command report: [input]")
message_admins("[key_name_admin(src)] has created a command report")
SSblackbox.record_feedback("tally", "admin_verb", 1, "Create Command Report") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/client/proc/cmd_change_command_name()
set category = "Admin.Round Interaction"
set name = "Change Command Name"
if(!check_rights(R_ADMIN))
return
var/input = input(usr, "Please input a new name for Central Command.", "What?", "") as text|null
if(!input)
return
change_command_name(input)
message_admins("[key_name_admin(src)] has changed Central Command's name to [input]")
log_admin("[key_name(src)] has changed the Central Command name to: [input]")
/client/proc/cmd_admin_delete(atom/A as obj|mob|turf in world)
set category = "Misc.Unused"
set name = "Delete"

View File

@@ -33,7 +33,7 @@
beacon = new(ship_name)
/datum/round_event/pirates/announce(fake)
priority_announce("Incoming subspace communication. Secure channel opened at all communication consoles.", "Incoming Message", RANDOM_REPORT_SOUND)
priority_announce("Incoming subspace communication. Secure channel opened at all communication consoles.", "Incoming Message", SSstation.announcer.get_rand_report_sound())
play_intro_music()
if(fake)
return

View File

@@ -12,7 +12,7 @@
var/report_message = "Complete this goal."
/datum/station_goal/proc/send_report()
priority_announce("Priority Nanotrasen directive received. Project \"[name]\" details inbound.", "Incoming Priority Message", RANDOM_REPORT_SOUND)
priority_announce("Priority Nanotrasen directive received. Project \"[name]\" details inbound.", "Incoming Priority Message", SSstation.announcer.get_rand_report_sound())
print_command_report(get_report(),"Nanotrasen Directive [pick(GLOB.phonetic_alphabet)] \Roman[rand(1,50)]", announce=FALSE)
on_report()

View File

@@ -320,7 +320,7 @@ GLOBAL_VAR_INIT(ai_control_code, random_nukecode(6))
one_time_password_used = TRUE
var/msg = "<h4>Warning!</h4><br>We have detected usage of the AI Control Code for unlocking a console at coordinates ([src.x], [src.y], [src.z]) by [usr.name]. Please verify that this is correct. Be aware we have cancelled the current control code.<br>\
If needed a new code can be printed at a communications console."
priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE, sanitize = FALSE)
priority_announce(msg, sender_override = "Central Cyber Security Update", has_important_message = TRUE)
GLOB.ai_control_code = null
else
to_chat(usr, span_warning("Incorrect code. Make sure you have the latest one."))

View File

@@ -0,0 +1,121 @@
/**
* Security levels
*
* These are used by the security level subsystem. Each one of these represents a security level that a player can set.
*
* Base type is abstract
*/
/datum/security_level
/// The name of this security level.
var/name = "not set"
/// The color of our announcement divider.
var/announcement_color = "default"
/// The numerical level of this security level, see defines for more information.
var/number_level = -1
/// The sound that we will play when this security level is set
var/sound
/// The looping sound that will be played while the security level is set
var/looping_sound
/// The looping sound interval
var/looping_sound_interval
/// The shuttle call time modification of this security level
var/shuttle_call_time_mod = 0
/// Our announcement when lowering to this level
var/lowering_to_announcement
/// Our announcement when elevating to this level
var/elevating_to_announcement
/// Our configuration key for lowering to text, if set, will override the default lowering to announcement.
var/lowering_to_configuration_key
/// Our configuration key for elevating to text, if set, will override the default elevating to announcement.
var/elevating_to_configuration_key
/datum/security_level/New()
. = ..()
if(lowering_to_configuration_key) // I'm not sure about you, but isn't there an easier way to do this?
lowering_to_announcement = global.config.Get(lowering_to_configuration_key)
if(elevating_to_configuration_key)
elevating_to_announcement = global.config.Get(elevating_to_configuration_key)
/**
* GREEN
*
* No threats
*/
/datum/security_level/green
name = "green"
announcement_color = "green"
sound = 'sound/misc/notice2.ogg' // Friendly beep
number_level = SEC_LEVEL_GREEN
lowering_to_configuration_key = /datum/config_entry/string/alert_green
shuttle_call_time_mod = ALERT_COEFF_GREEN
/**
* BLUE
*
* Caution advised
*/
/datum/security_level/blue
name = "blue"
announcement_color = "blue"
sound = 'sound/misc/notice1.ogg' // Angry alarm
number_level = SEC_LEVEL_BLUE
lowering_to_configuration_key = /datum/config_entry/string/alert_blue_downto
elevating_to_configuration_key = /datum/config_entry/string/alert_blue_upto
shuttle_call_time_mod = ALERT_COEFF_BLUE
/**
* RED
*
* Hostile threats
*/
/datum/security_level/red
name = "red"
announcement_color = "red"
sound = 'sound/misc/notice4.ogg' // More angry alarm
number_level = SEC_LEVEL_RED
lowering_to_configuration_key = /datum/config_entry/string/alert_red_downto
elevating_to_configuration_key = /datum/config_entry/string/alert_red_upto
shuttle_call_time_mod = ALERT_COEFF_RED
/**
* DELTA
*
* Station destruction is imminent
*/
/datum/security_level/delta
name = "delta"
announcement_color = "purple"
sound = 'sound/misc/delta_alert.ogg' // Air alarm to signify importance
number_level = SEC_LEVEL_DELTA
elevating_to_configuration_key = /datum/config_entry/string/alert_delta
shuttle_call_time_mod = ALERT_COEFF_DELTA
/**
* GAMMA
*
* Station is not having a very good fun time
*/
/datum/security_level/gamma
name = "gamma"
announcement_color = "orange"
sound = 'sound/misc/gamma_alert.ogg'// Air alarm to signify importance
number_level = SEC_LEVEL_GAMMA
elevating_to_configuration_key = /datum/config_entry/string/alert_gamma
shuttle_call_time_mod = ALERT_COEFF_GAMMA
/**
* EPSILON
*
* Station destruction is here, and you probably caused it, you monster.
*/
/datum/security_level/epsilon
name = "epsilon"
announcement_color = "black"
sound = 'sound/misc/epsilon_alert.ogg'// Air alarm to signify importance
number_level = SEC_LEVEL_EPSILON
elevating_to_configuration_key = /datum/config_entry/string/alert_epsilon
shuttle_call_time_mod = ALERT_COEFF_EPSILON

View File

@@ -38,6 +38,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
switch(level)
if(SEC_LEVEL_GREEN)
minor_announce(CONFIG_GET(string/alert_green), "Attention! Security level lowered to green:")
sound_to_playing_players('sound/misc/notice2.ogg')
if(GLOB.security_level >= SEC_LEVEL_RED)
modTimer = 4
else
@@ -46,6 +47,7 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
if(SEC_LEVEL_BLUE)
if(GLOB.security_level < SEC_LEVEL_BLUE)
minor_announce(CONFIG_GET(string/alert_blue_upto), "Attention! Security level elevated to blue:", TRUE)
sound_to_playing_players('sound/misc/notice1.ogg')
modTimer = 0.5
else
minor_announce(CONFIG_GET(string/alert_blue_downto), "Attention! Security level lowered to blue:")
@@ -53,7 +55,8 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
if(SEC_LEVEL_RED)
if(GLOB.security_level < SEC_LEVEL_RED)
minor_announce(CONFIG_GET(string/alert_red_upto), "Attention! Code red!", TRUE, custom_alert_sound = 'sound/misc/notice4.ogg')
minor_announce(CONFIG_GET(string/alert_red_upto), "Attention! Code red!", TRUE)
sound_to_playing_players('sound/misc/notice4.ogg')
if(GLOB.security_level == SEC_LEVEL_GREEN)
modTimer = 0.25
else
@@ -81,7 +84,8 @@ GLOBAL_VAR_INIT(security_level, SEC_LEVEL_GREEN)
modTimer = 1
if(SEC_LEVEL_DELTA)
minor_announce(CONFIG_GET(string/alert_delta), "Attention! Delta security level reached!", TRUE, 'sound/misc/delta_alert.ogg')
minor_announce(CONFIG_GET(string/alert_delta), "Attention! Delta security level reached!", TRUE)
sound_to_playing_players('sound/misc/delta_alert.ogg')
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
if(GLOB.security_level == SEC_LEVEL_GREEN)
modTimer = 0.25

View File

@@ -452,7 +452,8 @@
destination_dock = "emergency_syndicate"
minor_announce("Corruption detected in \
shuttle navigation protocols. Please contact your \
supervisor.", "SYSTEM ERROR:", alert=TRUE, custom_alert_sound = 'sound/misc/announce2.ogg')
supervisor.", "SYSTEM ERROR:", alert=TRUE)
sound_to_playing_players('sound/misc/announce2.ogg')
dock_id(destination_dock)
mode = SHUTTLE_ENDGAME

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@@ -58,3 +58,6 @@
// Goonchat styles
@include meta.load-css('./goon/chat-dark.scss');
// tgchat styles
@include meta.load-css('./tgchat/chat-dark.scss');

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,195 @@
import { useBackend, useLocalState } from '../backend';
import { Box, Button, Dropdown, Input, Section, Stack, TextArea } from '../components';
import { Window } from '../layouts';
type Data = {
announce_contents: string;
announcer_sounds: string[];
command_name: string;
command_name_presets: string[];
command_report_content: string;
announcement_color: string;
announcement_colors: string[];
subheader: string;
custom_name: string;
played_sound: string;
print_report: string;
};
export const CommandReport = () => {
return (
<Window
title="Create Command Report"
width={325}
height={685}
theme="admin">
<Window.Content>
<Stack fill vertical>
<Stack.Item>
<CentComName />
<AnnouncementColor />
<AnnouncementSound />
</Stack.Item>
<Stack.Item>
<SubHeader />
</Stack.Item>
<Stack.Item>
<ReportText />
</Stack.Item>
</Stack>
</Window.Content>
</Window>
);
};
/** Allows the user to set the "sender" of the message via dropdown */
const CentComName = (props, context) => {
const { act, data } = useBackend<Data>(context);
const { command_name, command_name_presets = [], custom_name } = data;
return (
<Section title="Set Central Command name" textAlign="center">
<Dropdown
width="100%"
selected={command_name}
options={command_name_presets}
onSelected={(value) =>
act('update_command_name', {
updated_name: value,
})
}
/>
{!!custom_name && (
<Input
width="100%"
mt={1}
value={command_name}
placeholder={command_name}
onChange={(_, value) =>
act('update_command_name', {
updated_name: value,
})
}
/>
)}
</Section>
);
};
/** Allows the user to set the "sender" of the message via dropdown */
const SubHeader = (props, context) => {
const { act, data } = useBackend<Data>(context);
const { subheader } = data;
return (
<Section title="Set report subheader" textAlign="center">
<Box>Keep blank to not include a subheader</Box>
<Input
width="100%"
mt={1}
value={subheader}
placeholder={subheader}
onChange={(_, value) =>
act('set_subheader', {
new_subheader: value,
})
}
/>
</Section>
);
};
/** Features a section with dropdown for the announcement colour. */
const AnnouncementColor = (props, context) => {
const { act, data } = useBackend<Data>(context);
const { announcement_colors = [], announcement_color } = data;
return (
<Section title="Set announcement color" textAlign="center">
<Dropdown
width="100%"
displayText={announcement_color}
options={announcement_colors}
onSelected={(value) =>
act('update_announcement_color', {
updated_announcement_color: value,
})
}
/>
</Section>
);
};
/** Features a section with dropdown for sounds. */
const AnnouncementSound = (props, context) => {
const { act, data } = useBackend<Data>(context);
const { announcer_sounds = [], played_sound } = data;
return (
<Section title="Set announcement sound" textAlign="center">
<Dropdown
width="100%"
displayText={played_sound}
options={announcer_sounds}
onSelected={(value) =>
act('set_report_sound', {
picked_sound: value,
})
}
/>
</Section>
);
};
/** Creates the report textarea with a submit button. */
const ReportText = (props, context) => {
const { act, data } = useBackend<Data>(context);
const { announce_contents, print_report, command_report_content } = data;
const [commandReport, setCommandReport] = useLocalState<string>(
context,
'textArea',
command_report_content
);
return (
<Section title="Set report text" textAlign="center">
<TextArea
height="200px"
mb={1}
onInput={(_, value) => setCommandReport(value)}
value={commandReport}
/>
<Stack vertical>
<Stack.Item>
<Button.Checkbox
fluid
checked={announce_contents}
onClick={() => act('toggle_announce')}>
Announce Contents
</Button.Checkbox>
<Button.Checkbox
fluid
checked={print_report || !announce_contents}
disabled={!announce_contents}
onClick={() => act('toggle_printing')}
tooltip={
!announce_contents &&
"Printing the report is required since we aren't announcing its contents."
}
tooltipPosition="top">
Print Report
</Button.Checkbox>
</Stack.Item>
<Stack.Item>
<Button.Confirm
fluid
icon="check"
textAlign="center"
content="Submit Report"
onClick={() => act('submit_report', { report: commandReport })}
/>
</Stack.Item>
</Stack>
</Section>
);
};

View File

@@ -28,6 +28,7 @@
#include "code\__DEFINES\actions.dm"
#include "code\__DEFINES\admin.dm"
#include "code\__DEFINES\ai.dm"
#include "code\__DEFINES\announcements.dm"
#include "code\__DEFINES\anomalies.dm"
#include "code\__DEFINES\antagonists.dm"
#include "code\__DEFINES\art.dm"
@@ -1567,6 +1568,7 @@
#include "code\modules\admin\verbs\borgpanel.dm"
#include "code\modules\admin\verbs\BrokenInhands.dm"
#include "code\modules\admin\verbs\cinematic.dm"
#include "code\modules\admin\verbs\commandreport.dm"
#include "code\modules\admin\verbs\deadsay.dm"
#include "code\modules\admin\verbs\debug.dm"
#include "code\modules\admin\verbs\diagnostics.dm"
@@ -3507,6 +3509,7 @@
#include "code\modules\ruins\spaceruin_code\whiteshipruin_box.dm"
#include "code\modules\security_levels\keycard_authentication.dm"
#include "code\modules\security_levels\level_interface.dm"
#include "code\modules\security_levels\security_level_datums.dm"
#include "code\modules\security_levels\security_levels.dm"
#include "code\modules\shuttle\ai_ship.dm"
#include "code\modules\shuttle\arrivals.dm"

View File

@@ -146,7 +146,7 @@ SUBSYSTEM_DEF(Yogs)
/datum/controller/subsystem/Yogs/fire(resumed = 0)
//END OF SHIFT ANNOUNCER
if(world.time > (ROUND_END_ANNOUNCEMENT_TIME*600) && !endedshift && !(EMERGENCY_AT_LEAST_DOCKED))
priority_announce("Crew, your shift has come to an end.[SSshuttle.emergency.mode == SHUTTLE_IDLE ? "\nYou may call the shuttle whenever you find it appropriate." : ""]", "End of shift announcement", RANDOM_REPORT_SOUND)
priority_announce("Crew, your shift has come to an end.[SSshuttle.emergency.mode == SHUTTLE_IDLE ? "\nYou may call the shuttle whenever you find it appropriate." : ""]", "End of shift announcement", SSstation.announcer.get_rand_report_sound())
endedshift = TRUE
//UNCLAIMED TICKET BWOINKER