diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 93fa0b79f1..33eab20ddc 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) @@ -155,9 +165,9 @@ var/global/datum/emergency_shuttle_controller/emergency_shuttle //returns the time left until the shuttle arrives at it's destination, in seconds /datum/emergency_shuttle_controller/proc/estimate_arrival_time() var/eta - if (!isnull(shuttle.last_move_time)) - //if we have a last_move_time than we are in transition and can get an accurate ETA - eta = shuttle.last_move_time + shuttle.move_time*10 + if (shuttle.has_arrive_time()) + //we are in transition and can get an accurate ETA + eta = shuttle.arrive_time else //otherwise we need to estimate the arrival time using the scheduled launch time eta = launch_time + shuttle.move_time*10 + shuttle.warmup_time*10 @@ -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 ea145b5444..7f020c46e2 100644 --- a/code/game/machinery/status_display.dm +++ b/code/game/machinery/status_display.dm @@ -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-" diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 977239f92f..ac67a624e3 100644 --- a/code/modules/admin/player_panel.dm +++ b/code/modules/admin/player_panel.dm @@ -400,13 +400,18 @@ if (!emergency_shuttle.online()) dat += "Call Shuttle
" else - var/timeleft = emergency_shuttle.estimate_launch_time() - switch(emergency_shuttle.location()) - if(1) - dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" - dat += "Send Back
" - if(0) - dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" + if (emergency_shuttle.wait_for_launch) + var/timeleft = emergency_shuttle.estimate_launch_time() + dat += "ETL: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" + + else if (emergency_shuttle.shuttle.has_arrive_time()) + var/timeleft = emergency_shuttle.estimate_arrival_time() + dat += "ETA: [(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]
" + dat += "Send Back
" + + if (emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP) + dat += "Launching now..." + dat += "[ticker.delay_end ? "End Round Normally" : "Delay Round End"]
" if(ticker.mode.syndicates.len) dat += "
" diff --git a/code/modules/admin/topic.dm b/code/modules/admin/topic.dm index df21a2372f..5990b64ceb 100644 --- a/code/modules/admin/topic.dm +++ b/code/modules/admin/topic.dm @@ -239,12 +239,23 @@ else if(href_list["edit_shuttle_time"]) if(!check_rights(R_SERVER)) return - var/new_time_left = input("Enter new shuttle launch duration (seconds):","Edit Shuttle Timeleft", emergency_shuttle.estimate_launch_time() ) as num + if (emergency_shuttle.wait_for_launch) + var/new_time_left = input("Enter new shuttle launch countdown (seconds):","Edit Shuttle Launch Time", emergency_shuttle.estimate_launch_time() ) as num - emergency_shuttle.launch_time = world.time + new_time_left*10 + emergency_shuttle.launch_time = world.time + new_time_left*10 - log_admin("[key_name(usr)] edited the Emergency Shuttle's timeleft to [new_time_left]") - message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's timeleft to [new_time_left*10]", 1) + log_admin("[key_name(usr)] edited the Emergency Shuttle's launch time to [new_time_left]") + message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's launch time to [new_time_left*10]", 1) + else if (emergency_shuttle.shuttle.has_arrive_time()) + + var/new_time_left = input("Enter new shuttle arrival time (seconds):","Edit Shuttle Arrival Time", emergency_shuttle.estimate_arrival_time() ) as num + emergency_shuttle.shuttle.arrive_time = world.time + new_time_left*10 + + log_admin("[key_name(usr)] edited the Emergency Shuttle's arrival time to [new_time_left]") + message_admins("\blue [key_name_admin(usr)] edited the Emergency Shuttle's arrival time to [new_time_left*10]", 1) + else + alert("The shuttle is neither counting down to launch nor is it in transit. Please try again when it is.") + href_list["secretsadmin"] = "check_antagonist" else if(href_list["delay_round_end"]) diff --git a/code/modules/mob/dead/observer/observer.dm b/code/modules/mob/dead/observer/observer.dm index 2386c5f524..13cc1933e2 100644 --- a/code/modules/mob/dead/observer/observer.dm +++ b/code/modules/mob/dead/observer/observer.dm @@ -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" diff --git a/code/modules/mob/living/carbon/alien/alien.dm b/code/modules/mob/living/carbon/alien/alien.dm index 89e9cff654..23d5416fca 100644 --- a/code/modules/mob/living/carbon/alien/alien.dm +++ b/code/modules/mob/living/carbon/alien/alien.dm @@ -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) diff --git a/code/modules/mob/living/carbon/human/human.dm b/code/modules/mob/living/carbon/human/human.dm index c7efac82ef..b70dce9446 100644 --- a/code/modules/mob/living/carbon/human/human.dm +++ b/code/modules/mob/living/carbon/human/human.dm @@ -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) diff --git a/code/modules/mob/living/silicon/silicon.dm b/code/modules/mob/living/silicon/silicon.dm index 8e1cf220d8..adbddb736f 100644 --- a/code/modules/mob/living/silicon/silicon.dm +++ b/code/modules/mob/living/silicon/silicon.dm @@ -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 diff --git a/code/modules/mob/living/simple_animal/borer.dm b/code/modules/mob/living/simple_animal/borer.dm index f8faad0635..19ad62d4ae 100644 --- a/code/modules/mob/living/simple_animal/borer.dm +++ b/code/modules/mob/living/simple_animal/borer.dm @@ -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) diff --git a/code/modules/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index db215c26b5..34a5d1e138 100644 --- a/code/modules/shuttles/shuttle.dm +++ b/code/modules/shuttles/shuttle.dm @@ -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 \ No newline at end of file + return + +//returns 1 if the shuttle has a valid arrive time +/datum/shuttle/proc/has_arrive_time() + return (moving_status == SHUTTLE_INTRANSIT) \ No newline at end of file diff --git a/code/modules/shuttles/shuttle_emergency.dm b/code/modules/shuttles/shuttle_emergency.dm index d6f7681967..95663388a8 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -1,8 +1,12 @@ /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() + if (istype(in_use, /obj/machinery/computer/shuttle_control/emergency)) + var/obj/machinery/computer/shuttle_control/emergency/C = in_use + C.reset_authorization() + emergency_shuttle.shuttle_arrived() /datum/shuttle/ferry/emergency/long_jump(var/area/departing, var/area/destination, var/area/interim, var/travel_time, var/direction) @@ -18,11 +22,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 @@ -84,6 +83,10 @@ /obj/machinery/computer/shuttle_control/emergency/proc/has_authorization() return (authorized.len >= req_authorizations || emagged) +/obj/machinery/computer/shuttle_control/emergency/proc/reset_authorization() + //no need to reset emagged status. If they really want to go back to the station they can. + authorized = initial(authorized) + //returns 1 if the ID was accepted and a new authorization was added, 0 otherwise /obj/machinery/computer/shuttle_control/emergency/proc/read_authorization(var/ident) if (!ident) diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index f75193ea03..70901a513f 100644 --- a/code/modules/shuttles/shuttle_supply.dm +++ b/code/modules/shuttles/shuttle_supply.dm @@ -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 diff --git a/nano/templates/simple_docking_console_pod.tmpl b/nano/templates/simple_docking_console_pod.tmpl index 520d073907..676d2a1496 100644 --- a/nano/templates/simple_docking_console_pod.tmpl +++ b/nano/templates/simple_docking_console_pod.tmpl @@ -90,12 +90,21 @@ {{if docking_status == "docked"}} {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', null)}} {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : null)}} - {{:~link('MANUAL EJECT', 'alert', {'command' : 'toggle_override'}, 'disabled', null)}} {{else}} {{:~link('Force exterior door', 'alert', {'command' : 'force_door'}, override_enabled ? null : 'disabled', override_enabled? 'redBackground' : null)}} {{:~link('Override', 'alert', {'command' : 'toggle_override'}, null, override_enabled ? 'redBackground' : 'yellowBackground')}} - {{:~link('MANUAL EJECT', 'alert', {'command' : 'toggle_override'}, can_force ? null : 'disabled', can_force ? 'redBackground' : null)}} {{/if}} - \ No newline at end of file + +
+
+
+ {{if docking_status == "docked"}} + {{:~link('MANUAL EJECT', 'alert', {'command' : 'force_launch'}, 'disabled', null)}} + {{else}} + {{:~link('MANUAL EJECT', 'alert', {'command' : 'force_launch'}, can_force ? null : 'disabled', can_force ? 'redBackground' : null)}} + {{/if}} +
+
+
Syndicates