Improves the fix for shuttles being stuck if...

... the docking controller is destroyed.
This commit is contained in:
mwerezak
2014-06-26 19:01:17 -04:00
parent deb1e1007c
commit 363df869e2
3 changed files with 13 additions and 15 deletions

View File

@@ -2,7 +2,6 @@
//Shuttle controller is instantiated in master_controller.dm.
//shuttle moving state defines are in setup.dm
#define DOCK_ATTEMPT_TIMEOUT 450 //how long in ticks we wait before assuming the docking controller is broken or blown up.
/datum/shuttle
var/warmup_time = 0
@@ -10,8 +9,6 @@
var/docking_controller_tag //tag of the controller used to coordinate docking
var/datum/computer/file/embedded_program/docking/docking_controller //the controller itself. (micro-controller, not game controller)
var/last_dock_attempt_time = 0
/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
if(moving_status != SHUTTLE_IDLE) return
@@ -52,14 +49,11 @@
if (!dock_target)
return
last_dock_attempt_time = world.time
docking_controller.initiate_docking(dock_target)
/datum/shuttle/proc/undock()
if (!docking_controller)
return
last_dock_attempt_time = world.time
docking_controller.initiate_undocking()
/datum/shuttle/proc/current_dock_target()
@@ -68,8 +62,6 @@
/datum/shuttle/proc/skip_docking_checks()
if (!docking_controller || !current_dock_target())
return 1 //shuttles without docking controllers or at locations without docking ports act like old-style shuttles
if (world.time > last_dock_attempt_time + DOCK_ATTEMPT_TIMEOUT)
return 1
return 0
//just moves the shuttle from A to B, if it can be moved
@@ -83,6 +75,9 @@
if(origin == destination)
//world << "cancelling move, shuttle will overlap."
return
if (docking_controller && !docking_controller.undocked())
docking_controller.force_undock()
moving_status = SHUTTLE_INTRANSIT