Fixes status displays blanking out when escape shuttle is about to launch

This commit is contained in:
mwerezak
2014-07-01 18:25:43 -04:00
parent c147eb9034
commit 191b4763b6
2 changed files with 35 additions and 25 deletions

View File

@@ -139,22 +139,18 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
return SHUTTLE_PREPTIME * 3 //15 minutes
return SHUTTLE_PREPTIME
/*
These procs are not really used by the controller itself, but are for other parts of the
game whose logic depends on the emergency shuttle.
*/
//returns 1 if the shuttle is docked at the station and waiting to leave
//The shuttle cannot be launched without swiping authorization if this is true
/datum/emergency_shuttle_controller/proc/waiting_to_leave()
if (shuttle.location)
return 0 //not at station
if (!wait_for_launch)
return 0 //not going anywhere
if (shuttle.moving_status == SHUTTLE_INTRANSIT)
return 0
return 1
return (wait_for_launch || shuttle.moving_status != SHUTTLE_INTRANSIT)
//so we don't have emergency_shuttle.shuttle.location everywhere
/datum/emergency_shuttle_controller/proc/location()

View File

@@ -32,14 +32,34 @@
..(origin, destination)
/datum/shuttle/ferry/emergency/can_launch(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
return 0
return ..()
/datum/shuttle/ferry/emergency/can_force(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
//initiating or cancelling a launch ALWAYS requires authorization, but if we are already set to launch anyways than forcing does not.
//this is so that people can force launch if the docking controller cannot safely undock without needing X heads to swipe.
if (process_state == WAIT_LAUNCH && !C.has_authorization())
return 0
return ..()
/datum/shuttle/ferry/emergency/can_cancel(var/user)
if (istype(user, /obj/machinery/computer/shuttle_control/emergency))
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (!C.has_authorization())
return 0
return ..()
/datum/shuttle/ferry/emergency/launch(var/user)
if (!can_launch()) return
if (!can_launch(user)) return
if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (emergency_shuttle.waiting_to_leave() && !C.has_authorization())
return //need authorization to launch early
if (emergency_shuttle.autopilot)
emergency_shuttle.autopilot = 0
world << "\blue <B>Alert: The shuttle autopilot has been overridden. Launch sequence initiated!</B>"
@@ -47,13 +67,9 @@
..(user)
/datum/shuttle/ferry/emergency/force_launch(var/user)
if (!can_force()) return
if (!can_force(user)) return
if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (emergency_shuttle.waiting_to_leave() && !C.has_authorization())
return //need authorization to launch early
if (emergency_shuttle.autopilot)
emergency_shuttle.autopilot = 0
world << "\blue <B>Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!</B>"
@@ -61,19 +77,17 @@
..(user)
/datum/shuttle/ferry/emergency/cancel_launch(var/user)
if (!can_cancel()) return
if (!can_cancel(user)) return
if (istype(user, /obj/machinery/computer/shuttle_control/emergency)) //if we were given a command by an emergency shuttle console
var/obj/machinery/computer/shuttle_control/emergency/C = user
if (emergency_shuttle.waiting_to_leave() && !C.has_authorization())
return
if (emergency_shuttle.autopilot)
emergency_shuttle.autopilot = 0
world << "\blue <B>Alert: The shuttle autopilot has been overridden. Launch sequence aborted!</B>"
..(user)
/obj/machinery/computer/shuttle_control/emergency
shuttle_tag = "Escape"
var/debug = 0
@@ -189,9 +203,9 @@
"has_docking" = shuttle.docking_controller? 1 : 0,
"docking_status" = shuttle.docking_controller? shuttle.docking_controller.get_docking_status() : null,
"docking_override" = shuttle.docking_controller? shuttle.docking_controller.override_enabled : null,
"can_launch" = shuttle.can_launch() && (!emergency_shuttle.waiting_to_leave() || has_auth),
"can_cancel" = shuttle.can_cancel() && (!emergency_shuttle.waiting_to_leave() || has_auth),
"can_force" = shuttle.can_force() && (!emergency_shuttle.waiting_to_leave() || has_auth),
"can_launch" = shuttle.can_launch(src),
"can_cancel" = shuttle.can_cancel(src),
"can_force" = shuttle.can_force(src),
"auth_list" = auth_list,
"has_auth" = has_auth,
"user" = debug? user : null,