Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- // !runscript sdSjGdf5
- function dosearch {
- set searching to true.
- if not (defined taralt) set taralt to body:atm:height.
- set rt to time:seconds + eta:periapsis.
- if periapsis > taralt { print "periapsis above target, will never arrive.". set searching to false.}
- lock altthen to body:altitudeof(positionat(ship,rt)).
- if not (defined wiggle ) set wiggle to 1000.
- set step to choose eta:periapsis if ship:status = "ESCAPING" else orbit:period/2.5.
- set iterations to 0.
- until abs(altthen -taralt ) < wiggle and searching {
- if altthen < taralt { set rt to rt - step. set step to step / 2. wait 0. set iterations to iterations + 1. }
- if altthen > taralt { set rt to rt + step. set step to step / 2. wait 0. set iterations to iterations + 1. }
- }
- lock rteta to rt - time:seconds.
- print "rt is timestamp of " + round(altthen) + " m".
- }.
- dosearch().
- //todo: incorporate stopping distance using velocityat of ground and gravity of ground to be able to warp to a buffered distance above ground print velocity:surface:mag^2/((2*maxthrust/mass)-body:mu/((body:radius + 2500)^2)).
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement