Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- parameter orbitHeight is 80000, nosekicker is false.
- function updateReadouts{
- print "Step: "+step+" " AT(0,0).
- print "Target Orbit "+orbitHeight/1000+"km " AT(0,2).
- print "Steering Direction = "+round(steeringDir,3)+" " AT(0,3).
- print "Pitch = "+round(shipPitch,3)+" " AT(0,4).
- print genoutputmessage+" " AT(0,6).
- }
- //RUN functions.ks.
- CLEARSCREEN.
- BRAKES ON.
- if(DEFINED step){
- }else{
- SET step to "Launch".
- SET looping to TRUE.
- SET thrott to 0.
- SET steeringDir to 90.
- SET shipPitch to 0.7.
- SET genoutputmessage TO "".
- LOCK THROTTLE to thrott.
- LOCK STEERING TO HEADING(steeringDir, shipPitch).
- WHEN ALT:RADAR>25 THEN {
- SET step TO "Retracting Landing Gear.".
- GEAR OFF.
- WAIT 4.
- SET step TO "Ascent".
- RETURN FALSE.
- }
- WHEN SHIP:ALTITUDE>6500 THEN {
- SET shipPitch to 15.
- RETURN FALSE.
- }
- WHEN SHIP:ALTITUDE>21000 THEN {
- AG1 ON.
- SET step TO "Closed Cycle Ascent.".
- RETURN FALSE.
- }
- WHEN ORBIT:APOAPSIS>50000 THEN {
- LOCK STEERING TO SHIP:PROGRADE:VECTOR.
- AG9 ON.
- IF ORBIT:APOAPSIS>orbitHeight+250{
- SET thrott to 0.
- SET step TO "Coasting.".
- RETURN FALSE.
- }
- RETURN TRUE.
- }
- UNTIL looping = false {
- updateReadouts().
- if(step="Launch"){
- STAGE.
- BRAKES OFF.
- SAS OFF.
- RCS OFF.
- SET thrott TO 1.
- SET step TO "Takeoff".
- }
- if(step="Takeoff"){
- if SHIP:GROUNDSPEED+VERTICALSPEED>125{
- if(nosekicker="true"){
- SET noseEngines TO SHIP:PARTSTAGGED("noselifters").
- FOR item IN noseEngines{
- item:Activate().
- }
- }
- SET shipPitch to 10.
- WAIT 5.
- if(nosekicker="true"){
- FOR item IN noseEngines{
- item:Shutdown().
- }}
- SET adjustment TO false.
- SET step TO "Ascent".
- }}
- if(step="Coasting."){
- if SHIP:ALTITUDE>69999{
- LOCK STEERING TO HEADING(steeringDir, shipPitch).
- SET shipPitch to 0.
- AG2 ON.
- AG3 ON.
- }
- SET shipPitch to 0.
- if(eta:apoapsis<3){
- SET thrott to 1.
- SET shipPitch to 0.
- SET targetAP to SHIP:APOAPSIS+150.
- SET step TO "Circularization.".
- }}
- if(step="Circularization."){
- if(SHIP:PERIAPSIS>20000){
- SET thrott to 0.5.
- }else{
- SET thrott to 1.
- }
- if(eta:apoapsis>500){
- SET shipPitch to 6.
- }else{
- SET shipPitch to -1.
- }
- if(targetAP < SHIP:APOAPSIS){
- SET thrott to 0.
- SET step TO "end".
- }}
- if(step="end"){
- SET thrott TO 0.
- SET looping TO false.
- UNLOCK STEERING.
- CLEARSCREEN.
- Print "Orbit complete. Exiting Program.".
- }}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement