Merge pull request #3193 from Citadel-Station-13/upstream-merge-31309

[MIRROR] Config option to automatically call the shuttle for high casualties
This commit is contained in:
LetterJay
2017-10-07 23:42:17 -04:00
committed by GitHub
3 changed files with 35 additions and 2 deletions
@@ -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
+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)