diff --git a/code/game/machinery/computer/communications.dm b/code/game/machinery/computer/communications.dm index 093804317c3..fcfaeeb8513 100644 --- a/code/game/machinery/computer/communications.dm +++ b/code/game/machinery/computer/communications.dm @@ -14,6 +14,7 @@ var/state = STATE_DEFAULT var/aistate = STATE_DEFAULT var/message_cooldown = 0 + var/tmp_alertlevel = 0 var/const STATE_DEFAULT = 1 STATE_CALLSHUTTLE = 2 @@ -22,6 +23,8 @@ STATE_VIEWMESSAGE = 5 STATE_DELMESSAGE = 6 STATE_STATUSDISPLAY = 7 + STATE_ALERT_LEVEL = 8 + STATE_CONFIRM_LEVEL = 9 var/status_display_freq = "1435" var/stat_msg1 @@ -59,6 +62,31 @@ if("logout") authenticated = 0 + if("swipeidseclevel") + var/mob/M = usr + var/obj/item/weapon/card/id/I = M.equipped() + if (istype(I, /obj/item/device/pda)) + var/obj/item/device/pda/pda = I + I = pda.id + if (I && istype(I)) + if(access_captain in I.access) + var/old_level = security_level + if(!tmp_alertlevel) tmp_alertlevel = SEC_LEVEL_GREEN + if(tmp_alertlevel < SEC_LEVEL_GREEN) tmp_alertlevel = SEC_LEVEL_GREEN + if(tmp_alertlevel > SEC_LEVEL_BLUE) tmp_alertlevel = SEC_LEVEL_BLUE //Cannot engage delta with this + set_security_level(tmp_alertlevel) + if(security_level != old_level) + //Only notify the admins if an actual change happened + log_game("[key_name(usr)] has changed the security level to [get_security_level()].") + message_admins("[key_name_admin(usr)] has changed the security level to [get_security_level()].", 1) + tmp_alertlevel = 0 + else: + usr << "You are not authorized to do this." + tmp_alertlevel = 0 + state = STATE_DEFAULT + else + usr << "You need to swipe your ID." + if("announce") if(src.authenticated==2) if(message_cooldown) return @@ -168,6 +196,17 @@ src.aistate = STATE_MESSAGELIST if("ai-status") src.aistate = STATE_STATUSDISPLAY + + if("securitylevel") + src.tmp_alertlevel = text2num( href_list["newalertlevel"] ) + if(!tmp_alertlevel) tmp_alertlevel = 0 + state = STATE_CONFIRM_LEVEL + + if("changeseclevel") + state = STATE_ALERT_LEVEL + + + src.updateUsrDialog() @@ -203,6 +242,7 @@ dat += "
\[ Log Out \]" if (src.authenticated==2) dat += "
\[ Make An Announcement \]" + dat += "
\[ Change alert level \]" if(emergency_shuttle.location==0) if (emergency_shuttle.online) dat += "
\[ Cancel Shuttle Call \]" @@ -248,7 +288,17 @@ dat += " Red Alert |" dat += " Lockdown |" dat += " Biohazard \]

" - + if(STATE_ALERT_LEVEL) + dat += "Current alert level: [get_security_level()]
" + if(security_level == SEC_LEVEL_DELTA) + dat += "The self-destruct mechanism is active. Find a way to deactivate the mechanism to lower the alert level or evacuate." + else + dat += "Blue
" + dat += "Green" + if(STATE_CONFIRM_LEVEL) + dat += "Current alert level: [get_security_level()]
" + dat += "Confirm the change to: [num2seclevel(tmp_alertlevel)]
" + dat += "Main Menu | " : ""]Close \]" user << browse(dat, "window=communications;size=400x500") diff --git a/code/modules/security levels/security levels.dm b/code/modules/security levels/security levels.dm index 7b431c23da5..ee34115779d 100644 --- a/code/modules/security levels/security levels.dm +++ b/code/modules/security levels/security levels.dm @@ -7,52 +7,59 @@ /proc/set_security_level(var/level) switch(level) if("green") - level = 0 + level = SEC_LEVEL_GREEN if("blue") - level = 1 + level = SEC_LEVEL_BLUE if("red") - level = 2 + level = SEC_LEVEL_RED if("delta") - level = 3 + level = SEC_LEVEL_DELTA - if(level >= 0 && level <= 3) + //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(0) + if(SEC_LEVEL_GREEN) world << "Attention! security level lowered to green" world << "All threats to the station have passed. Security may not have weapons visible, privacy laws are once again fully enforced." - security_level = 0 + security_level = SEC_LEVEL_GREEN for(var/obj/machinery/firealarm/FA in world) if(FA.z == 1) FA.overlays = list() FA.overlays += image('monitors.dmi', "overlay_green") - if(1) - if(security_level < 1) + if(SEC_LEVEL_BLUE) + if(security_level < SEC_LEVEL_BLUE) world << "Attention! security level elevated to blue" world << "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible, random searches are permitted." else world << "Attention! security level lowered to blue" world << "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." - security_level = 1 + security_level = SEC_LEVEL_BLUE for(var/obj/machinery/firealarm/FA in world) if(FA.z == 1) FA.overlays = list() FA.overlays += image('monitors.dmi', "overlay_blue") - if(2) - if(security_level < 2) + if(SEC_LEVEL_RED) + if(security_level < SEC_LEVEL_RED) world << "Attention! Code red!" world << "There is an immediate serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised." else world << "Attention! Code red!" world << "The self-destruct mechanism has been deactivated, there is still however an immediate serious threat to the station. Security may have weapons unholstered at all times, random searches are allowed and advised." - security_level = 2 + 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 == 1) FA.overlays = list() FA.overlays += image('monitors.dmi', "overlay_red") - if(3) + if(SEC_LEVEL_DELTA) world << "Attention! Delta security level reached!" world << "The ship'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." - security_level = 3 + security_level = SEC_LEVEL_DELTA for(var/obj/machinery/firealarm/FA in world) if(FA.z == 1) FA.overlays = list() @@ -62,15 +69,37 @@ /proc/get_security_level() switch(security_level) - if(0) + if(SEC_LEVEL_GREEN) return "green" - if(1) + if(SEC_LEVEL_BLUE) return "blue" - if(2) + if(SEC_LEVEL_RED) return "red" - if(3) + 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() diff --git a/code/setup.dm b/code/setup.dm index e5156e5f461..f44b75b5212 100644 --- a/code/setup.dm +++ b/code/setup.dm @@ -221,3 +221,9 @@ var/list/global_mutations = list() // list of hidden mutation things #define DROWSY "drowsy" var/static/list/scarySounds = list('thudswoosh.ogg','Taser.ogg','armbomb.ogg','hiss1.ogg','hiss2.ogg','hiss3.ogg','hiss4.ogg','hiss5.ogg','hiss6.ogg','Glassbr1.ogg','Glassbr2.ogg','Glassbr3.ogg','Welder.ogg','Welder2.ogg','airlock.ogg','clownstep1.ogg','clownstep2.ogg') + +//Security levels +#define SEC_LEVEL_GREEN 0 +#define SEC_LEVEL_BLUE 1 +#define SEC_LEVEL_RED 2 +#define SEC_LEVEL_DELTA 3 \ No newline at end of file