Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //code originally taken from r/kos but heavily modified
- print "PROGRAM START".
- set stageinfo to list(ship:mass, 305*9.8065, ship:partsnamed("RAPIER"):length*180, 1, 1, 9999, 9999).//this creates a dv file for use by exec.ks
- switch to 1.
- set json to list().
- until stage:number = json:length {
- json:add(list(1,1,1,1,1,1,1)).
- }
- json:add(stageinfo).
- writejson(json,"dv.json").
- switch to 0.
- SET SHIP:CONTROL:PILOTMAINTHROTTLE TO 0.
- lock throttle to 1.
- stage.
- print " Throttle up".
- LOCK STEERING TO HEADING(90, 0).
- wait until SHIP:VELOCITY:SURFACE:MAG > 80.
- print " Take off".
- LOCK STEERING TO HEADING(90, 9).
- wait until SHIP:ALTITUDE > 75.//keep the plane at constant pitch to not lose any rear engines
- print "Retracting landing gear".
- GEAR OFF.
- wait 2.
- print " Climbing".
- LOCK STEERING TO HEADING(90, SHIP:VELOCITY:SURFACE:MAG/25).//pitch depends on speed
- lock throttle to 1-max((SHIP:VELOCITY:SURFACE:MAG-600)/200,0).//throttling down if speed goes too high in this phase
- wait until SHIP:ALTITUDE > 10000.
- print "SPEED BURN".
- LOCK STEERING TO HEADING(90, (12000-SHIP:ALTITUDE)/2000*SHIP:VELOCITY:SURFACE:MAG/25+(SHIP:ALTITUDE-10000)/2000*8).//this gradually pitches the ship to 8 degrees
- lock throttle to 1.
- wait until SHIP:ALTITUDE > 12000.
- LOCK STEERING TO HEADING(90, 9).
- wait until SHIP:ALTITUDE > 18000.
- print "ORBIT BURN".
- LOCK STEERING TO HEADING(90, 30-(28000-SHIP:ALTITUDE)/10000*22).//this gradually pitches the ship to 30 degrees
- wait until ship:maxthrust < 60*ship:partsnamed("RAPIER"):length.
- ag1 on.//start the rocket engine
- LOCK STEERING TO HEADING(90, 30).
- print "Waiting for orbital apoapsis".
- wait until apoapsis > 75000.
- LOCK STEERING TO HEADING(90, 10).
- lock throttle to min(max((75000-apoapsis)/50,0),1).//keeping apoapsis at 75000 despite air resistance
- wait until altitude > ship:body:atm:height.
- run circ.
- run exec.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement