long_jump() now uses an arrive_time var instead of sleeping the whole time.

Makes ETAs more accurate, allows the possibility of interrupting
long_jumps in the future.
This commit is contained in:
mwerezak
2014-06-30 15:14:20 -04:00
parent abc54987b4
commit 9991b46ea6
6 changed files with 42 additions and 26 deletions
+11 -5
View File
@@ -9,6 +9,8 @@
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/arrive_time = 0 //the time at which the shuttle arrives when long jumping
/datum/shuttle/proc/short_jump(var/area/origin,var/area/destination)
if(moving_status != SHUTTLE_IDLE) return
@@ -34,13 +36,15 @@
move(departing, interim, direction)
sleep(travel_time*10)
moving_status = SHUTTLE_INTRANSIT
arrive_time = world.time + travel_time*10
while (world.time < arrive_time)
sleep(5)
move(interim, destination, direction)
moving_status = SHUTTLE_IDLE
/datum/shuttle/proc/dock()
if (!docking_controller)
return
@@ -78,8 +82,6 @@
if (docking_controller && !docking_controller.undocked())
docking_controller.force_undock()
moving_status = SHUTTLE_INTRANSIT
var/list/dstturfs = list()
var/throwy = world.maxy
@@ -117,4 +119,8 @@
if(!M.buckled)
M.Weaken(3)
return
return
//returns 1 if the shuttle has a valid arrive time
/datum/shuttle/proc/has_arrive_time()
return (moving_status == SHUTTLE_INTRANSIT)
+1 -6
View File
@@ -1,6 +1,6 @@
/datum/shuttle/ferry/emergency
var/last_move_time = null //the time at which the shuttle last moved. Used for ETAs
//pass
/datum/shuttle/ferry/emergency/arrived()
emergency_shuttle.shuttle_arrived()
@@ -18,11 +18,6 @@
..()
/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
if (destination == area_transition)
last_move_time = world.time
else
last_move_time = null
if (origin == area_station) //leaving the station
emergency_shuttle.departed = 1
-1
View File
@@ -5,7 +5,6 @@
/datum/shuttle/ferry/supply
var/away_location = 1 //the location to hide at while pretending to be in-transit
var/arrive_time = 0
var/late_chance = 80
var/max_late_time = 300