From acec01fb1415d9b6d6cfc625baec06b41b17644f Mon Sep 17 00:00:00 2001 From: mwerezak Date: Tue, 10 Jun 2014 15:22:10 -0400 Subject: [PATCH] Docking overrides now have a clear purpose Originally the purpose of the docking override was to allow the shuttle to move even if it couldn't undock properly (e.g. the doors were stuck open), however it makes more sense just to have the shuttle take care of that. This commit now makes the behaviour of the docking overrides line up with it's new purpose. --- .../embedded_controller/docking_program.dm | 31 ++++++++++++++----- code/modules/shuttles/shuttle_console.dm | 21 +------------ nano/templates/shuttle_control_console.tmpl | 6 ++-- 3 files changed, 28 insertions(+), 30 deletions(-) diff --git a/code/game/machinery/embedded_controller/docking_program.dm b/code/game/machinery/embedded_controller/docking_program.dm index f4220f831aa..28049797e23 100644 --- a/code/game/machinery/embedded_controller/docking_program.dm +++ b/code/game/machinery/embedded_controller/docking_program.dm @@ -24,6 +24,17 @@ MODE_NONE|STATE_UNDOCKED idle - not docked. MODE_NONE|anything else should never happen. + *** Override, what is it? *** + + The purpose of enabling the override is to prevent the docking program from automatically doing things with the docking port when docking or undocking. + Maybe the shuttle is full of plamsa/phoron for some reason, and you don't want the door to automatically open, or the airlock to cycle. + This means that the prepare_for_docking/undocking and finish_docking/undocking procs don't get called. + + The docking controller will still check the state of the docking port, and thus prevent the shuttle from launching unless they force the launch (handling forced + launches is not the docking controller's responsibility). In this case it is up to the players to manually get the docking port into a good state to undock + (which usually just means closing and locking the doors). + + In line with this, docking controllers should prevent players from manually doing things when the override is disabled. */ @@ -68,12 +79,15 @@ if ("confirm_undock") if (control_mode == MODE_CLIENT && dock_state == STATE_UNDOCKING && receive_tag == tag_target) send_docking_command(tag_target, "confirm_undock") + if (!override_enabled) + finish_undocking() reset() //client is done undocking! if ("request_undock") if (control_mode == MODE_SERVER && dock_state == STATE_DOCKED && receive_tag == tag_target) dock_state = STATE_UNDOCKING - prepare_for_undocking() + if (!override_enabled) + prepare_for_undocking() if ("dock_error") if (receive_tag == tag_target) @@ -100,7 +114,9 @@ response_sent = 1 else if (control_mode == MODE_SERVER) send_docking_command(tag_target, "confirm_undock") //tell the client we are OK to undock. - reset() //server is done undocking! + if (!override_enabled) + finish_undocking() + reset() //server is done undocking! if (dock_state != STATE_DOCKING && dock_state != STATE_UNDOCKING) response_sent = 0 @@ -128,7 +144,8 @@ return dock_state = STATE_UNDOCKING - prepare_for_undocking() + if (!override_enabled) + prepare_for_undocking() send_docking_command(tag_target, "request_undock") @@ -149,19 +166,19 @@ /datum/computer/file/embedded_program/docking/proc/prepare_for_undocking() return +//we are docked, open the doors or whatever. +/datum/computer/file/embedded_program/docking/proc/finish_undocking() + return + //are we ready for undocking? /datum/computer/file/embedded_program/docking/proc/ready_for_undocking() return 1 /datum/computer/file/embedded_program/docking/proc/enable_override() override_enabled = 1 - //if (tag_target) - // send_docking_command(tag_target, "enable_override") /datum/computer/file/embedded_program/docking/proc/disable_override() override_enabled = 0 - //if (tag_target) - // send_docking_command(tag_target, "disable_override") /datum/computer/file/embedded_program/docking/proc/reset() dock_state = STATE_UNDOCKED diff --git a/code/modules/shuttles/shuttle_console.dm b/code/modules/shuttles/shuttle_console.dm index 51361151e65..1fe2b62f156 100644 --- a/code/modules/shuttles/shuttle_console.dm +++ b/code/modules/shuttles/shuttle_console.dm @@ -48,16 +48,6 @@ return -/obj/machinery/computer/shuttle_control/proc/toggle_override() - if (!can_override()) return - - var/datum/shuttle/shuttle = shuttles[shuttle_tag] - - if (shuttle.docking_controller.override_enabled) - shuttle.docking_controller.disable_override() - else - shuttle.docking_controller.enable_override() - /obj/machinery/computer/shuttle_control/proc/can_launch() var/datum/shuttle/shuttle = shuttles[shuttle_tag] @@ -76,13 +66,6 @@ return 1 return 0 -/obj/machinery/computer/shuttle_control/proc/can_override() - var/datum/shuttle/shuttle = shuttles[shuttle_tag] - - if (shuttle.docking_controller && (!shuttle.docking_controller.override_enabled || !shuttle.in_use)) - return 1 - return 0 - //TODO move this stuff into the shuttle datum itself, instead of manipulating the shuttle's members /obj/machinery/computer/shuttle_control/process() if (!shuttles || !(shuttle_tag in shuttles)) @@ -112,7 +95,7 @@ if (!shuttle.docking_controller || !shuttle.current_dock_target()) return 1 //shuttles without docking controllers or at locations without docking ports act like old-style shuttles - return shuttle.docking_controller.override_enabled //override pretty much lets you do whatever you want + return 0 /obj/machinery/computer/shuttle_control/Del() @@ -186,8 +169,6 @@ launch_shuttle() else if(href_list["cancel"]) cancel_launch() - else if(href_list["override"]) - toggle_override() /obj/machinery/computer/shuttle_control/attackby(obj/item/weapon/W as obj, mob/user as mob) diff --git a/nano/templates/shuttle_control_console.tmpl b/nano/templates/shuttle_control_console.tmpl index c07a68b8709..f50a654cdc3 100644 --- a/nano/templates/shuttle_control_console.tmpl +++ b/nano/templates/shuttle_control_console.tmpl @@ -46,13 +46,13 @@
- Docking Override: + Docking Control:
{{if override_enabled}} - ENABLED + MANUAL {{else}} - SAFE + AUTO {{/if}}