Improves the display of shuttle ETAs

This commit is contained in:
mwerezak
2014-06-30 16:28:14 -04:00
parent 3f39478010
commit c147eb9034
7 changed files with 49 additions and 35 deletions

View File

@@ -140,12 +140,22 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
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
//so we don't have emergency_shuttle.shuttle.location everywhere
/datum/emergency_shuttle_controller/proc/location()
if (!shuttle)
@@ -165,7 +175,7 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
//returns the time left until the shuttle launches, in seconds
/datum/emergency_shuttle_controller/proc/estimate_launch_time()
return (launch_time + shuttle.warmup_time*10 - world.time)/10
return (launch_time - world.time)/10
/datum/emergency_shuttle_controller/proc/has_eta()
return (wait_for_launch || shuttle.moving_status != SHUTTLE_IDLE)
@@ -191,16 +201,21 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle
/datum/emergency_shuttle_controller/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/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
/datum/emergency_shuttle_controller/proc/get_status_panel_eta()
if (online())
if (shuttle.has_arrive_time())
var/timeleft = emergency_shuttle.estimate_arrival_time()
return "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]"
if (waiting_to_leave())
if (shuttle.moving_status == SHUTTLE_WARMUP)
return "Departing..."
var/timeleft = emergency_shuttle.estimate_launch_time()
return "ETD-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]"
return ""
/*
Some slapped-together star effects for maximum spess immershuns. Basically consists of a
spawner, an ender, and bgstar. Spawners create bgstars, bgstars shoot off into a direction

View File

@@ -76,9 +76,13 @@
if(1) //emergency shuttle timer
if(emergency_shuttle.waiting_to_leave())
var/line1 = "-ETD-"
var/line2 = get_shuttle_timer_departure()
if(length(line2) > CHARS_PER_LINE)
line2 = "Error!"
var/line2
if (emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP)
line2 = "Launch"
else
line2 = get_shuttle_timer_departure()
if(length(line2) > CHARS_PER_LINE)
line2 = "Error!"
update_display(line1, line2)
else if(emergency_shuttle.has_eta())
var/line1 = "-ETA-"

View File

@@ -216,10 +216,9 @@ This is the proc mobs get to turn into a ghost. Forked from ghostize due to comp
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)
/mob/dead/observer/verb/reenter_corpse()
set category = "Ghost"

View File

@@ -159,10 +159,9 @@
stat(null, "Plasma Stored: [getPlasma()]/[max_plasma]")
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)
/mob/living/carbon/alien/Stun(amount)
if(status_flags & CANSTUN)

View File

@@ -171,11 +171,10 @@
if(ticker.mode:malf_mode_declared)
stat(null, "Time left: [max(ticker.mode:AI_win_timeleft/(ticker.mode:apcs/3), 0)]")
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)
if (client.statpanel == "Status")
if (internal)
if (!internal.air_contents)

View File

@@ -98,10 +98,9 @@
// this function displays the shuttles ETA in the status panel if the shuttle has been called
/mob/living/silicon/proc/show_emergency_shuttle_eta()
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)
// This adds the basic clock, shuttle recall timer, and malf_ai info to all silicon lifeforms

View File

@@ -146,10 +146,9 @@
statpanel("Status")
if(emergency_shuttle)
if(emergency_shuttle.has_eta() && !emergency_shuttle.returned())
var/timeleft = emergency_shuttle.estimate_arrival_time()
if (timeleft)
stat(null, "ETA-[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]")
var/eta_status = emergency_shuttle.get_status_panel_eta()
if(eta_status)
stat(null, eta_status)
if (client.statpanel == "Status")
stat("Chemicals", chemicals)