Refactor announcements. (#19459)

* Refactor announcements.

* Actually make this a unit test

* Dumb

* Remove unnecessary 'as text'

* Reviews:

- Make CSS class a recognizable word
- Flip the defaults for logging

Also:

- Style fixes (default null in fields)
- Fix emergency/crew-transfer shuttle announcement titles
This commit is contained in:
warriorstar-orion
2022-11-02 20:31:37 +01:00
committed by GitHub
parent e63526cfdd
commit 85f4503d33
27 changed files with 278 additions and 178 deletions
@@ -7,8 +7,7 @@ GLOBAL_VAR_INIT(security_level, 0)
//5 = code delta
//config.alert_desc_blue_downto
GLOBAL_DATUM_INIT(security_announcement_up, /datum/announcement/priority/security, new(do_log = FALSE, new_sound = sound('sound/misc/notice1.ogg')))
GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/security, new(do_log = FALSE))
GLOBAL_DATUM_INIT(security_announcement, /datum/announcer, new(config_type = /datum/announcement_configuration/security))
/proc/set_security_level(level)
switch(level)
@@ -33,7 +32,7 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
switch(level)
if(SEC_LEVEL_GREEN)
GLOB.security_announcement_down.Announce("All threats to the station have passed. All weapons need to be holstered and privacy laws are once again fully enforced.","Attention! Security level lowered to green.", 'sound/AI/green.ogg')
GLOB.security_announcement.Announce("All threats to the station have passed. All weapons need to be holstered and privacy laws are once again fully enforced.","Attention! Security level lowered to green.", 'sound/AI/green.ogg')
GLOB.security_level = SEC_LEVEL_GREEN
unset_stationwide_emergency_lighting()
post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME)
@@ -41,9 +40,9 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
if(SEC_LEVEL_BLUE)
if(GLOB.security_level < SEC_LEVEL_BLUE)
GLOB.security_announcement_up.Announce("The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible and random searches are permitted.","Attention! Security level elevated to blue.", 'sound/AI/blue.ogg')
GLOB.security_announcement.Announce("The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible and random searches are permitted.","Attention! Security level elevated to blue.", 'sound/AI/blue.ogg')
else
GLOB.security_announcement_down.Announce("The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.","Attention! Security level lowered to blue.", 'sound/AI/blue.ogg')
GLOB.security_announcement.Announce("The immediate threat has passed. Security may no longer have weapons drawn at all times, but may continue to have them visible. Random searches are still allowed.","Attention! Security level lowered to blue.", 'sound/AI/blue.ogg')
GLOB.security_level = SEC_LEVEL_BLUE
post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME)
@@ -52,9 +51,9 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
if(SEC_LEVEL_RED)
if(GLOB.security_level < SEC_LEVEL_RED)
GLOB.security_announcement_up.Announce("There is an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!", 'sound/AI/red.ogg')
GLOB.security_announcement.Announce("There is an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!", 'sound/AI/red.ogg')
else
GLOB.security_announcement_down.Announce("The station's self-destruct mechanism has been deactivated, but there is still an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!", 'sound/AI/red.ogg')
GLOB.security_announcement.Announce("The station's self-destruct mechanism has been deactivated, but there is still an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.","Attention! Code Red!", 'sound/AI/red.ogg')
unset_stationwide_emergency_lighting()
GLOB.security_level = SEC_LEVEL_RED
@@ -66,7 +65,7 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
update_firealarms()
if(SEC_LEVEL_GAMMA)
GLOB.security_announcement_up.Announce("Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location.", "Attention! Gamma security level activated!", 'sound/effects/new_siren.ogg', new_sound2 = 'sound/AI/gamma.ogg')
GLOB.security_announcement.Announce("Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location.", "Attention! Gamma security level activated!", 'sound/effects/new_siren.ogg', new_sound2 = 'sound/AI/gamma.ogg')
GLOB.security_level = SEC_LEVEL_GAMMA
if(GLOB.security_level < SEC_LEVEL_RED)
@@ -89,7 +88,7 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
return
if(SEC_LEVEL_DELTA)
GLOB.security_announcement_up.Announce("The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.","Attention! Delta security level reached!", 'sound/effects/deltaalarm.ogg', new_sound2 = 'sound/AI/delta.ogg')
GLOB.security_announcement.Announce("The station's self-destruct mechanism has been engaged. All crew are instructed to obey all instructions given by heads of staff. Any violations of these orders can be punished by death. This is not a drill.","Attention! Delta security level reached!", 'sound/effects/deltaalarm.ogg', new_sound2 = 'sound/AI/delta.ogg')
GLOB.security_level = SEC_LEVEL_DELTA
post_status(STATUS_DISPLAY_ALERT, "deltaalert")
@@ -204,7 +203,7 @@ GLOBAL_DATUM_INIT(security_announcement_down, /datum/announcement/priority/secur
INVOKE_ASYNC(L, /obj/machinery/light/.proc/update, FALSE)
/proc/epsilon_process()
GLOB.security_announcement_up.Announce("Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated.", "Attention! Epsilon security level activated!", 'sound/effects/purge_siren.ogg')
GLOB.security_announcement.Announce("Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated.", "Attention! Epsilon security level activated!", 'sound/effects/purge_siren.ogg')
GLOB.security_level = SEC_LEVEL_EPSILON
post_status(STATUS_DISPLAY_ALERT, "epsilonalert")
for(var/area/A as anything in GLOB.all_areas)