Minor shuttle fixes and cleanup

Readds the missing "shuttle has left the station" message, improves the
ETA calculation and reorganizes the procs in shuttle_controller.dm
This commit is contained in:
mwerezak
2014-06-23 01:55:43 -04:00
committed by ZomgPonies
parent d8c02c7b6e
commit 7e057e7eb9
4 changed files with 74 additions and 62 deletions
+56 -48
View File
@@ -13,7 +13,7 @@
var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle
/datum/shuttle_controller/emergency_shuttle
var/datum/shuttle/ferry/shuttle
var/datum/shuttle/ferry/emergency/shuttle
var/list/escape_pods
var/launch_time //the time at which the shuttle will be launched
@@ -71,15 +71,13 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle
/datum/shuttle_controller/emergency_shuttle/proc/process()
if (wait_for_launch)
if (auto_recall && can_recall() && world.time >= auto_recall_time)
if (auto_recall && world.time >= auto_recall_time)
recall()
if (world.time >= launch_time) //time to launch the shuttle
wait_for_launch = 0
//set the travel time
if (!shuttle.location) //at station
departed = 1 //technically we haven't left yet, but this should be good enough
if (!shuttle.location) //leaving from the station
//launch the pods!
for (var/datum/shuttle/ferry/escape_pod/pod in escape_pods)
pod.launch(src)
@@ -103,49 +101,6 @@ var/global/datum/shuttle_controller/emergency_shuttle/emergency_shuttle
launch_time = world.time + SHUTTLE_LEAVETIME*10
wait_for_launch = 1 //get ready to return
//returns the time left until the shuttle arrives at it's destination, in seconds
/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time()
var/eta = launch_time + shuttle.travel_time
return (eta - world.time)/10
//returns the time left until the shuttle launches, in seconds
/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time()
return (launch_time - world.time)/10
/datum/shuttle_controller/emergency_shuttle/proc/has_eta()
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle has gone to the station and come back at least once,
//used for game completion checking purposes
/datum/shuttle_controller/emergency_shuttle/proc/returned()
return 0 //TODO
//returns 1 if the shuttle is not idle at centcom
/datum/shuttle_controller/emergency_shuttle/proc/online()
if (!shuttle.location) //not at centcom
return 1
if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
return 1
return 0
//returns 1 if the shuttle is currently in transit (or just leaving) to the station
/datum/shuttle_controller/emergency_shuttle/proc/going_to_station()
return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is currently in transit (or just leaving) to centcom
/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom()
return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is docked at the station and waiting to leave
/datum/shuttle_controller/emergency_shuttle/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_IDLE)
return 0 //shuttle is doing stuff
return 1
//so we don't have emergency_shuttle.shuttle.location everywhere
/datum/shuttle_controller/emergency_shuttle/proc/location()
if (!shuttle)
@@ -224,6 +179,59 @@ var/global/datum/shuttle_controller/emergency_shuttle/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 the time left until the shuttle arrives at it's destination, in seconds
/datum/shuttle_controller/emergency_shuttle/proc/estimate_arrival_time()
var/eta
if (isnull(shuttle.jump_time))
eta = launch_time + shuttle.travel_time
else
eta = shuttle.jump_time + shuttle.travel_time
return (eta - world.time)/10
//returns the time left until the shuttle launches, in seconds
/datum/shuttle_controller/emergency_shuttle/proc/estimate_launch_time()
return (launch_time - world.time)/10
/datum/shuttle_controller/emergency_shuttle/proc/has_eta()
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle has gone to the station and come back at least once,
//used for game completion checking purposes
/datum/shuttle_controller/emergency_shuttle/proc/returned()
return (departed && shuttle.moving_status != SHUTTLE_IDLE && shuttle.location) //we've gone to the station at least once, no longer in transit and are idle back at centcom
//returns 1 if the shuttle is not idle at centcom
/datum/shuttle_controller/emergency_shuttle/proc/online()
if (!shuttle.location) //not at centcom
return 1
if (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
return 1
return 0
//returns 1 if the shuttle is currently in transit (or just leaving) to the station
/datum/shuttle_controller/emergency_shuttle/proc/going_to_station()
return (!shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is currently in transit (or just leaving) to centcom
/datum/shuttle_controller/emergency_shuttle/proc/going_to_centcom()
return (shuttle.direction && shuttle.moving_status != SHUTTLE_IDLE)
//returns 1 if the shuttle is docked at the station and waiting to leave
/datum/shuttle_controller/emergency_shuttle/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_IDLE)
return 0 //shuttle is doing stuff
return 1
/*
Some slapped-together star effects for maximum spess immershuns. Basically consists of a
+6 -6
View File
@@ -173,15 +173,15 @@
proc/get_shuttle_timer_arrival()
var/timeleft = emergency_shuttle.estimate_arrival_time()
if(timeleft)
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
return ""
if(timeleft < 0)
return ""
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
proc/get_shuttle_timer_departure()
var/timeleft = emergency_shuttle.estimate_launch_time()
if(timeleft)
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
return ""
if(timeleft < 0)
return ""
return "[add_zero(num2text((timeleft / 60) % 60),2)]:[add_zero(num2text(timeleft % 60), 2)]"
proc/get_supply_shuttle_timer()
var/datum/shuttle/ferry/supply/shuttle = supply_controller.shuttle
+1 -1
View File
@@ -101,7 +101,7 @@ var/global/list/shuttles
for(var/mob/living/simple_animal/pest in destination)
pest.gib()
origin.move_contents_to(destination)
origin.move_contents_to(destination) //might need to use the "direction" argument here, I dunno.
for(var/mob/M in destination)
if(M.client)
+11 -7
View File
@@ -1,18 +1,22 @@
/datum/shuttle/ferry/emergency
//pass
var/jump_time = null //the time at which the shuttle last jumped. Used for ETAs
/datum/shuttle/ferry/emergency/arrived()
emergency_shuttle.shuttle_arrived()
/*
/datum/shuttle/ferry/emergency/move()
/datum/shuttle/ferry/emergency/move(var/area/origin,var/area/destination)
if (destination == area_transition)
jump_time = world.time
else
jump_time = null
if (!location) //leaving the station
emergency_shuttle.departed = 1
..()
*/
captain_announce("The Emergency Shuttle has left the station. Estimate [round(emergency_shuttle.estimate_arrival_time()/60,1)] minutes until the shuttle docks at Central Command.")
..(origin, destination)
/datum/shuttle/ferry/escape_pod
//pass
@@ -34,7 +38,7 @@
spawn(0)
D.close()
..(origin, destination) //might need to adjust shuttle/move so that it can take into account the direction argument to area/move_contents_to, I dunno.
..(origin, destination)
for(var/obj/machinery/door/D in destination)
spawn(0)