Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- VTOL start Mun Space Plane From Muun To KSC /Horizontal Land/
- -- it is better start when KSC is on oposite side od kerbin from muun
- -- spmunksc 1.1
- -- script written by mager42
- -- script partialy based off shtutle land by olex
- -- credits to olex and r4m0n
- function GoKSCDriver(ArPe, offset)
- if (ArPe == nil) then
- ArPe = 31
- end
- print "Start to to parking orbit"
- mechjeb.launchTo(21000 , -180)
- wait(mechjeb.free)
- print "Orbiting"
- print "Go to inclination change point, u can warp but must stop warp before Equator"
- if vessel.latitude < 0 then
- while vessel.latitude < (-0.8) do
- wait(3)
- end
- print "Start inclination change"
- mechjeb.attitudeTo("left", "ORBIT")
- wait(12)
- mechjeb.thrustActivate(100)
- while vessel.orbitInclination < 172 do
- wait(0.1)
- end
- mechjeb.thrustDeactivate()
- mechjeb.thrustActivate(10)
- while vessel.orbitInclination < 179.1 do
- wait(0.5)
- end
- mechjeb.thrustDeactivate()
- else
- while vessel.latitude > 0.8 do
- wait(3)
- end
- print "Start inclination change"
- mechjeb.attitudeTo("rigth", "ORBIT")
- wait(12)
- mechjeb.thrustActivate(100)
- while vessel.orbitInclination > 8 do
- wait(0.1)
- end
- mechjeb.thrustDeactivate()
- mechjeb.thrustActivate(10)
- while vessel.orbitInclination > 0.9 do
- wait(0.5)
- end
- mechjeb.thrustDeactivate()
- end
- print "Inclination Changed"
- print "Go to escape burn point, u can warp but must stop warp before -120 N"
- while vessel.longitude > (-123) do
- wait(3)
- end
- print "Start escape burn"
- mechjeb.attitudeTo("forward", "ORBIT")
- wait(14)
- mechjeb.thrustActivate(100)
- while vessel.speedOrbital < 800 do
- wait(0.5)
- end
- mechjeb.thrustDeactivate()
- mechjeb.thrustActivate(10)
- while vessel.speedOrbital < 842 do
- wait(0.5)
- end
- mechjeb.thrustDeactivate()
- print "warp out off Muun SOI"
- mechjeb.warpToEvent("SoI")
- wait(mechjeb.free)
- wait(1)
- print "Lovering PE"
- mechjeb.attitudeTo("back", "ORBIT_HORIZONTAL")
- wait(12)
- mechjeb.changePe(ArPe * 1000)
- wait(mechjeb.free)
- wait(1)
- print "Start Landing Program"
- -- KSP coordinates
- lat = -0.103
- lon = -74.575
- if (offset == nil) then
- offset = 132 -- default offset
- end
- lon = lon - (offset / 10) -- 1° ~= 10km near the KSP
- slope = 3
- -- start re-entry sequence
- --first areobrake
- mechjeb.warpToEvent("Pe")
- while vessel.altitudeASL > 75000 do
- wait(3)
- end
- mechjeb.controlRelease()
- print "Areobraking"
- wait(8)
- mechjeb.attitudeTo({0,0,0,0}, "ORBIT_HORIZONTAL")
- while vessel.altitudeASL > 55000 do
- wait(5)
- end
- print "."
- mechjeb.attitudeTo({0,6,10}, "ORBIT_HORIZONTAL")
- while vessel.altitudeASL < 70000 do
- wait(5)
- end
- print "Warp to Ap"
- mechjeb.warpToEvent("Ap")
- wait(mechjeb.free)
- print "Adjust PE"
- mechjeb.attitudeTo("forward", "ORBIT_HORIZONTAL")
- wait(8)
- mechjeb.changePe(70000)
- wait(mechjeb.free)
- print "Deorbiting..."
- mechjeb.landAt(lat, lon, false)
- wait(111)
- mechjeb.warpToEvent("Pe")
- -- at 75km
- while vessel.altitudeASL > 75000 do
- wait(4)
- end
- print "Beginning re-entry, hold onto something..."
- mechjeb.controlRelease()
- wait(8)
- mechjeb.attitudeTo({0,0,0,0}, "ORBIT_HORIZONTAL")
- -- at 55km
- while vessel.altitudeASL > 55000 do
- wait(4)
- end
- print "."
- mechjeb.attitudeTo({0,5,10}, "ORBIT_HORIZONTAL")
- -- at 18km
- while vessel.altitudeASL > 19000 do
- wait(4)
- end
- print "."
- mechjeb.attitudeTo({0,2,10}, "ORBIT_HORIZONTAL")
- -- at 15km: engage the ILS
- while vessel.altitudeASL > 16000 do
- wait(3)
- end
- print "Initiating ILS approach, please lower landing gear manually."
- ils = mechjeb.getModule("ils")
- ils.glideslope = slope
- mechjeb.ilsLand()
- mechjeb.thrustActivate(8)
- -- at 180
- while vessel.altitudeTrue > 180 do
- wait(3)
- end
- print "Shut Down Engines."
- mechjeb.thrustDeactivate()
- -- at 6m (immediately before touchdown)
- while vessel.altitudeTrue > 6 do
- wait(3)
- end
- print "Touching down, You can hit the brakes now."
- wait(3)
- mechjeb.controlRelease() -- stop ILS sequence
- mechjeb.attitudeTo({1,0,0,0}, "SURFACE_NORTH")
- mechjeb.stage() -- in case there actually are braking chutes
- -- at <2 m/s, we're done
- while vessel.speedSurface > 2 do
- wait(4)
- end
- print "Welcome home. Roll out off runway"
- mechjeb.attitudeTo("back", "SURFACE_NORTH")
- wait(42)
- mechjeb.controlRelease()
- print "End of roll."
- end
- function goksc(ArPe, offset)
- local co = coroutine.create(GoKSCDriver)
- coroutine.resume(co, ArPe, offset)
- end
- print "Usage: goksc(AeroBrake Pe, Landing offset) - default 31km, 132km"
- print "Set Ascent A. to start turn at 0km, end at 20km"
- print " and stop staging before stage with chute"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement