Files
Yogstation/code/modules/security levels/security levels.dm
phil235 a55e6a70be Fixes malf AI lockdown affecting doors on z levels other than station and mining.
Replaces a lot of z level numbers in code by their respective defines.
Adding a define for the Mining asteroid z level.
2015-01-11 15:39:32 +01:00

105 lines
2.9 KiB
Plaintext

/var/security_level = 0
//0 = code green
//1 = code blue
//2 = code red
//3 = code delta
//config.alert_desc_blue_downto
/proc/set_security_level(var/level)
switch(level)
if("green")
level = SEC_LEVEL_GREEN
if("blue")
level = SEC_LEVEL_BLUE
if("red")
level = SEC_LEVEL_RED
if("delta")
level = SEC_LEVEL_DELTA
//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_DELTA && level != security_level)
switch(level)
if(SEC_LEVEL_GREEN)
minor_announce(config.alert_desc_green, "Attention! Security level lowered to green:")
security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
if(SEC_LEVEL_BLUE)
if(security_level < SEC_LEVEL_BLUE)
minor_announce(config.alert_desc_blue_upto, "Attention! Security level elevated to blue:",1)
else
minor_announce(config.alert_desc_blue_downto, "Attention! Security level lowered to blue:")
security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
if(SEC_LEVEL_RED)
if(security_level < SEC_LEVEL_RED)
minor_announce(config.alert_desc_red_upto, "Attention! Code red!",1)
else
minor_announce(config.alert_desc_red_downto, "Attention! Code red!")
security_level = SEC_LEVEL_RED
/* - At the time of commit, setting status displays didn't work properly
var/obj/machinery/computer/communications/CC = locate(/obj/machinery/computer/communications,world)
if(CC)
CC.post_status("alert", "redalert")*/
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
if(SEC_LEVEL_DELTA)
minor_announce(config.alert_desc_delta, "Attention! Delta security level reached!",1)
security_level = SEC_LEVEL_DELTA
for(var/obj/machinery/firealarm/FA in world)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
else
return
/proc/get_security_level()
switch(security_level)
if(SEC_LEVEL_GREEN)
return "green"
if(SEC_LEVEL_BLUE)
return "blue"
if(SEC_LEVEL_RED)
return "red"
if(SEC_LEVEL_DELTA)
return "delta"
/proc/num2seclevel(var/num)
switch(num)
if(SEC_LEVEL_GREEN)
return "green"
if(SEC_LEVEL_BLUE)
return "blue"
if(SEC_LEVEL_RED)
return "red"
if(SEC_LEVEL_DELTA)
return "delta"
/proc/seclevel2num(var/seclevel)
switch( lowertext(seclevel) )
if("green")
return SEC_LEVEL_GREEN
if("blue")
return SEC_LEVEL_BLUE
if("red")
return SEC_LEVEL_RED
if("delta")
return SEC_LEVEL_DELTA
/*DEBUG
/mob/verb/set_thing0()
set_security_level(0)
/mob/verb/set_thing1()
set_security_level(1)
/mob/verb/set_thing2()
set_security_level(2)
/mob/verb/set_thing3()
set_security_level(3)
*/