portablejim

ssto-r15.ks

Feb 27th, 2021 (edited)
93
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.12 KB | None | 0 0
  1. //run launch_to_orbit
  2. lock steering to prograde.
  3. print "Enabling solar before fairings".
  4. panels on.
  5. print "Faring deploy".
  6. stage.
  7. wait 5.
  8. print "Booster separation".
  9. stage .
  10. wait 1.
  11. stage .
  12. if ship:partstaggedpattern("booster"):length > 0 {
  13. print "Preparing for deorbit:".
  14. print " * point retrograde".
  15. print " * move remaining fuel to the other end of the rocket.".
  16. lock steering to lookDirUp(retrograde:forevector, sun:position).
  17. set steeringmanager:maxstoppingtime to 5.
  18. set transferFuel to transferall("LiquidFuel", ship:partstagged("toptank"), ship:partstagged("bottomtank")). set transferFuel:active to true.
  19. set transferOx to transferall("Oxidizer", ship:partstagged("toptank"), ship:partstagged("bottomtank")). set transferOx:active to true.
  20.  
  21. when transferFuel:status = "Finished" then {
  22. print "Deorbit prep completed. Warping close to deorbit point.".
  23. when geoposition:lng > 140 then set warp to 1.
  24. when geoposition:lng > 150 then set warp to 0.
  25. set warp to 3.
  26. }
  27.  
  28. when geoposition:lng > 161.5 then {
  29. print "Deorbit burn".
  30. lock throttle to 1.
  31. when periapsis < 30_000 then {
  32. lock throttle to 0.25.
  33. when periapsis < 25_000 then {
  34. lock throttle to 0.
  35. print "Deorbit burn completed. Preparing for reentry.".
  36. lock steering to lookDirUp(srfretrograde:forevector, sun:position).
  37. brakes on.
  38.  
  39. wait 5.
  40.  
  41. print "Warping to atmosphere.".
  42. set warp to 2.
  43. when altitude < (body:atm:height + 400) then {
  44. print "Warping to thicker parts of the atmosphere.".
  45. set warp to 0.
  46. set warpmode to "physics".
  47. set warp to 3.
  48. when altitude < 25000 then
  49. {
  50. print "Now in real time".
  51. set warp to 0.
  52. }
  53. }
  54.  
  55.  
  56. when geoposition:lng > -49.0 and geoposition:lng < -45 then {
  57. print "Near KSC".
  58. if airspeed > 380 {
  59. print "Still too fast, slowing down.".
  60. when airspeed < 385 then {
  61. lock throttle to 0.
  62. }
  63. lock throttle to 1.
  64. }
  65.  
  66. }
  67. when geoposition:lng > -48.4 and geoposition:lng < -45 then {
  68. if geoposition:lng > -48.4 and geoposition:lng < -45 {
  69. print "Over KSC".
  70. } else {
  71. print "Lithobraking imminent... slowing down".
  72. }
  73. stage.
  74. when airspeed < 150 then {
  75. lock steering to lookDirUp( up:forevector, ship:facing:topvector).
  76. gear on.
  77. }
  78. }
  79. }
  80. }
  81. }
  82. } else {
  83. print "Something is not right. I am not a booster.".
  84. }
Add Comment
Please, Sign In to add comment