diff --git a/code/__DEFINES/shuttles.dm b/code/__DEFINES/shuttles.dm index 3649bc4a6b0..6f15ea65216 100644 --- a/code/__DEFINES/shuttles.dm +++ b/code/__DEFINES/shuttles.dm @@ -63,6 +63,14 @@ #define ENGINE_COEFF_MAX 2 #define ENGINE_DEFAULT_MAXSPEED_ENGINES 5 +// Alert level related +#define ALERT_COEFF_AUTOEVAC_NORMAL 2.5 +#define ALERT_COEFF_GREEN 2 +#define ALERT_COEFF_BLUE 1 +#define ALERT_COEFF_RED 0.5 +#define ALERT_COEFF_AUTOEVAC_CRITICAL 0.4 +#define ALERT_COEFF_DELTA 0.25 + //Docking error flags #define DOCKING_SUCCESS 0 #define DOCKING_BLOCKED (1<<0) diff --git a/code/controllers/subsystem/security_level.dm b/code/controllers/subsystem/security_level.dm index 9bd803602df..d4fb13d9988 100644 --- a/code/controllers/subsystem/security_level.dm +++ b/code/controllers/subsystem/security_level.dm @@ -41,8 +41,6 @@ SUBSYSTEM_DEF(security_level) announce_security_level(selected_level) // We want to announce BEFORE updating to the new level - var/old_shuttle_call_time_mod = current_security_level.shuttle_call_time_mod // Need this before we set the new one - SSsecurity_level.current_security_level = selected_level if(selected_level.looping_sound) @@ -52,9 +50,7 @@ SUBSYSTEM_DEF(security_level) can_fire = FALSE if(SSshuttle.emergency.mode == SHUTTLE_CALL || SSshuttle.emergency.mode == SHUTTLE_RECALL) // By god this is absolutely shit - old_shuttle_call_time_mod = 1 / old_shuttle_call_time_mod - SSshuttle.emergency.modTimer(old_shuttle_call_time_mod) - SSshuttle.emergency.modTimer(selected_level.shuttle_call_time_mod) + SSshuttle.emergency.alert_coeff_change(selected_level.shuttle_call_time_mod) SEND_SIGNAL(src, COMSIG_SECURITY_LEVEL_CHANGED, selected_level.number_level) SSnightshift.check_nightshift() diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index f4c090ad35f..de447e18662 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -262,8 +262,8 @@ SUBSYSTEM_DEF(shuttle) log_shuttle("[msg] Alive: [alive], Roundstart: [total], Threshold: [threshold]") emergency_no_recall = TRUE priority_announce("Catastrophic casualties detected: crisis shuttle protocols activated - jamming recall signals across all frequencies.") - if(emergency.timeLeft(1) > emergency_call_time * 0.4) - emergency.request(null, set_coefficient = 0.4) + if(emergency.timeLeft(1) > emergency_call_time * ALERT_COEFF_AUTOEVAC_CRITICAL) + emergency.request(null, set_coefficient = ALERT_COEFF_AUTOEVAC_CRITICAL) /datum/controller/subsystem/shuttle/proc/block_recall(lockout_timer) if(admin_emergency_no_recall) @@ -457,7 +457,7 @@ SUBSYSTEM_DEF(shuttle) if(callShuttle) if(EMERGENCY_IDLE_OR_RECALLED) - emergency.request(null, set_coefficient = 2.5) + emergency.request(null, set_coefficient = ALERT_COEFF_AUTOEVAC_NORMAL) log_shuttle("There is no means of calling the emergency shuttle anymore. Shuttle automatically called.") message_admins("All the communications consoles were destroyed and all AIs are inactive. Shuttle called.") diff --git a/code/modules/security_levels/security_level_datums.dm b/code/modules/security_levels/security_level_datums.dm index 8ed94e50411..175b79d1c87 100644 --- a/code/modules/security_levels/security_level_datums.dm +++ b/code/modules/security_levels/security_level_datums.dm @@ -45,7 +45,7 @@ sound = 'sound/misc/notice2.ogg' // Friendly beep number_level = SEC_LEVEL_GREEN lowering_to_configuration_key = /datum/config_entry/string/alert_green - shuttle_call_time_mod = 2 + shuttle_call_time_mod = ALERT_COEFF_GREEN /** * BLUE @@ -58,7 +58,7 @@ number_level = SEC_LEVEL_BLUE lowering_to_configuration_key = /datum/config_entry/string/alert_blue_downto elevating_to_configuration_key = /datum/config_entry/string/alert_blue_upto - shuttle_call_time_mod = 1 + shuttle_call_time_mod = ALERT_COEFF_BLUE /** * RED @@ -71,7 +71,7 @@ number_level = SEC_LEVEL_RED lowering_to_configuration_key = /datum/config_entry/string/alert_red_downto elevating_to_configuration_key = /datum/config_entry/string/alert_red_upto - shuttle_call_time_mod = 0.5 + shuttle_call_time_mod = ALERT_COEFF_RED /** * DELTA @@ -83,4 +83,4 @@ sound = 'sound/misc/airraid.ogg' // Air alarm to signify importance number_level = SEC_LEVEL_DELTA elevating_to_configuration_key = /datum/config_entry/string/alert_delta - shuttle_call_time_mod = 0.25 + shuttle_call_time_mod = ALERT_COEFF_DELTA diff --git a/code/modules/shuttle/emergency.dm b/code/modules/shuttle/emergency.dm index a75327b898c..4a9feda1fc8 100644 --- a/code/modules/shuttle/emergency.dm +++ b/code/modules/shuttle/emergency.dm @@ -339,15 +339,9 @@ /obj/docking_port/mobile/emergency/request(obj/docking_port/stationary/S, area/signal_origin, reason, red_alert, set_coefficient=null) if(!isnum(set_coefficient)) - var/security_num = SSsecurity_level.get_current_level_as_number() - switch(security_num) - if(SEC_LEVEL_GREEN) - set_coefficient = 2 - if(SEC_LEVEL_BLUE) - set_coefficient = 1 - else - set_coefficient = 0.5 - var/call_time = SSshuttle.emergency_call_time * set_coefficient * engine_coeff + set_coefficient = SSsecurity_level.current_security_level.shuttle_call_time_mod + alert_coeff = set_coefficient + var/call_time = SSshuttle.emergency_call_time * alert_coeff * engine_coeff switch(mode) // The shuttle can not normally be called while "recalling", so // if this proc is called, it's via admin fiat diff --git a/code/modules/shuttle/shuttle.dm b/code/modules/shuttle/shuttle.dm index d0977f56875..c73db559f90 100644 --- a/code/modules/shuttle/shuttle.dm +++ b/code/modules/shuttle/shuttle.dm @@ -439,7 +439,8 @@ var/current_engine_power = 0 ///How much engine power (thrust) the shuttle starts with at mapload. var/initial_engine_power = 0 - + ///Speed multiplier based on station alert level + var/alert_coeff = ALERT_COEFF_BLUE ///used as a timer (if you want time left to complete move, use timeLeft proc) var/timer var/last_timer_length @@ -927,6 +928,20 @@ last_timer_length *= multiple setTimer(time_remaining) +/obj/docking_port/mobile/proc/alert_coeff_change(new_coeff) + if(isnull(new_coeff)) + return + + var/time_multiplier = new_coeff / alert_coeff + var/time_remaining = timer - world.time + if(time_remaining < 0 || !last_timer_length) + return + + time_remaining *= time_multiplier + last_timer_length *= time_multiplier + alert_coeff = new_coeff + setTimer(time_remaining) + /obj/docking_port/mobile/proc/invertTimer() if(!last_timer_length) return