mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2025-12-20 15:21:29 +00:00
Refactor: refactor security levels (#21899)
* refactor: datumize security levels * refactor: implement `SSsecurity_level` for handling security level related stuff * feat: returns back old `delta_alarm` sound * refactor: adjust existing code to use `SSsecurity_level` * fix: remove redundunt new init order * fix: fix type in var * refactor: apply reviewer changes * fix: replace `can_fire=FALSE` with `ss_flags = SS_NO_FIRE`, as subsystem will never fire * fix: use `flags` instead of `ss_flags` for subsystem Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com> * fix: replace old security level interactions * feat: implement `Recover` proc for `SSsecurity_level` * refactor: add clearer doc for `security_level_set_timer_id` propery of `SSsecurirt_level` * refactor: swap `security_level` datum properties to make it clearer to read * refactor: move initialization code from `New` to `Initialize` for `/obj/machinery/firealarm` * fix: revert back `delta_alarm` annoing sound, use `delta_claxon` on change to delta security level --------- Co-authored-by: SteelSlayer <42044220+SteelSlayer@users.noreply.github.com>
This commit is contained in:
@@ -63,6 +63,11 @@
|
||||
|
||||
if(1)
|
||||
if(check_rights((R_EVENT|R_SERVER),0))
|
||||
var/security_levels_data = ""
|
||||
for (var/level_name in SSsecurity_level.available_levels)
|
||||
var/datum/security_level/this_level = SSsecurity_level.available_levels[level_name]
|
||||
security_levels_data += "<a href='?src=[UID()];secretsfun=securitylevel;number=[this_level.number_level]'>[this_level.name]</a>"
|
||||
|
||||
dat += {"
|
||||
<center>
|
||||
<h2><B>IC Events</B></h2>
|
||||
@@ -72,12 +77,7 @@
|
||||
<BR><A href='?src=[UID()];secretsfun=deathsquad'>Send in the Deathsquad</A>
|
||||
<A href='?src=[UID()];secretsfun=gimmickteam'>Send in a Gimmick Team</A><BR>
|
||||
<b>Change Security Level</b><BR>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel0'>Security Level - Green</A>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel1'>Security Level - Blue</A>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel2'>Security Level - Red</A><br>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel3'>Security Level - Gamma</A>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel4'>Security Level - Epsilon</A>
|
||||
<A href='?src=[UID()];secretsfun=securitylevel5'>Security Level - Delta</A><BR>
|
||||
[security_levels_data]<BR>
|
||||
<b>Create Weather</b><BR>
|
||||
<A href='?src=[UID()];secretsfun=weatherashstorm'>Weather - Ash Storm</A>
|
||||
<BR>
|
||||
|
||||
@@ -3123,24 +3123,10 @@
|
||||
if(confirmation == "No")
|
||||
return
|
||||
makeThunderdomeTeams()
|
||||
if("securitylevel0")
|
||||
set_security_level(0)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Green.</span>", 1)
|
||||
if("securitylevel1")
|
||||
set_security_level(1)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Blue.</span>", 1)
|
||||
if("securitylevel2")
|
||||
set_security_level(2)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Red.</span>", 1)
|
||||
if("securitylevel3")
|
||||
set_security_level(3)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Gamma.</span>", 1)
|
||||
if("securitylevel4")
|
||||
set_security_level(4)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Epsilon.</span>", 1)
|
||||
if("securitylevel5")
|
||||
set_security_level(5)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to Delta.</span>", 1)
|
||||
if("securitylevel")
|
||||
var/level_number = text2num(href_list["number"])
|
||||
SSsecurity_level.set_level(level_number)
|
||||
message_admins("<span class='notice'>[key_name_admin(usr)] change security level to [SSsecurity_level.number_level_to_text(level_number)].</span>")
|
||||
if("moveminingshuttle")
|
||||
SSblackbox.record_feedback("tally", "admin_secrets_fun_used", 1, "Send Mining Shuttle")
|
||||
if(!SSshuttle.toggleShuttle("mining","mining_home","mining_away"))
|
||||
|
||||
@@ -848,7 +848,7 @@ Traitors and the like can also be revived with the previous role mostly intact.
|
||||
else
|
||||
SSshuttle.emergency.canRecall = FALSE
|
||||
|
||||
if(seclevel2num(get_security_level()) >= SEC_LEVEL_RED)
|
||||
if(SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED)
|
||||
SSshuttle.emergency.request(coefficient = 0.5, redAlert = TRUE)
|
||||
else
|
||||
SSshuttle.emergency.request()
|
||||
|
||||
@@ -15,7 +15,7 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
|
||||
|
||||
/datum/event/traders/fake_announce()
|
||||
. = TRUE
|
||||
if(seclevel2num(get_security_level()) >= SEC_LEVEL_RED)
|
||||
if(SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED)
|
||||
GLOB.minor_announcement.Announce("A trading shuttle from Jupiter Station has been denied docking permission due to the heightened security alert aboard [station_name()].", "Trader Shuttle Docking Request Refused")
|
||||
return
|
||||
GLOB.minor_announcement.Announce("A trading shuttle from Jupiter Station has been granted docking permission at [station_name()] arrivals port 4.", "Trader Shuttle Docking Request Accepted")
|
||||
@@ -24,7 +24,7 @@ GLOBAL_LIST_INIT(unused_trade_stations, list("sol"))
|
||||
/datum/event/traders/start()
|
||||
if(!station) // If there are no unused stations, just no.
|
||||
return
|
||||
if(seclevel2num(get_security_level()) >= SEC_LEVEL_RED)
|
||||
if(SSsecurity_level.get_current_level_as_number() >= SEC_LEVEL_RED)
|
||||
GLOB.minor_announcement.Announce("A trading shuttle from Jupiter Station has been denied docking permission due to the heightened security alert aboard [station_name()].", "Trader Shuttle Docking Request Refused")
|
||||
// if the docking request was refused, fire another major event in 60 seconds
|
||||
var/datum/event_container/EC = SSevents.event_containers[EVENT_LEVEL_MAJOR]
|
||||
|
||||
@@ -16,7 +16,7 @@
|
||||
SSshuttle.autoEvac()
|
||||
|
||||
if(nuking)
|
||||
set_security_level("red")
|
||||
SSsecurity_level.set_level(SEC_LEVEL_RED)
|
||||
nuking = FALSE
|
||||
for(var/obj/item/pinpointer/point in GLOB.pinpointer_list)
|
||||
point.the_disk = null //Point back to the disk.
|
||||
|
||||
@@ -446,7 +446,7 @@
|
||||
|
||||
var/dat = "<html><body><center>"
|
||||
dat += "Round Duration: [round(hours)]h [round(mins)]m<br>"
|
||||
dat += "<b>The station alert level is: [get_security_level_colors()]</b><br>"
|
||||
dat += "<b>The station alert level is: [SSsecurity_level.get_colored_current_security_level_name()]</b><br>"
|
||||
|
||||
if(SSshuttle.emergency.mode >= SHUTTLE_ESCAPE)
|
||||
dat += "<font color='red'><b>The station has been evacuated.</b></font><br>"
|
||||
|
||||
@@ -49,7 +49,7 @@
|
||||
var/datum/action/innate/ai/return_to_core/R = new
|
||||
R.Grant(occupier)
|
||||
occupier.cancel_camera()
|
||||
if((seclevel2num(get_security_level()) == SEC_LEVEL_DELTA) && malf.nuking)
|
||||
if((SSsecurity_level.get_current_level_as_number() == SEC_LEVEL_DELTA) && malf.nuking)
|
||||
for(var/obj/item/pinpointer/point in GLOB.pinpointer_list)
|
||||
point.the_disk = src //the pinpointer will detect the shunted AI
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
occupier.parent.adjustOxyLoss(occupier.getOxyLoss())
|
||||
occupier.parent.cancel_camera()
|
||||
qdel(occupier)
|
||||
if(seclevel2num(get_security_level()) == SEC_LEVEL_DELTA)
|
||||
if(SSsecurity_level.get_current_level_as_number() == SEC_LEVEL_DELTA)
|
||||
for(var/obj/item/pinpointer/point in GLOB.pinpointer_list)
|
||||
for(var/mob/living/silicon/ai/A in GLOB.ai_list)
|
||||
if((A.stat != DEAD) && A.nuking)
|
||||
|
||||
@@ -256,6 +256,11 @@
|
||||
// create a new lighting fixture
|
||||
/obj/machinery/light/Initialize(mapload)
|
||||
. = ..()
|
||||
|
||||
if(is_station_level(z))
|
||||
RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGE_PLANNED, PROC_REF(on_security_level_change_planned))
|
||||
RegisterSignal(SSsecurity_level, COMSIG_SECURITY_LEVEL_CHANGED, PROC_REF(on_security_level_update))
|
||||
|
||||
var/area/A = get_area(src)
|
||||
if(A && !A.requires_power)
|
||||
on = TRUE
|
||||
@@ -272,11 +277,39 @@
|
||||
break_light_tube(TRUE)
|
||||
update(FALSE, TRUE, FALSE)
|
||||
|
||||
/obj/machinery/light/proc/on_security_level_change_planned(datum/source, previous_level_number, new_level_number)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(status != LIGHT_OK)
|
||||
return
|
||||
|
||||
if(new_level_number == SEC_LEVEL_EPSILON)
|
||||
fire_mode = FALSE
|
||||
emergency_mode = TRUE
|
||||
on = FALSE
|
||||
INVOKE_ASYNC(src, PROC_REF(update), FALSE)
|
||||
|
||||
/obj/machinery/light/proc/on_security_level_update(datum/source, previous_level_number, new_level_number)
|
||||
SIGNAL_HANDLER
|
||||
|
||||
if(status != LIGHT_OK)
|
||||
return
|
||||
|
||||
if(new_level_number >= SEC_LEVEL_EPSILON)
|
||||
fire_mode = TRUE
|
||||
emergency_mode = TRUE
|
||||
on = FALSE
|
||||
else
|
||||
fire_mode = FALSE
|
||||
emergency_mode = FALSE
|
||||
on = TRUE
|
||||
|
||||
INVOKE_ASYNC(src, PROC_REF(update), FALSE)
|
||||
|
||||
/obj/machinery/light/Destroy()
|
||||
var/area/A = get_area(src)
|
||||
if(A)
|
||||
on = FALSE
|
||||
// A.update_lights()
|
||||
return ..()
|
||||
|
||||
/obj/machinery/light/update_icon_state()
|
||||
|
||||
@@ -95,7 +95,7 @@
|
||||
|
||||
/obj/machinery/keycard_auth/ui_data()
|
||||
var/list/data = list()
|
||||
data["redAvailable"] = GLOB.security_level == SEC_LEVEL_RED ? FALSE : TRUE
|
||||
data["redAvailable"] = SSsecurity_level.get_current_level_as_number() != SEC_LEVEL_RED
|
||||
data["swiping"] = swiping
|
||||
data["busy"] = busy
|
||||
data["event"] = active && event_source && event_source.event ? event_source.event : event
|
||||
@@ -172,7 +172,7 @@
|
||||
SHOULD_NOT_SLEEP(TRUE) // trigger_armed_response_team sleeps, which can cause issues for procs that call trigger_event(). We want to avoid that
|
||||
switch(event)
|
||||
if("Red Alert")
|
||||
INVOKE_ASYNC(GLOBAL_PROC, GLOBAL_PROC_REF(set_security_level), SEC_LEVEL_RED)
|
||||
INVOKE_ASYNC(SSsecurity_level, TYPE_PROC_REF(/datum/controller/subsystem/security_level, set_level), SEC_LEVEL_RED)
|
||||
if("Grant Emergency Maintenance Access")
|
||||
make_maint_all_access()
|
||||
if("Revoke Emergency Maintenance Access")
|
||||
|
||||
145
code/modules/security_levels/security_level_datums.dm
Normal file
145
code/modules/security_levels/security_level_datums.dm
Normal file
@@ -0,0 +1,145 @@
|
||||
/**
|
||||
* Security levels
|
||||
*
|
||||
* These are used by the security level subsystem. Each one of these represents a security level that a player can set.
|
||||
*
|
||||
* Base type is abstract
|
||||
*/
|
||||
/datum/security_level
|
||||
/// The name of this security level.
|
||||
var/name = "Not set."
|
||||
/// The numerical level of this security level, see defines for more information.
|
||||
var/number_level = -1
|
||||
/// The delay, after which the security level will be set
|
||||
var/set_delay = 0
|
||||
/// The sound that we will play when elevated to this security level
|
||||
var/elevating_to_sound
|
||||
/// The sound that we will play when lowered to this security level
|
||||
var/lowering_to_sound
|
||||
/// The AI announcement sound about code change, that will be played after main sound
|
||||
var/ai_announcement_sound
|
||||
/// Color of security level
|
||||
var/color
|
||||
/// The status display that will be posted to all status displays on security level set
|
||||
var/status_display_mode = STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME
|
||||
/// The status display data that will be posted to all status displays on security level set
|
||||
var/status_display_data = ""
|
||||
/// Our announcement title when lowering to this level
|
||||
var/lowering_to_announcement_title = "Not set."
|
||||
/// Our announcement when lowering to this level
|
||||
var/lowering_to_announcement_text = "Not set."
|
||||
/// Our announcement title when elevating to this level
|
||||
var/elevating_to_announcement_title = "Not set."
|
||||
/// Our announcement when elevating to this level
|
||||
var/elevating_to_announcement_text = "Not set."
|
||||
|
||||
/**
|
||||
* Should contain actions that must be completed before actual security level set
|
||||
*/
|
||||
/datum/security_level/proc/pre_change()
|
||||
return
|
||||
|
||||
/**
|
||||
* GREEN
|
||||
*
|
||||
* No threats
|
||||
*/
|
||||
/datum/security_level/green
|
||||
name = "green"
|
||||
number_level = SEC_LEVEL_GREEN
|
||||
ai_announcement_sound = 'sound/AI/green.ogg'
|
||||
color = "limegreen"
|
||||
lowering_to_announcement_title = "Attention! Security level lowered to Green."
|
||||
lowering_to_announcement_text = "All threats to the station have passed. All weapons need to be holstered and privacy laws are once again fully enforced."
|
||||
|
||||
/**
|
||||
* BLUE
|
||||
*
|
||||
* Caution advised
|
||||
*/
|
||||
/datum/security_level/blue
|
||||
name = "blue"
|
||||
number_level = SEC_LEVEL_BLUE
|
||||
elevating_to_sound = 'sound/misc/notice1.ogg'
|
||||
ai_announcement_sound = 'sound/AI/blue.ogg'
|
||||
color = "dodgerblue"
|
||||
lowering_to_announcement_title = "Attention! Security level lowered to Blue."
|
||||
lowering_to_announcement_text = "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."
|
||||
elevating_to_announcement_title = "Attention! Security level elevated to Blue."
|
||||
elevating_to_announcement_text = "The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible and random searches are permitted."
|
||||
|
||||
/**
|
||||
* RED
|
||||
*
|
||||
* Hostile threats
|
||||
*/
|
||||
/datum/security_level/red
|
||||
name = "red"
|
||||
number_level = SEC_LEVEL_RED
|
||||
elevating_to_sound = 'sound/misc/notice1.ogg'
|
||||
ai_announcement_sound = 'sound/AI/red.ogg'
|
||||
color = "red"
|
||||
status_display_mode = STATUS_DISPLAY_ALERT
|
||||
status_display_data = "redalert"
|
||||
lowering_to_announcement_title = "Attention! Code Red!"
|
||||
lowering_to_announcement_text = "The station's self-destruct mechanism has been deactivated, but there is still an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised."
|
||||
elevating_to_announcement_title = "Attention! Code Red!"
|
||||
elevating_to_announcement_text = "There is an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised."
|
||||
|
||||
/**
|
||||
* Gamma
|
||||
*
|
||||
* Station major hostile threats
|
||||
*/
|
||||
/datum/security_level/gamma
|
||||
name = "gamma"
|
||||
number_level = SEC_LEVEL_GAMMA
|
||||
lowering_to_sound = 'sound/effects/new_siren.ogg'
|
||||
elevating_to_sound = 'sound/effects/new_siren.ogg'
|
||||
ai_announcement_sound = 'sound/AI/gamma.ogg'
|
||||
color = "gold"
|
||||
status_display_mode = STATUS_DISPLAY_ALERT
|
||||
status_display_data = "gammaalert"
|
||||
lowering_to_announcement_title = "Attention! Gamma security level activated!"
|
||||
lowering_to_announcement_text = "Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location."
|
||||
elevating_to_announcement_text = "Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location."
|
||||
elevating_to_announcement_title = "Attention! Gamma security level activated!"
|
||||
|
||||
/**
|
||||
* Epsilon
|
||||
*
|
||||
* Station is not longer under the Central Command and to be destroyed by Death Squad (Or maybe not)
|
||||
*/
|
||||
/datum/security_level/epsilon
|
||||
name = "epsilon"
|
||||
number_level = SEC_LEVEL_EPSILON
|
||||
set_delay = 15 SECONDS
|
||||
lowering_to_sound = 'sound/effects/purge_siren.ogg'
|
||||
elevating_to_sound = 'sound/effects/purge_siren.ogg'
|
||||
ai_announcement_sound = 'sound/AI/epsilon.ogg'
|
||||
color = "blueviolet"
|
||||
status_display_mode = STATUS_DISPLAY_ALERT
|
||||
status_display_data = "epsilonalert"
|
||||
lowering_to_announcement_title = "Attention! Epsilon security level activated!"
|
||||
lowering_to_announcement_text = "Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated."
|
||||
elevating_to_announcement_title = "Attention! Epsilon security level activated!"
|
||||
elevating_to_announcement_text = "Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated."
|
||||
|
||||
/datum/security_level/epsilon/pre_change()
|
||||
sound_to_playing_players_on_station_level(S = sound('sound/effects/powerloss.ogg'))
|
||||
|
||||
/**
|
||||
* DELTA
|
||||
*
|
||||
* Station self-destruiction mechanism has been engaged
|
||||
*/
|
||||
/datum/security_level/delta
|
||||
name = "delta"
|
||||
number_level = SEC_LEVEL_DELTA
|
||||
elevating_to_sound = 'sound/effects/delta_klaxon.ogg'
|
||||
ai_announcement_sound = 'sound/AI/delta.ogg'
|
||||
color = "orangered"
|
||||
status_display_mode = STATUS_DISPLAY_ALERT
|
||||
status_display_data = "deltaalert"
|
||||
elevating_to_announcement_title = "Attention! Delta security level reached!"
|
||||
elevating_to_announcement_text = "The station'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."
|
||||
@@ -1,225 +0,0 @@
|
||||
GLOBAL_VAR_INIT(security_level, 0)
|
||||
//0 = code green
|
||||
//1 = code blue
|
||||
//2 = code red
|
||||
//3 = gamma
|
||||
//4 = epsilon
|
||||
//5 = code delta
|
||||
|
||||
//config.alert_desc_blue_downto
|
||||
GLOBAL_DATUM_INIT(security_announcement, /datum/announcer, new(config_type = /datum/announcement_configuration/security))
|
||||
|
||||
/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("gamma")
|
||||
level = SEC_LEVEL_GAMMA
|
||||
if("epsilon")
|
||||
level = SEC_LEVEL_EPSILON
|
||||
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)
|
||||
if(level >= SEC_LEVEL_RED && GLOB.security_level < SEC_LEVEL_RED)
|
||||
// Mark down this time to prevent shuttle cheese
|
||||
SSshuttle.emergency_sec_level_time = world.time
|
||||
|
||||
switch(level)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
GLOB.security_announcement.Announce("All threats to the station have passed. All weapons need to be holstered and privacy laws are once again fully enforced.","Attention! Security level lowered to green.", new_sound2 = 'sound/AI/green.ogg')
|
||||
GLOB.security_level = SEC_LEVEL_GREEN
|
||||
unset_stationwide_emergency_lighting()
|
||||
post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME)
|
||||
update_firealarms()
|
||||
|
||||
if(SEC_LEVEL_BLUE)
|
||||
if(GLOB.security_level < SEC_LEVEL_BLUE)
|
||||
GLOB.security_announcement.Announce("The station has received reliable information about possible hostile activity on the station. Security staff may have weapons visible and random searches are permitted.", "Attention! Security level elevated to blue.",
|
||||
new_sound = 'sound/misc/notice1.ogg',
|
||||
new_sound2 = 'sound/AI/blue.ogg')
|
||||
else
|
||||
GLOB.security_announcement.Announce("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.", "Attention! Security level lowered to blue.", new_sound2 = 'sound/AI/blue.ogg')
|
||||
GLOB.security_level = SEC_LEVEL_BLUE
|
||||
|
||||
post_status(STATUS_DISPLAY_TRANSFER_SHUTTLE_TIME)
|
||||
unset_stationwide_emergency_lighting()
|
||||
update_firealarms()
|
||||
|
||||
if(SEC_LEVEL_RED)
|
||||
if(GLOB.security_level < SEC_LEVEL_RED)
|
||||
GLOB.security_announcement.Announce("There is an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.", "Attention! Code Red!",
|
||||
new_sound = 'sound/misc/notice1.ogg',
|
||||
new_sound2 = 'sound/AI/red.ogg')
|
||||
else
|
||||
GLOB.security_announcement.Announce("The station's self-destruct mechanism has been deactivated, but there is still an immediate and serious threat to the station. Security may have weapons unholstered at all times. Random searches are allowed and advised.", "Attention! Code Red!", new_sound2 = 'sound/AI/red.ogg')
|
||||
unset_stationwide_emergency_lighting()
|
||||
GLOB.security_level = SEC_LEVEL_RED
|
||||
|
||||
var/obj/machinery/door/airlock/highsecurity/red/R = locate(/obj/machinery/door/airlock/highsecurity/red) in GLOB.airlocks
|
||||
if(R && is_station_level(R.z))
|
||||
R.unlock(TRUE)
|
||||
|
||||
post_status(STATUS_DISPLAY_ALERT, "redalert")
|
||||
update_firealarms()
|
||||
|
||||
if(SEC_LEVEL_GAMMA)
|
||||
GLOB.security_announcement.Announce("Central Command has ordered the Gamma security level on the station. Security is to have weapons equipped at all times, and all civilians are to immediately seek their nearest head for transportation to a secure location.", "Attention! Gamma security level activated!", 'sound/effects/new_siren.ogg', new_sound2 = 'sound/AI/gamma.ogg')
|
||||
GLOB.security_level = SEC_LEVEL_GAMMA
|
||||
|
||||
if(GLOB.security_level < SEC_LEVEL_RED)
|
||||
for(var/obj/machinery/door/airlock/highsecurity/red/R in GLOB.airlocks)
|
||||
if(is_station_level(R.z))
|
||||
R.unlock(TRUE)
|
||||
|
||||
post_status(STATUS_DISPLAY_ALERT, "gammaalert")
|
||||
update_firealarms()
|
||||
|
||||
if(SEC_LEVEL_EPSILON)
|
||||
for(var/mob/M in GLOB.player_list)
|
||||
var/turf/T = get_turf(M)
|
||||
if(!M.client || !is_station_level(T.z))
|
||||
continue
|
||||
SEND_SOUND(M, sound('sound/effects/powerloss.ogg'))
|
||||
set_stationwide_emergency_lighting()
|
||||
addtimer(CALLBACK(GLOBAL_PROC, GLOBAL_PROC_REF(epsilon_process)), 15 SECONDS)
|
||||
SSblackbox.record_feedback("tally", "security_level_changes", 1, level)
|
||||
return
|
||||
|
||||
if(SEC_LEVEL_DELTA)
|
||||
var/temp_sound = GLOB.security_announcement.config.sound
|
||||
GLOB.security_announcement.config.sound = null
|
||||
GLOB.security_announcement.Announce("The station'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.","Attention! Delta security level reached!",
|
||||
new_sound = 'sound/effects/delta_klaxon.ogg',
|
||||
new_sound2 = 'sound/AI/delta.ogg')
|
||||
GLOB.security_announcement.config.sound = temp_sound
|
||||
GLOB.security_level = SEC_LEVEL_DELTA
|
||||
post_status(STATUS_DISPLAY_ALERT, "deltaalert")
|
||||
update_firealarms()
|
||||
set_stationwide_emergency_lighting()
|
||||
SSblackbox.record_feedback("tally", "security_level_changes", 1, level)
|
||||
return
|
||||
|
||||
SSnightshift.check_nightshift(TRUE)
|
||||
SSblackbox.record_feedback("tally", "security_level_changes", 1, level)
|
||||
|
||||
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_GAMMA)
|
||||
return "gamma"
|
||||
if(SEC_LEVEL_EPSILON)
|
||||
return "epsilon"
|
||||
if(SEC_LEVEL_DELTA)
|
||||
return "delta"
|
||||
|
||||
/proc/update_firealarms()
|
||||
for(var/obj/machinery/firealarm/FA in GLOB.machines)
|
||||
if(is_station_contact(FA.z))
|
||||
FA.update_icon()
|
||||
FA.update_fire_light()
|
||||
|
||||
/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_GAMMA)
|
||||
return "gamma"
|
||||
if(SEC_LEVEL_EPSILON)
|
||||
return "epsilon"
|
||||
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("gamma")
|
||||
return SEC_LEVEL_GAMMA
|
||||
if("epsilon")
|
||||
return SEC_LEVEL_EPSILON
|
||||
if("delta")
|
||||
return SEC_LEVEL_DELTA
|
||||
|
||||
/proc/get_security_level_colors()
|
||||
switch(GLOB.security_level)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
return "<font color='limegreen'>Green</font>"
|
||||
if(SEC_LEVEL_BLUE)
|
||||
return "<font color='dodgerblue'>Blue</font>"
|
||||
if(SEC_LEVEL_RED)
|
||||
return "<font color='red'>Red</font>"
|
||||
if(SEC_LEVEL_GAMMA)
|
||||
return "<font color='gold'>Gamma</font>"
|
||||
if(SEC_LEVEL_EPSILON)
|
||||
return "<font color='blueviolet'>Epsilon</font>"
|
||||
if(SEC_LEVEL_DELTA)
|
||||
return "<font color='orangered'>Delta</font>"
|
||||
|
||||
/proc/set_stationwide_emergency_lighting()
|
||||
for(var/obj/machinery/power/apc/A in GLOB.apcs)
|
||||
var/area/AR = get_area(A)
|
||||
if(!is_station_level(A.z))
|
||||
continue
|
||||
A.emergency_lights = FALSE
|
||||
AR.area_emergency_mode = TRUE
|
||||
for(var/obj/machinery/light/L in A.apc_area)
|
||||
if(L.status)
|
||||
continue
|
||||
if(GLOB.security_level == SEC_LEVEL_DELTA)
|
||||
L.fire_mode = TRUE
|
||||
L.on = FALSE
|
||||
L.emergency_mode = TRUE
|
||||
INVOKE_ASYNC(L, TYPE_PROC_REF(/obj/machinery/light, update), FALSE)
|
||||
|
||||
/proc/unset_stationwide_emergency_lighting()
|
||||
for(var/area/A as anything in GLOB.all_areas)
|
||||
if(!is_station_level(A.z))
|
||||
continue
|
||||
if(!A.area_emergency_mode)
|
||||
continue
|
||||
A.area_emergency_mode = FALSE
|
||||
for(var/obj/machinery/light/L in A)
|
||||
if(A.fire)
|
||||
continue
|
||||
if(L.status)
|
||||
continue
|
||||
L.fire_mode = FALSE
|
||||
L.emergency_mode = FALSE
|
||||
L.on = TRUE
|
||||
INVOKE_ASYNC(L, TYPE_PROC_REF(/obj/machinery/light, update), FALSE)
|
||||
|
||||
/proc/epsilon_process()
|
||||
GLOB.security_announcement.Announce("Central Command has ordered the Epsilon security level on the station. Consider all contracts terminated.", "Attention! Epsilon security level activated!", 'sound/effects/purge_siren.ogg')
|
||||
GLOB.security_level = SEC_LEVEL_EPSILON
|
||||
post_status(STATUS_DISPLAY_ALERT, "epsilonalert")
|
||||
for(var/area/A as anything in GLOB.all_areas)
|
||||
if(!is_station_level(A.z))
|
||||
continue
|
||||
for(var/obj/machinery/light/L in A)
|
||||
if(L.status)
|
||||
continue
|
||||
L.fire_mode = TRUE
|
||||
L.update()
|
||||
update_firealarms()
|
||||
@@ -20,18 +20,9 @@
|
||||
|
||||
/datum/ui_module/ert_manager/ui_data(mob/user)
|
||||
var/list/data = list()
|
||||
data["str_security_level"] = capitalize(get_security_level())
|
||||
switch(GLOB.security_level)
|
||||
if(SEC_LEVEL_GREEN)
|
||||
data["security_level_color"] = "green"
|
||||
if(SEC_LEVEL_BLUE)
|
||||
data["security_level_color"] = "blue"
|
||||
if(SEC_LEVEL_RED)
|
||||
data["security_level_color"] = "red"
|
||||
else
|
||||
data["security_level_color"] = "purple"
|
||||
data["str_security_level"] = capitalize(SSsecurity_level.get_current_level_as_text())
|
||||
data["security_level_color"] = SSsecurity_level.current_security_level.color
|
||||
data["ert_request_answered"] = GLOB.ert_request_answered
|
||||
|
||||
data["ert_type"] = ert_type
|
||||
data["com"] = commander_slots
|
||||
data["sec"] = security_slots
|
||||
|
||||
@@ -37,12 +37,12 @@
|
||||
ai_announcer.author = "AI-NAME-0345"
|
||||
ai_announcer.Announce("AI only get one input box so here ya go")
|
||||
|
||||
set_security_level(SEC_LEVEL_RED)
|
||||
set_security_level(SEC_LEVEL_GAMMA)
|
||||
set_security_level(SEC_LEVEL_EPSILON)
|
||||
set_security_level(SEC_LEVEL_RED)
|
||||
set_security_level(SEC_LEVEL_BLUE)
|
||||
set_security_level(SEC_LEVEL_GREEN)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_RED)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_GAMMA)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_EPSILON)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_RED)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_BLUE)
|
||||
SSsecurity_level.set_level(SEC_LEVEL_GREEN)
|
||||
|
||||
var/reason = "We're getting the fuck out of here"
|
||||
var/redAlert = TRUE
|
||||
|
||||
@@ -47,7 +47,7 @@
|
||||
if(key_valid)
|
||||
if(SSticker.mode)
|
||||
status_info["real_mode"] = SSticker.mode.name
|
||||
status_info["security_level"] = get_security_level()
|
||||
status_info["security_level"] = SSsecurity_level.get_current_level_as_text()
|
||||
status_info["ticker_state"] = SSticker.current_state
|
||||
|
||||
if(SSshuttle.emergency)
|
||||
|
||||
Reference in New Issue
Block a user