Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- --
- -- Script modified from FlyMeToTheMun by Jontu
- -- Original script by R4m0n
- --
- function KMunDriver(alt, lat, lon)
- if lat == "il" or lon == "il"
- then
- elseif math.abs(lat) > 180 or math.abs(lon) > 180
- then
- print "Invalid coordinates"
- print "Values must be between -180 and 180"
- os.exit()
- end
- print "Launching..."
- mechjeb.launchTo(alt*1000, 0)
- wait(mechjeb.free)
- mechjeb.autoStageActivate()
- print "TMI..."
- mechjeb.transfer("Mun", 200000)
- wait(mechjeb.free)
- print "Warping to SoI..."
- mechjeb.warpToEvent("soi")
- wait(mechjeb.free)
- print "Adjusting Pe..."
- mechjeb.changePe(30000)
- wait(mechjeb.free)
- print "Warping to Pe..."
- mechjeb.warpToEvent("pe", 15)
- wait(mechjeb.free)
- print "Circularizing orbit..."
- mechjeb.circularize()
- wait(mechjeb.free)
- m = mechjeb.getModule("OrbitOper")
- m.enabled = false
- print "Landing..."
- if (lat == "il" or lon == "il")
- then
- m = mechjeb.getModule("LandingAutopilot")
- m.enabled = true
- mechjeb.land()
- else
- mechjeb.landAt(lat, lon)
- end
- wait(mechjeb.free)
- mechjeb.autoStageDeactivate()
- print "Landed!"
- print "Attempting to stabilize..."
- mechjeb.attitudeTo("up","orbit")
- wait(2)
- mechjeb.controlRelease()
- m = mechjeb.getModule("LandingAutopilot")
- m.enabled = false
- print "What now boss?"
- end
- function KMun(alt, lat, lon)
- local co = coroutine.create(KMunDriver)
- coroutine.resume(co, alt, lat, lon)
- end
- print "Usage: KMun(alt, lat, lon)"
- print "Alt is Kerbin Orbit Altitude in km"
- print "lat and lon are landing coordinates"
- print "Valid coordinates are -180 to 180 or il (in quotes) for immediate landing"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement