-
Notifications
You must be signed in to change notification settings - Fork 67
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[MIRROR] Admin server announcement uses new announcement span [MDB IG…
…NORE] (#25737) * Admin server announcement uses new announcement span (#80403) ## About The Pull Request The current admin announce is just notice span text, which is easily missed mixed in with all the other white noise of the chat box. Currently admins have to fill it with linebreaks or manually add their own spans to increase visibility. This updates the admin announcement proc to use the new alert box divs, similar to other announcements, making it more visible. ## Why It's Good For The Game Admin server-wide announcements are generally things you want the players to notice ![image](https://github.com/tgstation/tgstation/assets/83487515/460bacbb-3a7f-4855-9e16-24b1533f61bd) ## Changelog :cl: LT3 admin: Server wide admin announcements now use an alert box like other announcements /:cl: --------- Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com> * Admin server announcement uses new announcement span --------- Co-authored-by: lessthanthree <[email protected]> Co-authored-by: MrMelbert <51863163+MrMelbert@ users.noreply.github.com>
- Loading branch information
1 parent
db8b7c9
commit 9412148
Showing
4 changed files
with
80 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
/** | ||
* Sends a div formatted chat box announcement | ||
* | ||
* Formatted like: | ||
* | ||
* " Server Announcement " (or sender_override) | ||
* | ||
* " Title " | ||
* | ||
* " Text " | ||
* | ||
* Arguments | ||
* * text - required, the text to announce | ||
* * title - optional, the title of the announcement. | ||
* * players - optional, a list of all players to send the message to. defaults to the entire world | ||
* * play_sound - if TRUE, play a sound with the announcement (based on player option) | ||
* * sound_override - optional, override the default announcement sound | ||
* * sender_override - optional, modifies the sender of the announcement | ||
* * encode_title - if TRUE, the title will be HTML encoded | ||
* * encode_text - if TRUE, the text will be HTML encoded | ||
* * color_override - optional, set a color for the announcement box | ||
*/ | ||
|
||
/proc/send_formatted_announcement( | ||
text, | ||
title = "", | ||
players, | ||
play_sound = TRUE, | ||
sound_override = 'sound/ai/default/attention.ogg', | ||
sender_override = "Server Admin Announcement", | ||
encode_title = TRUE, | ||
encode_text = TRUE, | ||
color_override = "grey", | ||
) | ||
if(isnull(text)) | ||
return | ||
|
||
var/list/announcement_strings = list() | ||
|
||
if(encode_title && title && length(title) > 0) | ||
title = html_encode(title) | ||
if(encode_text) | ||
text = html_encode(text) | ||
if(!length(text)) | ||
return | ||
|
||
announcement_strings += span_announcement_header(generate_unique_announcement_header(title, sender_override)) | ||
announcement_strings += span_major_announcement_text(text) | ||
var/finalized_announcement = create_announcement_div(jointext(announcement_strings, ""), color_override) | ||
|
||
if(islist(players)) | ||
for(var/mob/target in players) | ||
to_chat(target, finalized_announcement) | ||
if(play_sound && target.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements)) | ||
SEND_SOUND(target, sound(sound_override)) | ||
else | ||
to_chat(world, finalized_announcement) | ||
|
||
if(!play_sound) | ||
return | ||
|
||
for(var/mob/player in GLOB.player_list) | ||
if(player.client?.prefs.read_preference(/datum/preference/toggle/sound_announcements)) | ||
SEND_SOUND(player, sound(sound_override)) | ||
|
||
/** | ||
* Inserts a span styled message into an alert box div | ||
* | ||
* | ||
* Arguments | ||
* * message - required, the message contents | ||
* * color - optional, set a div color other than default | ||
*/ | ||
/proc/create_announcement_div(message, color = "default") | ||
var/processed_message = "<div class='chat_alert_[color]'>[message]</div>" | ||
return processed_message |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters