Files
Bubberstation/code/modules/security_levels/security_levels.dm
Cyberboss 9e1ef0ffe2 Global variable wrappers (#25325)
* Add the system for managed global variables

* Travis ban old globals

* So you CAN inline proccall, that's neat

* Fix that

* master.dm

* Remove the hack procs

* Move InitGlobals to the proper spot

* configuration.dm

* Fix the missing pre-slash

* clockcult.dm

* This is probably for the best

* Doy

* Fix shit

* Rest of the DEFINES tree

* Fix

* Use global. for access

* Update find_references_in_globals

Always hated that proc

Whoever made it must've bee a r e a l idiot...

* __HELPERS tree

* Move global initialization to master.

Fix the declaration

* database.dm

* Dat newline

* I said DECLARATIVE order!

* Here's something you can chew on @Iamgoofball

* game_modes.dm

* Fix this

* genetics.dm

* flavor_misc.dm

* More stuff

* Do it mso's way. Keep the controllers as global

* Make master actually see it

* Fix

* Finish _globalvars/lists

* Finish the rest of the _globalvars tree

* This is weird

* Migrate the controllers

* SLOTH -> GLOB

* Lighting globals

* round_start_time -> ticker

* PAI card list -> pai SS

* record_id_num -> static

* Diseases list -> SSdisease

* More disease globals to the SS

* More disease stuff

* Emote list

* Better and better

* Bluh

* So much stuff

* Ahh

* Wires

* dview

* station_areas

* Teleportlocs

* blood_splatter_icons

* Stuff and such

* More stuff

* RAD IO

* More stuff and such

* Blob shit

* Changeling stuff

* Add "Balance" to changelogs

* Balance for changelog compiler + Auto Tagging

* Update the PR template

* hivemind_bank

* Bip

* sacrificed

* Good shit

* Better define

* More cult shit

* Devil shit

* Gang shit

* > borers

Fix shit

* Rename the define

* Nuke

* Objectives

* Sandbox

* Multiverse sword

* Announce systems

* Stuff and such

* TC con

* Airlock

* doppllllerrrrrr

* holopads

* Shut up byond you inconsistent fuck

* Sneaky fuck

* Burp

* Bip

* Fixnshit

* Port without regard

* askdlfjs;

* asdfjasoidojfi

* Protected globals and more

* SO MANY

* ajsimkvahsaoisd

* akfdsiaopwimfeoiwafaw

* gsdfigjosidjfgiosdg

* AHHHHHHHHHHHHHHHHHHHHHHH!!!!!

* facerolll

* ASDFASDFASDF

* Removes the unused parts of dmm_suite

* WIP

* Fix quote

* asdfjauwfnkjs

* afwlunhskjfda

* asfjlaiwuefhaf

* SO CLOSE

* wwwweeeeeewwwww

* agdgmoewranwg

* HOLY MOTHER OF FUCK AND THATS JUST HALF THE JOB?!?

* Fix syntax errors

* 100 errors

* Another 100

* So many...

* Ugh

* More shit

* kilme

* Stuuuuuufffff

* ajrgmrlshio;djfa;sdkl

* jkbhkhjbmjvjmh

* soi soi soi

* butt

* TODAY WE LEARNED THAT GLOBAL AND STATIC ARE THE EXACT SAME FUCKING THING

* lllllllllllllllllllllllllllllllllllllllllll

* afsdijfiawhnflnjhnwsdfs

* yugykihlugk,kj

* time to go

* STUFFF!!!

* AAAAAAAAAAAAAAAAAHHHHHHHHHHHHHHHHHHHHHHHHHHH!!!!!!!!!!!!!!!!!!!!!!!

* ngoaijdjlfkamsdlkf

* Break time

* aufjsdklfalsjfi

* CONTROL KAY AND PRAY

* IT COMPILEELEELELAKLJFKLDAFJLKFDJLADKJHFLJKAJGAHIEJALDFJ!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

* Goteem

* Fix testing mode

* This does not belong in this PR

* Convert it to a controller

* Eh, fuck this option

* Revert controllerization Ill do it some other time

* Fix

* Working controllerization

* FOR THE LOVE OF CHRIST PROTECT THE LOGS

* Protect admins and deadmins

* Use the inbuilt proc
2017-04-06 23:26:13 -06:00

129 lines
4.2 KiB
Plaintext

GLOBAL_VAR_INIT(security_level, 0)
//0 = code green
//1 = code blue
//2 = code red
//3 = code delta
//config.alert_desc_blue_downto
/proc/set_security_level(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 != GLOB.security_level)
switch(level)
if(SEC_LEVEL_GREEN)
minor_announce(config.alert_desc_green, "Attention! Security level lowered to green:")
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
if(GLOB.security_level >= SEC_LEVEL_RED)
SSshuttle.emergency.modTimer(4)
else
SSshuttle.emergency.modTimer(2)
GLOB.security_level = SEC_LEVEL_GREEN
for(var/obj/machinery/firealarm/FA in GLOB.machines)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
if(SEC_LEVEL_BLUE)
if(GLOB.security_level < SEC_LEVEL_BLUE)
minor_announce(config.alert_desc_blue_upto, "Attention! Security level elevated to blue:",1)
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
SSshuttle.emergency.modTimer(0.5)
else
minor_announce(config.alert_desc_blue_downto, "Attention! Security level lowered to blue:")
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
SSshuttle.emergency.modTimer(2)
GLOB.security_level = SEC_LEVEL_BLUE
for(var/obj/machinery/firealarm/FA in GLOB.machines)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
if(SEC_LEVEL_RED)
if(GLOB.security_level < SEC_LEVEL_RED)
minor_announce(config.alert_desc_red_upto, "Attention! Code red!",1)
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
if(GLOB.security_level == SEC_LEVEL_GREEN)
SSshuttle.emergency.modTimer(0.25)
else
SSshuttle.emergency.modTimer(0.5)
else
minor_announce(config.alert_desc_red_downto, "Attention! Code red!")
GLOB.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 GLOB.machines)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines)
pod.admin_controlled = 0
if(SEC_LEVEL_DELTA)
minor_announce(config.alert_desc_delta, "Attention! Delta security level reached!",1)
if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL)
if(GLOB.security_level == SEC_LEVEL_GREEN)
SSshuttle.emergency.modTimer(0.25)
else if(GLOB.security_level == SEC_LEVEL_BLUE)
SSshuttle.emergency.modTimer(0.5)
GLOB.security_level = SEC_LEVEL_DELTA
for(var/obj/machinery/firealarm/FA in GLOB.machines)
if(FA.z == ZLEVEL_STATION)
FA.update_icon()
for(var/obj/machinery/computer/shuttle/pod/pod in GLOB.machines)
pod.admin_controlled = 0
else
return
/proc/get_security_level()
switch(GLOB.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(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(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)
*/