Adds 'Intercom Convo' verb

Allows an admin to 'schedule' up to 20 messages to play on the radio.
This commit is contained in:
Arokha Sieyes
2018-02-27 21:17:47 -05:00
parent a578eeeb85
commit 7aa5ca479a
5 changed files with 99 additions and 13 deletions

View File

@@ -49,6 +49,12 @@
name = "entertainment intercom"
frequency = ENT_FREQ
/obj/item/device/radio/intercom/omni
name = "global announcer"
/obj/item/device/radio/intercom/omni/initialize()
channels = radiochannels.Copy()
return ..()
/obj/item/device/radio/intercom/New()
..()
processing_objects += src

View File

@@ -53,14 +53,13 @@ var/global/list/default_medbay_channels = list(
var/const/FREQ_LISTENING = 1
var/list/internal_channels
/obj/item/device/radio
var/datum/radio_frequency/radio_connection
var/list/datum/radio_frequency/secure_radio_connections = new
proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
/obj/item/device/radio/proc/set_frequency(new_frequency)
radio_controller.remove_object(src, frequency)
frequency = new_frequency
radio_connection = radio_controller.add_object(src, frequency, RADIO_CHAT)
/obj/item/device/radio/New()
..()

View File

@@ -184,7 +184,7 @@ var/static/list/scarySounds = list(
var/max_explosion_range = 14
// Announcer intercom, because too much stuff creates an intercom for one message then hard del()s it.
var/global/obj/item/device/radio/intercom/global_announcer = new /obj/item/device/radio/intercom{channels=list("Engineering")}(null)
var/global/obj/item/device/radio/intercom/omni/global_announcer = new /obj/item/device/radio/intercom/omni(null)
var/list/station_departments = list("Command", "Medical", "Engineering", "Science", "Security", "Cargo", "Civilian")

View File

@@ -380,7 +380,7 @@ proc/admin_notice(var/message, var/rights)
if(3)
dat+={"
Creating new Feed Message...
<HR><B><A href='?src=\ref[src];ac_set_channel_receiving=1'>Receiving Channel</A>:</B> [src.admincaster_feed_channel.channel_name]<BR>" //MARK
<HR><B><A href='?src=\ref[src];ac_set_channel_receiving=1'>Receiving Channel</A>:</B> [src.admincaster_feed_channel.channel_name]<BR>
<B>Message Author:</B> <FONT COLOR='green'>[src.admincaster_signature]</FONT><BR>
<B><A href='?src=\ref[src];ac_set_new_message=1'>Message Body</A>:</B> [src.admincaster_feed_message.body] <BR>
<BR><A href='?src=\ref[src];ac_submit_new_message=1'>Submit</A><BR><BR><A href='?src=\ref[src];ac_setScreen=[0]'>Cancel</A><BR>
@@ -674,10 +674,7 @@ proc/admin_notice(var/message, var/rights)
set desc = "Send an intercom message, like an arrivals announcement."
if(!check_rights(0)) return
//This is basically how death alarms do it
var/obj/item/device/radio/headset/a = new /obj/item/device/radio/headset/omni(null)
var/channel = input("Channel for message:","Channel", null) as null|anything in (list("Common") + a.keyslot2.channels) // + a.keyslot1.channels
var/channel = input("Channel for message:","Channel", null) as null|anything in radiochannels
if(channel) //They picked a channel
var/sender = input("Name of sender (max 75):", "Announcement", "Announcement Computer") as null|text
@@ -688,11 +685,94 @@ proc/admin_notice(var/message, var/rights)
if(message) //They put a message
message = sanitize(message, 500, extra = 0)
a.autosay("[message]", "[sender]", "[channel == "Common" ? null : channel]") //Common is a weird case, as it's not a "channel", it's just talking into a radio without a channel set.
global_announcer.autosay("[message]", "[sender]", "[channel == "Common" ? null : channel]") //Common is a weird case, as it's not a "channel", it's just talking into a radio without a channel set.
log_admin("Intercom: [key_name(usr)] : [sender]:[message]")
qdel(a)
feedback_add_details("admin_verb","IN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
/datum/admins/proc/intercom_convo()
set category = "Fun"
set name = "Intercom Convo"
set desc = "Send an intercom conversation, like several uses of the Intercom Msg verb."
set waitfor = FALSE //Why bother? We have some sleeps. You can leave tho!
if(!check_rights(0)) return
var/channel = input("Channel for message:","Channel", null) as null|anything in radiochannels
if(!channel) //They picked a channel
return
to_chat(usr,"<span class='notice'><B>Intercom Convo Directions</B><br>Start the conversation with the sender, a pipe (|), and then the message on one line. Then hit enter to \
add another line, and type a (whole) number of seconds to pause between that message, and the next message, then repeat the message syntax up to 20 times. For example:<br>\
--- --- ---<br>\
Some Guy|Hello guys, what's up?<br>\
5<br>\
Other Guy|Hey, good to see you.<br>\
5<br>\
Some Guy|Yeah, you too.<br>\
--- --- ---<br>\
The above will result in those messages playing, with a 5 second gap between each. Maximum of 20 messages allowed.</span>")
var/list/decomposed
var/message = input(usr,"See your chat box for instructions. Keep a copy elsewhere in case it is rejected when you click OK.", "Input Conversation", "") as null|message
if(!message)
return
//Split on pipe or \n
decomposed = splittext(message,regex("\\||$","m"))
decomposed += "0" //Tack on a final 0 sleep to make 3-per-message evenly
//Time to find how they screwed up.
//Wasn't the right length
if((decomposed.len) % 3) //+1 to accomidate the lack of a wait time for the last message
to_chat(usr,"<span class='warning'>You passed [decomposed.len] segments (senders+messages+pauses). You must pass a multiple of 3, minus 1 (no pause after the last message). That means a sender and message on every other line (starting on the first), separated by a pipe character (|), and a number every other line that is a pause in seconds.</span>")
return
//Too long a conversation
if((decomposed.len / 3) > 20)
to_chat(usr,"<span class='warning'>This conversation is too long! 20 messages maximum, please.</span>")
return
//Missed some sleeps, or sanitized to nothing.
for(var/i = 1; i < decomposed.len; i++)
//Sanitize sender
var/clean_sender = sanitize(decomposed[i])
if(!clean_sender)
to_chat(usr,"<span class='warning'>One part of your conversation was not able to be sanitized. It was the sender of the [(i+2)/3]\th message.</span>")
return
decomposed[i] = clean_sender
//Sanitize message
var/clean_message = sanitize(decomposed[++i])
if(!clean_message)
to_chat(usr,"<span class='warning'>One part of your conversation was not able to be sanitized. It was the body of the [(i+2)/3]\th message.</span>")
return
decomposed[i] = clean_message
//Sanitize wait time
var/clean_time = text2num(decomposed[++i])
if(!isnum(clean_time))
to_chat(usr,"<span class='warning'>One part of your conversation was not able to be sanitized. It was the wait time after the [(i+2)/3]\th message.</span>")
return
if(clean_time > 60)
to_chat(usr,"<span class='warning'>Max 60 second wait time between messages for sanity's sake please.</span>")
return
decomposed[i] = clean_time
log_admin("Intercom convo started by: [key_name(usr)] : [sanitize(message)]")
feedback_add_details("admin_verb","IN") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!
//Sanitized AND we still have a chance to send it? Wow!
if(LAZYLEN(decomposed))
for(var/i = 1; i < decomposed.len; i++)
var/this_sender = decomposed[i]
var/this_message = decomposed[++i]
var/this_wait = decomposed[++i]
global_announcer.autosay("[this_message]", "[this_sender]", "[channel == "Common" ? null : channel]") //Common is a weird case, as it's not a "channel", it's just talking into a radio without a channel set.
sleep(this_wait SECONDS)
/datum/admins/proc/toggleooc()
set category = "Server"
set desc="Globally Toggles OOC"

View File

@@ -26,6 +26,7 @@ var/list/admin_verbs_admin = list(
/datum/admins/proc/toggleguests, //toggles whether guests can join the current game,
/datum/admins/proc/announce, //priority announce something to all clients.,
/datum/admins/proc/intercom, //send a fake intercom message, like an arrivals announcement,
/datum/admins/proc/intercom_convo, //send a fake intercom conversation, like an ATC exchange,
/client/proc/colorooc, //allows us to set a custom colour for everythign we say in ooc,
/client/proc/admin_ghost, //allows us to ghost/reenter body at will,
/client/proc/toggle_view_range, //changes how far we can see,