mirror of
https://github.com/Bubberstation/Bubberstation.git
synced 2026-08-23 21:18:37 +01:00
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  ## Changelog 🆑 LT3 admin: Server wide admin announcements now use an alert box like other announcements /🆑 --------- Co-authored-by: MrMelbert <51863163+MrMelbert@users.noreply.github.com>
This commit is contained in:
co-authored by
MrMelbert
parent
260b98c277
commit
f2ba7a8e94
@@ -13,6 +13,7 @@
|
||||
#define span_alertwarning(str) ("<span class='alertwarning'>" + str + "</span>")
|
||||
#define span_alien(str) ("<span class='alien'>" + str + "</span>")
|
||||
#define span_announce(str) ("<span class='announce'>" + str + "</span>")
|
||||
#define span_announcement_header(str) ("<span class='announcement_header'>" + str + "</span>")
|
||||
#define span_average(str) ("<span class='average'" + str + "</span")
|
||||
#define span_bad(str) ("<span class='bad'" + str + "</span")
|
||||
#define span_big(str) ("<span class='big'>" + str + "</span>")
|
||||
@@ -70,6 +71,7 @@
|
||||
#define span_interface(str) ("<span class='interface'>" + str + "</span>")
|
||||
#define span_linkify(str) ("<span class='linkify'>" + str + "</span>")
|
||||
#define span_looc(str) ("<span class='looc'>" + str + "</span>")
|
||||
#define span_major_announcement_text(str) ("<span class='major_announcement_text'>" + str + "</span>")
|
||||
#define span_medal(str) ("<span class='medal'>" + str + "</span>")
|
||||
#define span_medradio(str) ("<span class='medradio'>" + str + "</span>")
|
||||
#define span_memo(str) ("<span class='memo'>" + str + "</span>")
|
||||
|
||||
@@ -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
|
||||
@@ -37,7 +37,7 @@
|
||||
if(message)
|
||||
if(!check_rights(R_SERVER,0))
|
||||
message = adminscrub(message,500)
|
||||
to_chat(world, "[span_adminnotice("<b>[usr.client.holder.fakekey ? "Administrator" : usr.key] Announces:</b>")]\n \t [message]", confidential = TRUE)
|
||||
send_formatted_announcement(message, "From [usr.client.holder.fakekey ? "Administrator" : usr.key]")
|
||||
log_admin("Announce: [key_name(usr)] : [message]")
|
||||
BLACKBOX_LOG_ADMIN_VERB("Announce")
|
||||
|
||||
|
||||
@@ -385,6 +385,7 @@
|
||||
#include "code\__HELPERS\_string_lists.dm"
|
||||
#include "code\__HELPERS\admin.dm"
|
||||
#include "code\__HELPERS\ai.dm"
|
||||
#include "code\__HELPERS\announcements.dm"
|
||||
#include "code\__HELPERS\areas.dm"
|
||||
#include "code\__HELPERS\atmospherics.dm"
|
||||
#include "code\__HELPERS\atoms.dm"
|
||||
|
||||
Reference in New Issue
Block a user