Guest User

Spaceplane.ks

a guest
Dec 30th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.79 KB | None | 0 0
  1. //Basic spaceplane ascent to orbit program
  2. //to be run after takeoff to avoid ship status 'landed' while flying bug.
  3.  
  4. FUNCTION waitUntilTopSpeed
  5. {
  6. DECLARE PARAMETER minAccel IS 0.01.
  7. SET topspeed TO SHIP:AIRSPEED.
  8. WAIT 3.
  9. UNTIL FALSE
  10. {
  11. set topspeed to SHIP:AIRSPEED.
  12. WAIT 1.
  13. IF SHIP:AIRSPEED - topspeed < minAccel
  14. BREAK.
  15. }
  16. }
  17.  
  18. BRAKES off.
  19. SAS off.
  20. Gear off.
  21.  
  22. lock steering to heading(90,15).
  23. lock targetspeed to max(200,altitude / 10).
  24. lock throttle to targetspeed / SHIP:AIRSPEED.
  25.  
  26. wait until altitude > 2500.
  27. set warp to 1.
  28.  
  29. wait until altitude > 8000.
  30. set warp to 2.
  31.  
  32. wait until altitude > 12000.
  33. lock steering to heading(90,5).
  34.  
  35. Toggle ag2. // Afterburner
  36. Waituntiltopspeed.
  37.  
  38. set warp to 0.
  39.  
  40. lock steering to heading (90, 18).
  41. //angle test results:
  42. //35: 23m/s. 30: 74m/s 25: 116m/s 20: 142m/s 15: 144m/s, but at 72849m apoapsis.
  43. //17: 145m/s, 73924m apo. 19: 146m/s, 74579 apo. 18:152m/s!!! 74344m apoapsis.
  44.  
  45. Toggle ag3. //Rocket engine
  46.  
  47. SET numOut to 0.
  48. UNTIL apoapsis > 75000
  49. {
  50. until numOut > 0
  51. {
  52. LIST ENGINES IN engines.
  53. FOR eng IN engines
  54. {
  55. IF eng:FLAMEOUT
  56. {
  57. SET numOut TO numOut + 1.
  58. }
  59. }
  60. if numOut > 0 { Toggle ag1. Toggle ag2. }.
  61. }
  62. }
  63.  
  64. lock throttle to 0.
  65. lock steering to prograde.
  66.  
  67. set warp to 3.
  68. Wait until altitude > 70000.
  69. set warp to 0.
  70.  
  71. WAIT UNTIL KUNIVERSE:CANQUICKSAVE.
  72. KUNIVERSE:QUICKSAVETO("_Script node ahead").
  73. PRINT "game saved to '_Script node ahead'".
  74.  
  75. //Exec maneuver node.
  76. Unlock all.
  77. SET SHIP:CONTROL:PILOTMAINTHROTTLE to 0.
  78. RUNPATH("0:/CIRCULARISEAPOAPSIS").
  79. RUNPATH("0:/EXECNODE").
  80.  
  81. WAIT UNTIL KUNIVERSE:CANQUICKSAVE.
  82. KUNIVERSE:QUICKSAVETO("_Script finished").
  83. PRINT "game saved to '_Script finished'".
  84. //RUNPATH("0:/PAUSEGAME.KS"). doesn't work. the pause part anyway.
Add Comment
Please, Sign In to add comment