Config option to automatically call the shuttle for high casualties (#31309)

This commit is contained in:
Jordan Brown
2017-10-06 22:34:40 -04:00
committed by CitadelStationBot
parent 028157f3b2
commit b17a770299
3 changed files with 34 additions and 1 deletions
@@ -264,3 +264,8 @@ CONFIG_DEF(number/bombcap)
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
+27 -1
View File
@@ -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)