mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2026-01-06 07:23:16 +00:00
long_jump() now uses an arrive_time var instead of sleeping the whole time.
Makes ETAs more accurate, allows the possibility of interrupting long_jumps in the future.
This commit is contained in:
@@ -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
|
||||
|
||||
@@ -400,13 +400,18 @@
|
||||
if (!emergency_shuttle.online())
|
||||
dat += "<a href='?src=\ref[src];call_shuttle=1'>Call Shuttle</a><br>"
|
||||
else
|
||||
var/timeleft = emergency_shuttle.estimate_launch_time()
|
||||
switch(emergency_shuttle.location())
|
||||
if(1)
|
||||
dat += "ETA: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
|
||||
dat += "<a href='?src=\ref[src];call_shuttle=2'>Send Back</a><br>"
|
||||
if(0)
|
||||
dat += "ETA: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
|
||||
if (emergency_shuttle.wait_for_launch)
|
||||
var/timeleft = emergency_shuttle.estimate_launch_time()
|
||||
dat += "ETL: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
|
||||
|
||||
else if (emergency_shuttle.shuttle.has_arrive_time())
|
||||
var/timeleft = emergency_shuttle.estimate_arrival_time()
|
||||
dat += "ETA: <a href='?src=\ref[src];edit_shuttle_time=1'>[(timeleft / 60) % 60]:[add_zero(num2text(timeleft % 60), 2)]</a><BR>"
|
||||
dat += "<a href='?src=\ref[src];call_shuttle=2'>Send Back</a><br>"
|
||||
|
||||
if (emergency_shuttle.shuttle.moving_status == SHUTTLE_WARMUP)
|
||||
dat += "Launching now..."
|
||||
|
||||
dat += "<a href='?src=\ref[src];delay_round_end=1'>[ticker.delay_end ? "End Round Normally" : "Delay Round End"]</a><br>"
|
||||
if(ticker.mode.syndicates.len)
|
||||
dat += "<br><table cellspacing=5><tr><td><B>Syndicates</B></td><td></td></tr>"
|
||||
|
||||
@@ -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"])
|
||||
|
||||
@@ -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
|
||||
return
|
||||
|
||||
//returns 1 if the shuttle has a valid arrive time
|
||||
/datum/shuttle/proc/has_arrive_time()
|
||||
return (moving_status == SHUTTLE_INTRANSIT)
|
||||
@@ -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
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
|
||||
Reference in New Issue
Block a user