diff --git a/code/controllers/emergency_shuttle_controller.dm b/code/controllers/emergency_shuttle_controller.dm index 93fa0b79f16..a4d63464124 100644 --- a/code/controllers/emergency_shuttle_controller.dm +++ b/code/controllers/emergency_shuttle_controller.dm @@ -155,9 +155,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 diff --git a/code/modules/admin/player_panel.dm b/code/modules/admin/player_panel.dm index 977239f92f5..ac67a624e35 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 df21a2372f1..5990b64ceb8 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/shuttles/shuttle.dm b/code/modules/shuttles/shuttle.dm index db215c26b54..34a5d1e1380 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 d6f76819672..d6a9858c8a5 100644 --- a/code/modules/shuttles/shuttle_emergency.dm +++ b/code/modules/shuttles/shuttle_emergency.dm @@ -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 diff --git a/code/modules/shuttles/shuttle_supply.dm b/code/modules/shuttles/shuttle_supply.dm index f75193ea032..70901a513f9 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
Syndicates