Advertisement
Guest User

Untitled

a guest
Dec 13th, 2023
95
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.63 KB | None | 0 0
  1. CLEARSCREEN.
  2. LOCAL termWidth IS TERMINAL:WIDTH.
  3. set mode to 2.
  4. if ALT:RADAR < 100 {
  5. set mode to 1.
  6. }
  7.  
  8. until mode = 0 { //mode 0 ends launch program
  9. if mode = 1 {
  10. print "Welcome Commander,".
  11. wait 5.
  12. print "Press ENTER to proceed with launch.".
  13. wait 1.
  14. print "Press BACKSPACE to abort.".
  15. set launchDecision to terminal:input:getchar().
  16. if launchDecision = terminal:input:enter {
  17. print "Proceeding with Launch Initialization...".
  18. wait 5.
  19. clearscreen.
  20. print "Loading Guidance and Launch initialization...".
  21. wait 5.
  22. set mode to 2.
  23. }
  24. if launchDecision = terminal:input:backspace {
  25. clearscreen.
  26. print "Aborting Launch Initialization...".
  27. wait 5.
  28. clearscreen.
  29. wait 5.
  30. set mode to 0.
  31. }
  32. }
  33.  
  34. if mode = 2 { //mode 2 is launch initialization
  35. print "Counting down:".
  36. from {local countdown is 15.} until countdown = -1 step {set countdown to countdown -1.} do {
  37. if maxThrust < 1490 and countdown < 3 {
  38. clearscreen.
  39. print "ABORT MODE INITIATED.".
  40. set mode to 0.
  41. break.
  42. }
  43. print "..." + countdown.
  44. wait 1.
  45. WHEN COUNTDOWN = 10 THEN {
  46. STAGE. //hydrogen burn off
  47. }
  48. WHEN COUNTDOWN = 7 THEN {
  49. LOCK THROTTLE TO 0.3.
  50. }
  51. WHEN COUNTDOWN = 6 THEN {
  52. STAGE. //MES
  53. }
  54. WHEN COUNTDOWN = 5 THEN {
  55. LOCK THROTTLE TO 0.7.
  56. }
  57. WHEN COUNTDOWN = 3 THEN {
  58. LOCK THROTTLE TO 1.0.
  59. }
  60. WHEN COUNTDOWN = 4 THEN {
  61. LOCK STEERING TO HEADING (0,90).
  62. }
  63. WHEN COUNTDOWN = 0 THEN {
  64. STAGE.
  65. clearscreen.
  66. set mode to 3.
  67. }
  68. }
  69. }
  70.  
  71. else if mode = 3 { //mode 3 is initial ascent and roll program.
  72. print ship:apoapsis.
  73. LOCK STEERING TO HEADING (0,90).
  74.  
  75. WAIT 4.
  76.  
  77. LOCK STEERING TO HEADING (35,90,180).
  78.  
  79. WAIT 6.
  80.  
  81. LOCK STEERING TO HEADING (35,85,180).
  82.  
  83. wait 1.
  84.  
  85. LOCK STEERING TO HEADING (35,80,180).
  86.  
  87. WAIT 10.
  88. set mode to 4.
  89. }
  90.  
  91. else if mode = 4 {
  92. UNTIL SHIP:ALTITUDE > 50000 {
  93. set targetPitch to max ( 15, 80 * (1 - ship:altitude / 50000)).
  94. LOCK STEERING TO HEADING (35, targetPitch, 180).
  95. }.
  96. UNTIL SHIP:ALTITUDE > 70000 {
  97. set targetPitch to max ( 5, 15 * (1 - ship:altitude / 70000)).
  98. LOCK STEERING TO HEADING (45, targetPitch, 180).
  99. }.
  100. set mode to 5.
  101. }
  102.  
  103. else if mode = 5 {
  104. SET targetRoll to 180.
  105. UNTIL targetroll = 0 {
  106. lock steering to heading (45,24, targetRoll).
  107. wait 0.1.
  108. set targetRoll to targetRoll - 1.
  109. lock steering to heading (45,24, targetRoll).
  110. }
  111. UNTIL SHIP:APOAPSIS > 150000 {
  112. LOCK STEERING TO HEADING (45, 24, 0).
  113. }.
  114. UNTIL SHIP:PERIAPSIS > 25000 {
  115. lock throttle to 0.3.
  116. LOCK STEERING TO HEADING (45, 0, 0).
  117. }.
  118. set mode to 6.
  119. }
  120.  
  121. else if mode = 6 {
  122. UNLOCK THROTTLE.
  123.  
  124. LOCK THROTTLE TO 0.0.
  125.  
  126. wait 30.
  127.  
  128. sas on.
  129. rcs on.
  130. lock steering to ship:facing.
  131. wait 5.
  132. stage.
  133. wait 1.
  134.  
  135. set ship:control:top to 1.
  136. wait 5.
  137. set ship:control:top to 0.
  138.  
  139. WAIT 1.
  140. unlock steering.
  141. clearscreen.
  142. print "Launch Program Concluded".
  143. set mode to 0.
  144. }
  145.  
  146. wait 0.
  147. print ("MODE: " + mode):padright(termWidth) at (5,4).
  148. PRINT ("Vertical speed: " + SHIP:VERTICALSPEED):PADRIGHT(termWidth) AT(5,5).
  149. PRINT ("Horizontal speed: " + VXCL(UP:VECTOR,SHIP:VELOCITY:SURFACE):MAG):PADRIGHT(termWidth) AT(5,6).
  150. PRINT ("Impact distance: " + ALT:RADAR):PADRIGHT(termWidth) AT(5,7).
  151. wait 0.
  152. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement