From 191b4763b63c8898afcc9e3945f67b6e12dd9066 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 1 Jul 2014 18:25:43 -0400 Subject: [PATCH] Fixes status displays blanking out when escape shuttle is about to launch --- .../emergency_shuttle_controller.dm | 10 ++-- code/modules/shuttles/shuttle_emergency.dm | 50 ++++++++++++------- 2 files changed, 35 insertions(+), 25 deletions(-) diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 33eab20ddc..51a063057c 100644 --- a/code/controllers/emergency_shuttle_controller.dm +++ b/code/controllers/emergency_shuttle_controller.dm @@ -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() diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index 95663388a8..5075093158 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -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 Alert: The shuttle autopilot has been overridden. Launch sequence initiated!" @@ -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 Alert: The shuttle autopilot has been overridden. Bluespace drive engaged!" @@ -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 Alert: The shuttle autopilot has been overridden. Launch sequence aborted!" ..(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,