Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- set ship:control:pilotmainthrottle to 0.
- sas on.
- rcs on.
- set tset to 0.
- lock throttle to tset.
- clearscreen.
- set mode to 1.
- until mode = 0 {
- if mode = 1 {
- set tset to 1.
- print "Launch..".
- set mode to 2.
- }
- if mode = 2 {
- local altS is 1000.
- local altEND is body:atm:height * 0.9.
- local altPER is min(1, max(0,alt:radar-altS)/(altEND-altS)).
- local endPitch is 1.
- local expo is 0.7.
- local pitch is endPitch + (90-endPitch)*(1-altPER^(expo-(altPER/(1/expo)))).
- lock steering to heading(90,pitch).
- if ship:altitude > 62000 {
- set mode to 3.
- }
- }
- if mode = 3 {
- stage.
- set dV to ship:facing:vector:normalized.
- lock steering to lookdirup(dV,ship:facing:topvector).
- local timeout is time:seconds + 9000.
- when dV:mag < 0.05 then set timeout to time:seconds + 3.
- until dV:mag < 0.02 or time:seconds > timeout {
- set posVec to ship:position - body:position.
- set vecNormal to vcrs(posVec,velocity:orbit).
- set vecHorizontal to -1 * vcrs(ship:position - body:position, vecNormal).
- set vecHorizontal:mag to sqrt(body:mu/(body:radius + ship:altitude)).
- set dV to vecHorizontal - velocity:orbit.
- }
- }
- //staging
- if stage:number > 2 {
- if maxthrust = 0 {
- stage.
- print "Staging-no thrust..".
- wait 1.
- }
- set engout to 0.
- list engines in engines.
- for eng in engines {
- if eng:flameout {
- set engout to engout + 1.
- }
- }
- if engout > 0 {
- stage.
- print "Staging-engine out..".
- wait 1.
- }
- }
- //fairings
- if ship:altitude > 40000 {
- for fairing in ship:modulesnamed("ProceduralFairingDecoupler"){
- fairing:doevent("jettison").
- print "Fairing jettison.".
- }
- }
- wait 0.01.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement