Merge pull request #6857 from FlattestGuitar/announcements-fix

More announcement tweaks 🔈
This commit is contained in:
Crazy Lemon
2017-04-26 18:54:45 -07:00
committed by GitHub
3 changed files with 50 additions and 71 deletions
+18 -36
View File
@@ -2,8 +2,6 @@
/var/datum/announcement/priority/priority_announcement = new(do_log = 0)
/var/datum/announcement/priority/command/command_announcement = new(do_log = 0, do_newscast = 0)
/var/datum/announcement/priority/command/event/event_announcement = new(do_log = 0, do_newscast = 0)
/var/datum/announcement/priority/enemy/communications_announcement = new(do_log = 0, do_newscast = 0)
/datum/announcement
var/title = "Attention"
@@ -36,17 +34,11 @@
admin_announcement = 1
title = "[command_name()] Update"
announcement_type = "[command_name()] Update"
/datum/announcement/priority/command/event/New(var/do_log = 1, var/new_sound = sound('sound/misc/notice2.ogg'), var/do_newscast = 0)
..(do_log, new_sound, do_newscast)
admin_announcement = 0
/datum/announcement/priority/enemy/New(var/do_log = 1, var/new_sound = sound('sound/AI/intercept2.ogg'), var/do_newscast = 0)
..(do_log, new_sound, do_newscast)
admin_announcement = 1
title = "[command_name()] Update"
announcement_type = "Enemy Communications"
/datum/announcement/priority/security/New(var/do_log = 1, var/new_sound = sound('sound/misc/notice2.ogg'), var/do_newscast = 0)
..(do_log, new_sound, do_newscast)
title = "Security Announcement"
@@ -55,44 +47,44 @@
/datum/announcement/proc/Announce(var/message as text, var/new_title = "", var/new_sound = null, var/do_newscast = newscast, var/msg_sanitized = 0, var/from, var/msg_language)
if(!message)
return
var/tmp/message_title = new_title ? new_title : title
var/tmp/message_sound = new_sound ? sound(new_sound) : sound
if(!msg_sanitized)
message = trim_strip_html_properly(message, allow_lines = 1)
message_title = html_encode(message_title)
var/message_announcer = null
if(announcer)
message_announcer = html_encode(announcer)
var/datum/language/message_language = all_languages[msg_language ? msg_language : language]
var/list/combined_receivers = Get_Receivers(message_language)
var/list/receivers = combined_receivers[1]
var/list/garbled_receivers = combined_receivers[2]
var/formatted_message = Format_Message(message, message_title, message_announcer, from)
var/garbled_formatted_message = Format_Message(message_language.scramble(message), message_language.scramble(message_title), message_language.scramble(message_announcer), message_language.scramble(from))
Message(formatted_message, garbled_formatted_message, receivers, garbled_receivers)
if(do_newscast)
NewsCast(message, message_title)
Sound(message_sound, combined_receivers[1] + combined_receivers[2])
Log(message, message_title)
/datum/announcement/proc/Get_Receivers(var/datum/language/message_language)
var/list/receivers = list()
var/list/garbled_receivers = list()
if(admin_announcement)
for(var/mob/M in player_list)
if(!isnewplayer(M) && M.client)
receivers |= M
else
else
for(var/obj/item/device/radio/R in global_radios)
receivers |= R.send_announcement()
for(var/mob/M in receivers)
@@ -102,7 +94,7 @@
if(!M.say_understands(null, message_language))
receivers -= M
garbled_receivers |= M
for(var/mob/M in dead_mob_list)
for(var/mob/M in dead_mob_list)
if(M.client && M.stat == DEAD)
receivers |= M
@@ -113,21 +105,21 @@
to_chat(M, message)
for(var/mob/M in garbled_receivers)
to_chat(M, garbled_message)
/datum/announcement/proc/Format_Message(message, message_title, message_announcer, from)
var/formatted_message
formatted_message += "<h2 class='alert'>[message_title]</h2>"
formatted_message += "<br><span class='alert'>[message]</span>"
if(message_announcer)
formatted_message += "<br><span class='alert'> -[message_announcer]</span>"
return formatted_message
/datum/announcement/minor/Format_Message(message, message_title, message_announcer, from)
var/formatted_message
formatted_message += "<b><font size=3><font color=red>[message_title]</font color></font></b>"
formatted_message += "<br><b><font size=3>[message]</font size></font></b>"
return formatted_message
/datum/announcement/priority/Format_Message(message, message_title, message_announcer, from)
@@ -137,20 +129,10 @@
if(message_announcer)
formatted_message += "<br><span class='alert'> -[message_announcer]</span>"
formatted_message += "<br>"
return formatted_message
/datum/announcement/priority/command/Format_Message(message, message_title, message_announcer, from)
var/formatted_message
formatted_message += "<h1 class='alert'>[title]</h1>"
if(message_title)
formatted_message += "<br><h2 class='alert'>[message_title]</h2>"
formatted_message += "<br><span class='alert'>[message]</span><br>"
formatted_message += "<br>"
return formatted_message
/datum/announcement/priority/enemy/Format_Message(message, message_title, message_announcer, from)
var/formatted_message
formatted_message += "<h1 class='alert'>[from]</h1>"
if(message_title)
@@ -164,7 +146,7 @@
var/formatted_message
formatted_message += "<font size=4 color='red'>[message_title]</font>"
formatted_message += "<br><font color='red'>[message]</font>"
return formatted_message
/datum/announcement/proc/NewsCast(message as text, message_title as text)
+1 -1
View File
@@ -44,7 +44,7 @@
to_chat(aiPlayer, "Laws Updated: [law]")
print_command_report(intercepttext, interceptname)
event_announcement.Announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg')
event_announcement.Announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg', from = "[command_name()] Update")
/datum/station_state
var/floor = 0
+31 -34
View File
@@ -543,49 +543,46 @@ Traitors and the like can also be revived with the previous role mostly intact.
/client/proc/cmd_admin_create_centcom_report()
set category = "Event"
set name = "Create Communications Report"
var/list/MsgType = list("Centcom Report","Enemy Communications")
if(!check_rights(R_SERVER|R_EVENT))
return
//the stuff on the list is |"report type" = "report title"|, if that makes any sense
var/list/MsgType = list("Central Command Report" = "Nanotrasen Update",
"Syndicate Communique" = "Syndicate Message",
"Space Wizard Federation Message" = "Sorcerous Message",
"Enemy Communications" = "Unknown Message",
"Custom" = "Cryptic Message")
var/list/MsgSound = list("Beep" = 'sound/misc/notice2.ogg',
"Enemy Communications Intercepted" = 'sound/AI/intercept2.ogg',
"New Command Report Created" = 'sound/AI/commandreport.ogg')
var/type = input(usr, "Pick a type of report to send", "Report Type", "") as anything in MsgType
var/input = input(usr, "Please enter anything you want. Anything. Serious.", "What?", "") as message|null
if(!input)
return
var/customname = input(usr, "Pick a title for the report.", "Title") as text|null
if(type == "Custom")
type = input(usr, "What would you like the report type to be?", "Report Type", "Encrypted Transmission") as text|null
var/customname = input(usr, "Pick a title for the report.", "Title", MsgType[type]) as text|null
if(!customname)
return
var/input = input(usr, "Please enter anything you want. Anything. Serious.", "What's the message?") as message|null
if(!input)
return
if(type == "Enemy Communications")
if(!customname)
customname = type
switch(alert("Should this be announced to the general population?",,"Yes","No", "Cancel"))
if("Yes")
var/beepsound = input(usr, "What sound should the announcement make?", "Announcement Sound", "") as anything in MsgSound
var/from = input(usr, "What kind of report? Example: Syndicate Communique", "From") as text|null
if(!from)
from = "Syndicate Communique"
switch(alert("Should this be announced to the general population?",,"Yes","No", "Cancel"))
if("Yes")
communications_announcement.Announce(input, customname, , , , from);
else if("No")
to_chat(world, "<span class='danger'>[from] available at all communications consoles.</span>")
else
return
command_announcement.Announce(input, customname, MsgSound[beepsound], , , type)
print_command_report(input, "[command_name()] Update")
else if("No")
//same thing as the blob stuff - it's not public, so it's classified, dammit
command_announcement.Announce("A report has been downloaded and printed out at all communications consoles.", "Incoming Classified Message", 'sound/AI/commandreport.ogg', from = "[command_name()] Update")
print_command_report(input, "Classified [command_name()] Update")
else
return
print_command_report(input, from)
if(type == "Centcom Report")
if(!customname)
customname = "Nanotrasen Update"
var/announce = alert("Should this be announced to the general population?",,"Yes","No")
switch(announce)
if("Yes")
command_announcement.Announce(input, customname);
if("No")
to_chat(world, "<span class='danger'>New Nanotrasen Update available at all communication consoles.</span>")
print_command_report(input, "[announce == "No" ? "Classified " : ""][command_name()] Update")
// world << sound('sound/AI/commandreport.ogg')
log_admin("[key_name(src)] has created a communications report: [input]")
message_admins("[key_name_admin(src)] has created a communications report", 1)
feedback_add_details("admin_verb","CCR") //If you are copy-pasting this, ensure the 2nd parameter is unique to the new proc!