AAWi

KoS landing

Jan 31st, 2017
176
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.21 KB | None | 0 0
  1. //landing.ks
  2. // This program put your ship save on the ground (Or so we hope)!!
  3.  
  4. SAS off.
  5. RCS on.
  6. lights on.
  7. lock throttle to 0.
  8. list engines in ENGList.
  9.  
  10. clearscreen.
  11.  
  12. set runmode to 1.
  13.  
  14. until runmode = 0 {
  15.  
  16. if runmode = 1 {
  17. lock steering to retrograde.
  18. set TVAL to 0.
  19. wait 5.
  20. set runmode to 2.
  21. }
  22.  
  23. else if runmode = 2 {
  24. lock steering to retrograde.
  25. if SHIP:PERIAPSIS > -5000 {
  26. set TVAL to 1.
  27. }
  28. else if SHIP:PERIAPSIS < -5000 {
  29. set TVAL to 0.
  30. set runmode to 3.
  31. }
  32. }
  33.  
  34. else if runmode = 3 {
  35. lock steering to retrograde.
  36. set TVAL to 0.
  37. if (ALT:RADAR > 6000) {
  38. if WARP = 0 {
  39. wait 1.
  40. SET WARP TO 3.
  41. }
  42. }
  43. else if ALT:RADAR < 6000 {
  44. SET WARP to 0.
  45. set runmode to 4.
  46. }
  47. }
  48.  
  49. else if runmode = 4 {
  50. lock steering to retrograde.
  51. until ALT:RADAR < 5 {
  52. if -SHIP:VERTICALSPEED > ALT:RADAR/8 {
  53. set TVAL to MIN(1, TVAL + 0.01).
  54. }
  55. else {
  56. set TVAL to MAX(0, TVAL - 0.1).
  57. }
  58. wait 0.1.
  59. }
  60. if ALT:RADAR < 4 {
  61. set TVAL to 0.
  62. for eng in ENGList {
  63. if eng:stage = stage:number {
  64. eng:shutdown.
  65. }
  66. }
  67. set runmode to 10.
  68. }
  69. }
  70.  
  71. else if runmode = 10 {
  72. set TVAL to 0.
  73. panels on.
  74. lights on.
  75. unlock steering.
  76. print "The eagle has landed!(OH YEAH!)".
  77. set runmode to 0.
  78. }
  79.  
  80. global stagemaxthrust to ship:maxthrustat(0).
  81. when (ship:maxthrustat(0) < stagemaxthrust or (ship:maxthrustat(0) < 1)) then {
  82. if stage:ready {
  83. stage.
  84. wait 2.
  85. set throttle to TVAL.
  86. set stagemaxthrust to ship:maxthrustat(0).
  87. }
  88. if stage: number > 0 {
  89. preserve.
  90. }
  91. }
  92.  
  93. set finalTVAL to TVAL.
  94. lock throttle to finalTVAL.
  95.  
  96. print "RUNMODE: " + runmode + " " at (5,4).
  97. print "ALTITUDE: " + round(ALT:RADAR) + " " at (5,5).
  98. print "V-SPEED: " + round(SHIP:VERTICALSPEED) + " " at (5,6).
  99. print "PERIAPSIS: " + round(SHIP:PERIAPSIS) + " " at (5,7).
  100. }
Advertisement
Add Comment
Please, Sign In to add comment