From 3f7a6286b8502d749230f46d529ebc0de5e22ea5 Mon Sep 17 00:00:00 2001 From: mwerezak Date: Mon, 30 Jun 2014 16:28:14 -0400 Subject: [PATCH] Improves the display of shuttle ETAs Conflicts: code/controllers/emergency_shuttle_controller.dm --- .../emergency_shuttle_controller.dm | 37 +++++++++++++------ code/game/machinery/status_display.dm | 10 +++-- code/modules/mob/dead/observer/observer.dm | 7 ++-- code/modules/mob/living/carbon/alien/alien.dm | 7 ++-- code/modules/mob/living/carbon/human/human.dm | 9 ++--- code/modules/mob/living/silicon/silicon.dm | 7 ++-- .../modules/mob/living/simple_animal/borer.dm | 7 ++-- 7 files changed, 49 insertions(+), 35 deletions(-) diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 5eb38497838..a90aa92f08c 100644 --- a/code/controllers/emergency_shuttle_controller.dm +++ b/code/controllers/emergency_shuttle_controller.dm @@ -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 diff --git a/code/game/machinery/status_display.dm b/code/game/machinery/status_display.dm index 20e0772c6f8..a2d49758537 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -81,9 +81,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-" diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 31ba7a14323..84d103289ab 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -222,10 +222,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" diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 8f168246cb3..26536fb8212 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -167,10 +167,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) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index 7b6b0636cdd..81bbbec3b3e 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -195,11 +195,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) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 500148a9399..f98026827d7 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -177,10 +177,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) diff --git a/code/modules/mob/living/simple_animal/borer.dm b/code/modules/mob/living/simple_animal/borer.dm index c69287feb6b..e664eee2d64 100644 --- a/code/modules/mob/living/simple_animal/borer.dm +++ b/code/modules/mob/living/simple_animal/borer.dm @@ -145,10 +145,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)