Advertisement
sumguytwitches

time at 10k

Nov 11th, 2020 (edited)
588
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // !runscript sdSjGdf5
  2. function dosearch {
  3. set searching to true.
  4. if not (defined taralt) set taralt to body:atm:height.
  5. set rt to time:seconds + eta:periapsis.
  6. if periapsis > taralt { print "periapsis above target, will never arrive.". set searching to false.}
  7. lock altthen to body:altitudeof(positionat(ship,rt)).
  8. if not (defined wiggle ) set wiggle to 1000.
  9. set step to choose eta:periapsis if ship:status = "ESCAPING" else orbit:period/2.5.
  10. set iterations to 0.
  11. until abs(altthen -taralt ) < wiggle and searching {
  12. if altthen < taralt { set rt to rt - step. set step to step / 2. wait 0. set iterations to iterations + 1. }
  13. if altthen > taralt { set rt to rt + step. set step to step / 2. wait 0. set iterations to iterations + 1. }
  14. }
  15.  
  16. lock rteta to rt - time:seconds.
  17. print "rt is timestamp of " + round(altthen) + " m".
  18. }.
  19. dosearch().
  20. //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