Gamma loop + fixes (#2045)

* gamma loop + shitcode fixes.

* Update set_security_level.dm

* dssdds
This commit is contained in:
Gandalf
2020-12-06 21:58:03 +00:00
committed by GitHub
parent 43474a2267
commit e40fed46a8
3 changed files with 44 additions and 28 deletions
@@ -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
+17 -16
View File
@@ -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!"
@@ -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