Advertisement
Jontu

homejeb.lua

Aug 18th, 2012
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 1.53 KB | None | 0 0
  1. --
  2. -- Script by Jontu
  3. -- Deorbit script from "GoHome" by olex, essential to this script!
  4. --
  5. function HomeDriver()  
  6.     print "Lifting off..."
  7.     mechjeb.autoStageActivate()
  8.     mechjeb.launchTo(10000, 0) --orbit
  9.     wait(mechjeb.free)
  10.    
  11.     print "Moving to deorbit burn point..."
  12.     print "Prepare to abort warp!"
  13.     print "-45 lon for Mun."
  14.     print "+20 lon for Minmus."
  15.     mechjeb.warpToEvent("Soi")
  16.     --wait(vessel.Longitude == -44)  value not available yet
  17.     --mechjeb.controlRelease() Need way to kill time warp
  18.     wait(mechjeb.free)
  19.    
  20.     print "Executing deorbit burn..."
  21.     mechjeb.attitudeTo("forward", "orbit")
  22.     mechjeb.thrustActivate(100)
  23.     --
  24.     -- Only possible with this idea from olex
  25.     --
  26.     while vessel.orbitEccentricity < 1 do
  27.         wait(0.25)
  28.     end
  29.     mechjeb.thrustDeactivate()
  30.        
  31.     print "Warping to Mun escape..."
  32.     mechjeb.warpToEvent("soi")
  33.     wait(mechjeb.free)
  34.    
  35.     print "Adjusting Pe..."
  36.     mechjeb.changePe(30000)
  37.     wait(mechjeb.free)
  38.    
  39.     print "Warping to Kerbin..."
  40.     mechjeb.warpToEvent("Pe")
  41.     --wait(vessel.atmosphericDensity <= 0)
  42.     while vessel.atmosphericDensity <= 0 do
  43.         wait(0.25)
  44.     end
  45.     wait(1)
  46.     print "Entering atmosphere..."
  47.     mechjeb.controlRelease()-- would like a way to close this window
  48.    
  49.     --wait(vessel.altitudeASL < 20000)
  50.     while vessel.altitudeASL > 20000 do
  51.         wait(0.25)
  52.     end
  53.     print "Landing..."
  54.     mechjeb.autoStageActivate()
  55.     mechjeb.land()
  56.     wait(mechjeb.free)
  57.     print "Home again, home again"
  58.  
  59. end
  60.  
  61. function Home()
  62.     local co = coroutine.create(HomeDriver)
  63.     coroutine.resume(co)
  64. end
  65.  
  66. print "Usage: Home()"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement