Skip to content
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

Sector Patrol admin command ports #1

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all 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
3 changes: 3 additions & 0 deletions code/__DEFINES/chat.dm
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,6 @@

/// Adds a generic box around whatever message you're sending in chat. Really makes things stand out.
#define examine_block(str) ("<div class='examine_block'>" + str + "</div>")

#define narrate_head(str) ("<div class='narrate_head'><p>" + str + "</p></div>")
#define narrate_body(str) ("<div class='narrate_body'><p>" + str + "</p></div>")
1 change: 1 addition & 0 deletions code/_onclick/hud/fullscreen.dm
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

/mob
var/list/fullscreens = list()
var/list/narration_settings = list("Name" = null, "Location" = null, "Position" = null)

/mob/proc/overlay_fullscreen(category, type, severity)
var/atom/movable/screen/fullscreen/screen = fullscreens[category]
Expand Down
3 changes: 3 additions & 0 deletions code/modules/admin/admin_verbs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,9 @@ var/list/admin_verbs_minor_event = list(
/client/proc/admin_biohazard_alert,
/client/proc/toggle_hardcore_perma,
/client/proc/toggle_bypass_joe_restriction,
/client/proc/set_narration_preset,
/client/proc/speak_to_comms,
/client/proc/call_tgui_play_directly,
)

var/list/admin_verbs_major_event = list(
Expand Down
89 changes: 85 additions & 4 deletions code/modules/admin/tabs/event_tab.dm
Original file line number Diff line number Diff line change
Expand Up @@ -652,13 +652,30 @@
to_chat(src, "Only administrators may use this command.")
return

var/msg = input("Message:", text("Enter the text you wish to appear to everyone:")) as text
var/narrate_body_text
var/narrate_header_text
var/narrate_output

if(!msg)
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.", "Global Narrate Text", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0)
if(!narrate_body_text)
return

to_chat_spaced(world, html = SPAN_ANNOUNCEMENT_HEADER_BLUE(msg))
message_admins("\bold GlobalNarrate: [key_name_admin(usr)] : [msg]")
if(!narrate_header_text)
narrate_output = "[narrate_body("[narrate_body_text]")]"
else
narrate_output = "[narrate_head("[narrate_header_text]")]" + "[narrate_body("[narrate_body_text]")]"

to_chat(world, "[narrate_output]")
while(narrate_body_text != null)
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.", "Global Narrate Text", max_length = MAX_BOOK_MESSAGE_LEN, multiline = TRUE, encode = FALSE, timeout = 0)
if(!narrate_body_text)
return
to_chat(world, narrate_body("[narrate_body_text]"))


/client/proc/cmd_admin_ground_narrate()
set name = "Narrate to Ground Levels"
Expand Down Expand Up @@ -1055,3 +1072,67 @@
return FALSE
show_blurb(GLOB.player_list, duration, message, TRUE, "center", "center", "#bd2020", "ADMIN")
message_admins("[key_name(usr)] sent an admin blurb alert to all players. Alert reads: '[message]' and lasts [(duration / 10)] seconds.")

/client/proc/set_narration_preset()
set name = "Speak as NPC over comms - setup NPC"
set category = "DM.Narration"
if(!check_rights(R_ADMIN)) return

var/list/comms_presets = list("Mission Control","Custom")
switch(tgui_input_list(usr,"Select a Comms Preset","PRESET",comms_presets,timeout = 0))
if(null)
return
if("Mission Control")
usr.narration_settings["Name"] = "Mission Control"
usr.narration_settings["Location"] = "Arrowhead Command"
usr.narration_settings["Position"] = "SO"
if("Custom")
usr.narration_settings["Name"] = tgui_input_text(usr, "Enter the name, complete with a rank prefix.", "NAME entry", usr.narration_settings["Name"], timeout = 0)
usr.narration_settings["Location"] = tgui_input_text(usr, "Enter assignment or location, when in doubt, OV-PST works.", "LOCATION entry", usr.narration_settings["Location"], timeout = 0)
usr.narration_settings["Position"] = tgui_input_text(usr, "Enter held position like CE, CO, RFN or whatnot. Prefaced with some specialty acronym also can work.", "POSITION entry", usr.narration_settings["Position"], timeout = 0)
return

/client/proc/speak_to_comms()
set name = "Speak as NPC over comms"
set category = "DM.Narration"
if(!check_rights(R_ADMIN)) return

if(usr.narration_settings["Name"] == null || usr.narration_settings["Location"] == null || usr.narration_settings["Position"] == null) set_narration_preset()
var/text_to_comm = tgui_input_text(usr, "Enter what to say as [usr.narration_settings["Name"]],[usr.narration_settings["Location"]],[usr.narration_settings["Position"]] or cancel to exit.")

while(text_to_comm != null)
to_chat(world, "<span class='big'><span class='radio'><span class='name'>[usr.narration_settings["Name"]]<b>[icon2html('icons/obj/items/radio.dmi', usr, "beacon")] \u005B[usr.narration_settings["Location"]] \u0028[usr.narration_settings["Position"]]\u0029\u005D </b></span><span class='message'>, says \"[text_to_comm]\"</span></span></span>", type = MESSAGE_TYPE_RADIO)
text_to_comm = tgui_input_text(usr, "Enter what to say as [usr.narration_settings["Name"]],[usr.narration_settings["Location"]],[usr.narration_settings["Position"]] or cancel to exit.")
return

/proc/show_blurb_song(title = "Song Name",additional = "Song Artist - Song Album",)//Shows song blurb, a two line blurb. The first line passes
var/message_to_display = "<b>[title]</b>\n[additional]"
show_blurb(GLOB.player_list, 10 SECONDS, "[message_to_display]", screen_position = "LEFT+0:16,BOTTOM+1:16", text_alignment = "left", text_color = "#FFFFFF", blurb_key = "song[title]", ignore_key = TRUE, speed = 1)

/client/proc/call_tgui_play_directly()
set category = "Admin.Fun"
set name = "Play Music From Direct Link"
set desc = "Plays a music file from a https:// link through tguis music player, bypassing the filtering done by the other admin command. This will play as an admin atmospheric and will be muted by clinets who have that setting turned on as expected. A blurb displaying song info can also be displayed as an extra option."

if(!check_rights(R_ADMIN))
return

var/targets = GLOB.mob_list
var/list/music_extra_data = list()
var/web_sound_url = tgui_input_text(usr, "Enter link to sound file. Must use https://","LINK to play", timeout = 0)
var/song_blurb_indicator = tgui_alert(usr, "Show title blurb?", "Blurb", list("No","Yes"), timeout = 0)
music_extra_data["title"] = tgui_input_text(usr, "Enter song Title, leaving this blank/null will use its url instead.","Title input", timeout = 0)
music_extra_data["artist"] = tgui_input_text(usr, "Enter song Artist, or leave blank to not display.", "Artist input", timeout = 0)
music_extra_data["album"] = tgui_input_text(usr, "Enter song Album, or leave blank to not display.","Album input", timeout = 0)
if(music_extra_data["title"] == null) music_extra_data["title"] = web_sound_url
if(music_extra_data["artist"] == null) music_extra_data["artist"] = "Unknown Artist"
if(music_extra_data["album"] == null) music_extra_data["album"] = "Unknown Album"
music_extra_data["link"] = "Song Link Hidden"
music_extra_data["duration"] = "None"
for(var/mob/mob as anything in targets)
var/client/client = mob?.client
if((client?.prefs?.toggles_sound & SOUND_MIDI) && (client?.prefs?.toggles_sound & SOUND_ADMIN_ATMOSPHERIC))
if(song_blurb_indicator == "Yes") show_blurb_song(title = music_extra_data["title"], additional = "[music_extra_data["artist"]] - [music_extra_data["album"]]")
client?.tgui_panel?.play_music(web_sound_url, music_extra_data)
else
client?.tgui_panel?.stop_music()
8 changes: 5 additions & 3 deletions tgui/packages/tgui-panel/audio/NowPlayingWidget.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,9 +49,11 @@ export const NowPlayingWidget = (props) => {
URL: {URL}
</Flex.Item>
)}
<Flex.Item grow={1} color="label">
Duration: {duration}
</Flex.Item>
{duration !== '0' && duration !== 'None' && (
<Flex.Item grow={1} color="label">
Duration: {duration}
</Flex.Item>
)}
{Artist !== 'Song Artist Hidden' &&
Artist !== 'Unknown Artist' && (
<Flex.Item grow={1} color="label">
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 @@ -1469,3 +1469,17 @@ em {
font-style: italic;
border-bottom: 1px dashed #fff;
}

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

.narrate_body {
font-size: 100%;
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 @@ -1487,3 +1487,17 @@ h2.alert {
font-style: italic;
border-bottom: 1px dashed #000;
}

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

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