Skip to content

Commit

Permalink
Merge branch 'globalnarrate' into masterbackup
Browse files Browse the repository at this point in the history
  • Loading branch information
silencer-pl authored Dec 2, 2023
2 parents 183c401 + 7bbf80e commit e232323
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 5 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -27,3 +27,7 @@
// Role Display
#define role_header(str) ("<div class='role_header'><p>" + str + "</p></div>")
#define role_body(str) ("<div class='role_body'><p>" + str + "</p></div>")

// Global Narrate
#define narrate_head(str) ("<div class='narrate_head'>" + str + "</div>")
#define narrate_body(str) ("<div class='narrate_body'>" + str + "</div>")
23 changes: 19 additions & 4 deletions code/modules/admin/tabs/event_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -651,14 +651,29 @@
if (!admin_holder || !(admin_holder.rights & R_MOD))
to_chat(src, "Only administrators may use this command.")
return
var/narrate_body_text
var/narrate_header_text
var/narrate_output

var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text
if(tgui_alert(src, "Do you want your narration to include a header paragraph?", "Global Narrate", list("Yes", "No"), timeout = 0) == "Yes")
narrate_header_text = tgui_input_text(src, "Please type the header paragraph below. One or two sentences or a title work best. HTML style tags are available. Paragraphs are not recommended.", "Global Narrate Header", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0)
if(!narrate_header_text)
return
narrate_body_text = tgui_input_text(src, "Please enter the text for your narration. Paragraphs without line breaks produce the best visual results, but HTML tags in general are respected. A preview will be available.", "Global Narrate Text", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0)
if(!narrate_body_text)
return

if(!narrate_header_text)
narrate_output = "[narrate_body("[narrate_body_text]")]"
else
narrate_output = "[narrate_head("[narrate_header_text]")]" + "[narrate_body("[narrate_body_text]")]"

if(!msg)
to_chat(usr,"[narrate_output]")
if(tgui_alert(src, "Text preview is available. Send narration?", "Confirmation", list("Yes","No"), timeout = 0) != "Yes")
return

to_chat_spaced(world, html = SPAN_ANNOUNCEMENT_HEADER_BLUE(msg))
message_admins("\bold GlobalNarrate: [key_name_admin(usr)] : [msg]")
to_chat(world, "[narrate_output]")
message_admins("[SPAN_BOLD("[key_name_admin(usr)] has sent a Global Narrate message!")]")


/client
Expand Down
3 changes: 3 additions & 0 deletions code/stylesheet.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,4 +155,7 @@ h1.alert, h2.alert {color: #000000;}
.retro_translator {font-weight: bold;}
.yautja_translator {color: #aa0000; font-weight: bold;}

.narrate_head {font-size: 3; text-align: center; color: #ffccff;padding: 0em 1em;}
.narrate_body {font-size: 2; text-align: justify; color: #ff99ff;padding: 0em 1em;}

</style>"}
2 changes: 1 addition & 1 deletion tgui/packages/tgui-panel/chat/constants.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ export const MESSAGE_TYPES = [
name: 'Info',
description: 'Non-urgent messages from the game and items',
selector:
'.notice:not(.pm), .adminnotice, .info, .role_body, .role_header, .event_announcement, .announce_header, .announce_header_blue, .announce_body, .sinister, .cult, .xenonotice, .xenoannounce, .yautjabold, .yautjaboldbig',
'.notice:not(.pm), .adminnotice, .info, .role_body, .role_header, .event_announcement, .announce_header, .announce_header_blue, .announce_body, .sinister, .cult, .xenonotice, .xenoannounce, .yautjabold, .yautjaboldbig, .narrate_head, .narrate_body',
},
{
type: MESSAGE_TYPE_WARNING,
Expand Down
14 changes: 14 additions & 0 deletions tgui/packages/tgui-panel/styles/goon/chat-dark.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1446,3 +1446,17 @@ em {
font-style: italic;
border-bottom: 1px dashed #fff;
}

.narrate_head {
font-size: 140%;
color: #ffccff;
text-align: center;
padding: 0em 1em;
}

.narrate_body {
font-size: 110%;
color: #ff99ff;
text-align: justify;
padding: 0em 1em;
}
14 changes: 14 additions & 0 deletions tgui/packages/tgui-panel/styles/goon/chat-light.scss
Original file line number Diff line number Diff line change
Expand Up @@ -1468,3 +1468,17 @@ h2.alert {
font-style: italic;
border-bottom: 1px dashed #000;
}

.narrate_head {
font-size: 140%;
color: #3d103d;
text-align: center;
padding: 0em 1em;
}

.narrate_body {
font-size: 110%;
color: #020002;
text-align: justify;
padding: 0em 1em;
}

0 comments on commit e232323

Please sign in to comment.