Skip to content

Commit

Permalink
function
Browse files Browse the repository at this point in the history
  • Loading branch information
realforest2001 committed Apr 20, 2024
1 parent c96b597 commit b426996
Show file tree
Hide file tree
Showing 7 changed files with 205 additions and 151 deletions.
4 changes: 4 additions & 0 deletions code/__DEFINES/ARES.dm
Original file line number Diff line number Diff line change
Expand Up @@ -82,3 +82,7 @@

/// Time until someone can respawn as Working Joe
#define JOE_JOIN_DEAD_TIME (15 MINUTES)

/// Lockdown defines
#define ARES_LOCKDOWN_READY 0
#define ARES_LOCKDOWN_ACTIVE 1
4 changes: 4 additions & 0 deletions code/game/machinery/ARES/ARES_procs.dm
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,13 @@ GLOBAL_LIST_INIT(maintenance_categories, list(
/// Is nuke request usable or not?
var/nuke_available = TRUE

/// Status of the AI Core Lockdown
var/ai_lockdown_state = ARES_LOCKDOWN_READY

COOLDOWN_DECLARE(ares_distress_cooldown)
COOLDOWN_DECLARE(ares_nuclear_cooldown)
COOLDOWN_DECLARE(ares_quarters_cooldown)
COOLDOWN_DECLARE(aicore_lockdown)

// ------ ARES Logging Procs ------ //
/proc/ares_is_active()
Expand Down
47 changes: 24 additions & 23 deletions code/game/machinery/aicore_lockdown.dm
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
#define LOCKDOWN_READY 0
#define LOCKDOWN_ACTIVE 1
GLOBAL_VAR_INIT(ai_lockdown_state, LOCKDOWN_READY)

/obj/structure/machinery/aicore_lockdown
name = "Emergency Containment Breach"
name = "AI Core Lockdown"
icon_state = "big_red_button_tablev"
unslashable = TRUE
unacidable = TRUE
COOLDOWN_DECLARE(containment_lockdown)

/obj/structure/machinery/aicore_lockdown/ex_act(severity)
return FALSE
Expand All @@ -29,30 +24,37 @@ GLOBAL_VAR_INIT(ai_lockdown_state, LOCKDOWN_READY)
flick(initial(icon_state) + "-denied", src)
return FALSE

if(!COOLDOWN_FINISHED(src, containment_lockdown))
to_chat(user, SPAN_BOLDWARNING("AI Core Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(src, containment_lockdown)] seconds!"))
if(!COOLDOWN_FINISHED(GLOB.ares_datacore, aicore_lockdown))
to_chat(user, SPAN_BOLDWARNING("AI Core Lockdown procedures are on cooldown! They will be ready in [COOLDOWN_SECONDSLEFT(GLOB.ares_datacore, aicore_lockdown)] seconds!"))
return FALSE

add_fingerprint(user)
aicore_lockdown(user)
COOLDOWN_START(src, containment_lockdown, 5 MINUTES)
COOLDOWN_START(GLOB.ares_datacore, aicore_lockdown, 2 MINUTES)

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown
name = "ARES Emergency Lockdown Shutter"
density = FALSE
open_layer = 1.9
plane = FLOOR_PLANE

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown/aicore
icon_state = "aidoor1"
base_icon_state = "aidoor"

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown/aicore/white
icon_state = "w_aidoor1"
base_icon_state = "w_aidoor"

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown/white
icon_state = "w_almayer_pdoor1"
base_icon_state = "w_almayer_pdoor"

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown/Initialize()
. = ..()
RegisterSignal(SSdcs, COMSIG_GLOB_AICORE_LOCKDOWN, PROC_REF(close))
RegisterSignal(SSdcs, COMSIG_GLOB_AICORE_LIFT, PROC_REF(open))

/obj/structure/machinery/door/poddoor/almayer/blended/ai_lockdown/white
icon_state = "w_almayer_pdoor1"
base_icon_state = "w_almayer_pdoor"

/client/proc/admin_aicore_alert()
set name = "AI Core Lockdown"
Expand All @@ -77,7 +79,7 @@ GLOBAL_VAR_INIT(ai_lockdown_state, LOCKDOWN_READY)
if(IsAdminAdvancedProcCall())
return PROC_BLOCKED

var/log = "[key_name(user)] triggered research AI core lockdown!"
var/log = "[key_name(user)] triggered AI core lockdown!"
var/ares_log = "[user.name] triggered triggered AI Core Emergency Lockdown."
if(!message)
message = "ATTENTION! \n\nCORE SECURITY ALERT. \n\nAI CORE UNDER LOCKDOWN."
Expand All @@ -87,26 +89,25 @@ GLOBAL_VAR_INIT(ai_lockdown_state, LOCKDOWN_READY)
log += " (Admin Triggered)."
ares_log = "[MAIN_AI_SYSTEM] triggered AI Core Emergency Lockdown."

switch(GLOB.ai_lockdown_state)
if(LOCKDOWN_READY)
GLOB.ai_lockdown_state = LOCKDOWN_ACTIVE
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
switch(GLOB.ares_datacore.ai_lockdown_state)
if(ARES_LOCKDOWN_READY)
GLOB.ares_datacore.ai_lockdown_state = ARES_LOCKDOWN_ACTIVE
if(GLOB.security_level < SEC_LEVEL_RED)
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_AICORE_LOCKDOWN)
if(LOCKDOWN_ACTIVE)
GLOB.ai_lockdown_state = LOCKDOWN_READY
if(ARES_LOCKDOWN_ACTIVE)
GLOB.ares_datacore.ai_lockdown_state = ARES_LOCKDOWN_READY
message = "ATTENTION! \n\nAI CORE EMERGENCY LOCKDOWN LIFTED."
log = "[key_name(user)] lifted AI core lockdown!"
ares_log = "[user.name] lifted AI Core Emergency Lockdown."
if(admin)
log += " (Admin Triggered)."
ares_log = "[MAIN_AI_SYSTEM] lifted AI Core Emergency Lockdown."

set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
if(GLOB.security_level > SEC_LEVEL_GREEN)
set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_AICORE_LIFT)

shipwide_ai_announcement(message, MAIN_AI_SYSTEM, 'sound/effects/biohazard.ogg')
message_admins(log)
log_ares_security("AI Core Lockdown", ares_log)

#undef LOCKDOWN_READY
#undef LOCKDOWN_ACTIVE
6 changes: 4 additions & 2 deletions code/game/machinery/biohazard_lockdown.dm
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ GLOBAL_VAR_INIT(med_lockdown_state, LOCKDOWN_READY)
switch(GLOB.med_lockdown_state)
if(LOCKDOWN_READY)
GLOB.med_lockdown_state = LOCKDOWN_ACTIVE
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
if(GLOB.security_level < SEC_LEVEL_RED)
set_security_level(SEC_LEVEL_RED, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_RESEARCH_LOCKDOWN)
if(LOCKDOWN_ACTIVE)
GLOB.med_lockdown_state = LOCKDOWN_READY
Expand All @@ -97,7 +98,8 @@ GLOBAL_VAR_INIT(med_lockdown_state, LOCKDOWN_READY)
log += " (Admin Triggered)."
ares_log = "[MAIN_AI_SYSTEM] lifted Medical Research Biohazard Containment Lockdown."

set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
if(GLOB.security_level > SEC_LEVEL_GREEN)
set_security_level(SEC_LEVEL_BLUE, TRUE, FALSE)
SEND_GLOBAL_SIGNAL(COMSIG_GLOB_RESEARCH_LIFT)

shipwide_ai_announcement(message, MAIN_AI_SYSTEM, 'sound/effects/biohazard.ogg')
Expand Down
9 changes: 9 additions & 0 deletions code/game/turfs/floor_types.dm
Original file line number Diff line number Diff line change
Expand Up @@ -331,6 +331,15 @@
. = ..()
set_light_on(TRUE)

RegisterSignal(SSdcs, COMSIG_GLOB_AICORE_LOCKDOWN, PROC_REF(start_emergency_light_on))
RegisterSignal(SSdcs, COMSIG_GLOB_AICORE_LIFT, PROC_REF(start_emergency_light_off))

/turf/open/floor/almayer/aicore/glowing/proc/start_emergency_light_on()
set_light(l_color = "#c70f0f")

/turf/open/floor/almayer/aicore/glowing/proc/start_emergency_light_off()
set_light(l_color = "#d69c46")

/turf/open/floor/almayer/aicore/no_build
allow_construction = FALSE
hull_floor = TRUE
Expand Down
Binary file modified icons/obj/structures/doors/blastdoors_shutters.dmi
Binary file not shown.
Loading

0 comments on commit b426996

Please sign in to comment.