diff --git a/code/__DEFINES/~skyrat_defines/security_alerts.dm b/code/__DEFINES/~skyrat_defines/security_alerts.dm index c421d2f73fa..3425587b795 100644 --- a/code/__DEFINES/~skyrat_defines/security_alerts.dm +++ b/code/__DEFINES/~skyrat_defines/security_alerts.dm @@ -1,10 +1,9 @@ //Security levels -#define SEC_LEVEL_GREEN 0 -#define SEC_LEVEL_BLUE 1 -#define SEC_LEVEL_VIOLET 2 -#define SEC_LEVEL_ORANGE 3 -#define SEC_LEVEL_AMBER 4 -#define SEC_LEVEL_RED 5 -#define SEC_LEVEL_DELTA 6 -#define SEC_LEVEL_GAMMA 7 //Oh shit bois - +#define SEC_LEVEL_GREEN 1 +#define SEC_LEVEL_BLUE 2 +#define SEC_LEVEL_VIOLET 3 +#define SEC_LEVEL_ORANGE 4 +#define SEC_LEVEL_AMBER 5 +#define SEC_LEVEL_RED 6 +#define SEC_LEVEL_DELTA 7 +#define SEC_LEVEL_GAMMA 8 //Oh shit bois diff --git a/modular_skyrat/modules/alerts/code/firealarm.dm b/modular_skyrat/modules/alerts/code/firealarm.dm index f082e4d6c92..09c566386a7 100644 --- a/modular_skyrat/modules/alerts/code/firealarm.dm +++ b/modular_skyrat/modules/alerts/code/firealarm.dm @@ -1,18 +1,19 @@ /obj/machinery/firealarm/examine(mob/user) . = ..() - if(GLOB.security_level == SEC_LEVEL_GREEN) - . += "The current alert level is green." - if(GLOB.security_level == SEC_LEVEL_BLUE) - . += "The current alert level is blue." - if(GLOB.security_level == SEC_LEVEL_AMBER) - . += "The current alert level is amber." - if(GLOB.security_level == SEC_LEVEL_ORANGE) - . += "The current alert level is orange." - if(GLOB.security_level == SEC_LEVEL_VIOLET) - . += "The current alert level is violet." - if(GLOB.security_level == SEC_LEVEL_RED) - . += "The current alert level is red!" - if(GLOB.security_level == SEC_LEVEL_DELTA) - . += "The current alert level is delta! Evacuate!" - if(GLOB.security_level == SEC_LEVEL_GAMMA) - . += "Gamma alert! All crew to stations!" + switch(GLOB.security_level) + if(SEC_LEVEL_GREEN) + . += "The current alert level is green." + if(SEC_LEVEL_BLUE) + . += "The current alert level is blue." + if(SEC_LEVEL_AMBER) + . += "The current alert level is amber." + if(SEC_LEVEL_ORANGE) + . += "The current alert level is orange." + if(SEC_LEVEL_VIOLET) + . += "The current alert level is violet." + if(SEC_LEVEL_RED) + . += "The current alert level is red!" + if(SEC_LEVEL_DELTA) + . += "The current alert level is delta! Evacuate!" + if(SEC_LEVEL_GAMMA) + . += "Gamma alert! All crew to stations!" diff --git a/modular_skyrat/modules/alerts/code/set_security_level.dm b/modular_skyrat/modules/alerts/code/set_security_level.dm index 7ff9c47b264..abc5e00bcce 100644 --- a/modular_skyrat/modules/alerts/code/set_security_level.dm +++ b/modular_skyrat/modules/alerts/code/set_security_level.dm @@ -1,9 +1,12 @@ +GLOBAL_VAR_INIT(gamma_looping, FALSE) //This is so we know if the gamma sound effect is currently playing + +#define GAMMA_LOOP_LENGTH 1236 //2.06 minutes in deciseconds + /proc/set_security_level(level) level = seclevel2num(level) || level //Will not be announced if you try to set to the same level as it already is if(level >= SEC_LEVEL_GREEN && level <= SEC_LEVEL_GAMMA && level != GLOB.security_level) - play_security_alert_sound(level) switch(level) if(SEC_LEVEL_GREEN) minor_announce(CONFIG_GET(string/alert_green), "Attention! Alert level lowered to green:") @@ -108,6 +111,7 @@ for(var/obj/machinery/firealarm/FA in GLOB.machines) if(is_station_level(FA.z)) FA.update_icon() + play_security_alert_sound(level) else return @@ -150,7 +154,7 @@ return "gamma" /proc/seclevel2num(seclevel) - switch( lowertext(seclevel) ) + switch(lowertext(seclevel)) if("green") return SEC_LEVEL_GREEN if("blue") @@ -183,7 +187,7 @@ if(SEC_LEVEL_DELTA) alert_sound_to_playing('modular_skyrat/modules/alerts/sound/misc/deltaklaxon.ogg') if(SEC_LEVEL_GAMMA) - alert_sound_to_playing('modular_skyrat/modules/alerts/sound/misc/gamma_alert.ogg') + gamma_loop() //Gamma has a looping sound effect /proc/alert_sound_to_playing(soundin, volume = 100, vary = FALSE, frequency = 0, falloff = FALSE, channel = 0, pressure_affected = FALSE, sound/S) if(!S) @@ -193,3 +197,15 @@ var/mob/M = m if(M.client.prefs.toggles & SOUND_ANNOUNCEMENTS) M.playsound_local(M, null, volume, vary, frequency, falloff, channel, pressure_affected, S) + +//ALERT ALERT ALERT SHITCODE +/proc/gamma_loop() //Loops gamma sound + if(GLOB.gamma_looping) + return + GLOB.gamma_looping = TRUE + while(GLOB.security_level == SEC_LEVEL_GAMMA) + alert_sound_to_playing('modular_skyrat/modules/alerts/sound/misc/gamma_alert.ogg') + sleep(GAMMA_LOOP_LENGTH) + GLOB.gamma_looping = FALSE + +#undef GAMMA_LOOP_LENGTH