diff --git a/code/controllers/configuration/entries/game_options.dm b/code/controllers/configuration/entries/game_options.dm index 65c7dbaf4c..f2c9cd3315 100644 --- a/code/controllers/configuration/entries/game_options.dm +++ b/code/controllers/configuration/entries/game_options.dm @@ -268,3 +268,8 @@ CONFIG_DEF(flag/allow_extended_miscreants) GLOB.MAX_EX_LIGHT_RANGE = value GLOB.MAX_EX_FLASH_RANGE = value GLOB.MAX_EX_FLAME_RANGE = value + +CONFIG_DEF(number/emergency_shuttle_autocall_threshold) + min_val = 0 + max_val = 1 + integer = FALSE diff --git a/code/controllers/subsystem/shuttle.dm b/code/controllers/subsystem/shuttle.dm index 705f0dbd81..9973a43430 100644 --- a/code/controllers/subsystem/shuttle.dm +++ b/code/controllers/subsystem/shuttle.dm @@ -136,6 +136,7 @@ SUBSYSTEM_DEF(shuttle) if(changed_transit) color_space() #endif + CheckAutoEvac() while(transit_requesters.len) var/requester = popleft(transit_requesters) @@ -148,7 +149,32 @@ SUBSYSTEM_DEF(shuttle) var/obj/docking_port/mobile/M = requester M.transit_failure() if(MC_TICK_CHECK) - return + break + +/datum/controller/subsystem/shuttle/proc/CheckAutoEvac() + if(emergencyNoEscape || emergencyNoRecall || !emergency) + return + + var/threshold = CONFIG_GET(number/emergency_shuttle_autocall_threshold) + if(!threshold) + return + + var/alive = 0 + for(var/I in GLOB.player_list) + var/mob/M = I + if(M.stat != DEAD) + ++alive + + var/total = GLOB.joined_player_list.len + + if(alive / total <= threshold) + var/msg = "Automatically dispatching shuttle due to crew death." + message_admins(msg) + log_game("[msg] Alive: [alive], Roundstart: [total], Threshold: [threshold]") + emergencyNoRecall = TRUE + priority_announce("Catastrophic casualties detected: crisis shuttle protocols activated - jamming recall signals across all frequencies.") + if(emergency.timeLeft(1) > emergencyCallTime * 0.4) + emergency.request(null, set_coefficient = 0.4) /datum/controller/subsystem/shuttle/proc/getShuttle(id) for(var/obj/docking_port/mobile/M in mobile) diff --git a/config/game_options.txt b/config/game_options.txt index 3fc1787726..d577756061 100644 --- a/config/game_options.txt +++ b/config/game_options.txt @@ -496,6 +496,8 @@ ARRIVALS_SHUTTLE_DOCK_WINDOW 55 MICE_ROUNDSTART 10 +## If the percentage of players alive (doesn't count conversions) drops below this threshold the emergency shuttle will be forcefully called (provided it can be) +#EMERGENCY_SHUTTLE_AUTOCALL_THRESHOLD 0.2 ## CREW OBJECTIVES ## ## Comment to disable objectives for innocent crew members. @@ -506,4 +508,4 @@ ALLOW_CREW_OBJECTIVES ALLOW_MISCREANTS ## Uncomment to let miscreants spawn during Extended. I hold no responsibility for fun that may occur while this is enabled. -#ALLOW_EXTENDED_MISCREANTS \ No newline at end of file +#ALLOW_EXTENDED_MISCREANTS