Shuttle SS keeps track of hostile environments (#19235)

* Shuttle SS keeps track of hostile environments

Instead of changing SSshuttle.emergencyNoEscape manually, datums now
register and clear themselves with the SS, and a hostile environment is
if any datums are registered.

Note that it's datums that can be registered, as rev and blob gamemodes
register themselves.

Overhauling this means that you can have multiple sources of no-recall,
which although can't happen at present, may do so in the future whenever
multi-antag rounds happen.

🆑 coiax
tweak: The AI doomsday device timer is more accurate.
fix: Fixes a bug where the doomsday device would take twice as long as
it should.
/🆑

AI doomsday timer uses world.time, uses fastprocess to make sure the
announcements go out on time, added observer countdown for
the AI doomsday device.

* Fixes bugs
This commit is contained in:
coiax
2016-07-11 05:53:23 +01:00
committed by oranges
parent 305cb279c8
commit 771c64084d
13 changed files with 113 additions and 65 deletions

View File

@@ -24,6 +24,7 @@ var/datum/subsystem/shuttle/SSshuttle
var/emergencyEscapeTime = 1200 //time taken for emergency shuttle to reach a safe distance after leaving station (in deciseconds)
var/area/emergencyLastCallLoc
var/emergencyNoEscape
var/list/hostileEnvironments = list()
//supply shuttle stuff
var/obj/docking_port/mobile/supply/supply
@@ -253,6 +254,34 @@ var/datum/subsystem/shuttle/SSshuttle
log_game("There is no means of calling the shuttle anymore. Shuttle automatically called.")
message_admins("All the communications consoles were destroyed and all AIs are inactive. Shuttle called.")
/datum/subsystem/shuttle/proc/registerHostileEnvironment(datum/bad)
hostileEnvironments[bad] = TRUE
checkHostileEnvironment()
/datum/subsystem/shuttle/proc/clearHostileEnvironment(datum/bad)
hostileEnvironments -= bad
checkHostileEnvironment()
/datum/subsystem/shuttle/proc/checkHostileEnvironment()
for(var/datum/d in hostileEnvironments)
if(!istype(d) || qdeleted(d))
hostileEnvironments -= d
emergencyNoEscape = hostileEnvironments.len
if(emergencyNoEscape && (emergency.mode == SHUTTLE_IGNITING))
emergency.mode = SHUTTLE_STRANDED
emergency.timer = null
emergency.sound_played = FALSE
priority_announce("Hostile environment detected. \
Departure has been postponed indefinitely pending \
conflict resolution.", null, 'sound/misc/notice1.ogg', "Priority")
if(!emergencyNoEscape && (emergency.mode == SHUTTLE_STRANDED))
emergency.mode = SHUTTLE_DOCKED
emergency.setTimer(emergencyDockTime)
priority_announce("Hostile environment resolved. \
You have 3 minutes to board the Emergency Shuttle.",
null, 'sound/AI/shuttledock.ogg', "Priority")
//try to move/request to dockHome if possible, otherwise dockAway. Mainly used for admin buttons
/datum/subsystem/shuttle/proc/toggleShuttle(shuttleId, dockHome, dockAway, timed)
var/obj/docking_port/mobile/M = getShuttle(shuttleId)