Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- lock liquidmatched to min(ship:oxidizer * 9 / 11, ship:liquidfuel).
- lock NukeLiquid to max(0, ship:liquidfuel-liquidmatched).
- lock nukedv to Round(800 * 9.81 * ln(ship:mass / (ship:mass - (NukeLiquid * 0.005))), 5).
- lock oxidizermatched to min(ship:oxidizer, ship:liquidfuel * 11 / 9).
- lock vectordv to Round(315 * 9.81 * ln((ship:mass - (NukeLiquid * 0.005)) / ((ship:mass - (NukeLiquid * 0.005)) - (liquidmatched * 0.005) - (oxidizermatched * 0.005))), 5).
- bays off. brakes off. rcs on.
- function SetEngines {
- parameter targetMode to "Activate Engine".
- parameter engines to ship:partsdubbedpattern("vector").
- for engine in engines {
- if engine:hasmodule("ModuleEnginesFx") set m to engine:getmodule("ModuleEnginesFx").
- if engine:hasmodule("ModuleEngines") set m to engine:getmodule("ModuleEngines").
- if m:hasaction(targetMode) m:doaction(targetMode, true).
- }
- }
- function ThrustLimit {
- parameter targetEngines.
- parameter targetThrust.
- for eng in targetEngines set eng:thrustlimit to targetThrust.
- }
- function SetAngle {
- parameter targetangle.
- for s in servos if s:hasfield("target angle") s:setfield("target angle", targetangle).
- }
- function info {
- parameter message.
- set logmessage to round(missionTime,1) + ": " + message.
- print logmessage.
- }
- copypath("0:","1:").
- for i in range(terminal:height-3) Print "":padright(terminal:width).
- set steeringmanager:rollcontrolanglerange to 180.
- set takeoffspeed to 100.
- set targetOrbitAltitude to 101e3.
- set vectors to ship:partsdubbedpattern("vector").
- set nukes to ship:partsdubbedpattern("nuc").
- set servos to ship:modulesnamed("ModuleRoboticRotationServo").
- lock p to choose 0 if airspeed < takeoffspeed else min(25,max(0,groundspeed/7.5)).
- lock steering to heading(270,p).
- SetEngines("Activate Engine", vectors).
- lock throttle to targetOrbitAltitude-apoapsis.
- lock angletarget to 0.
- when altitude > 15 then {
- gear off.
- info("engage dynamic servo").
- lock angletarget to max(0, min(90,100 - ((-verticalspeed + (20-altitude)/1.5)*100))).
- //set p to 10.
- }
- info("initialize vtols").
- lock vlimit to (-verticalspeed + (20-altitude))*100.
- set vlimitcopy to vlimit.
- set anglecopy to angletarget.
- when abs(vang(ship:facing:vector, heading(270,0):vector)) < 5 then {
- SetEngines("Activate Engine", ship:partsdubbedpattern("turbofan")).
- }
- until vlimit < 0 and airspeed > 100 {
- set vlimitcopy to vlimit.
- set anglecopy to angletarget.
- ThrustLimit(vectors, vlimitcopy).
- //SetAngle(anglecopy).
- print " v thrust: " + vlimitcopy at (0,0).
- print "servo angle: " + anglecopy at (0,1).
- print " p: " + p at (0,2).
- wait 0.
- }
- info("store vtols").
- SetEngines("Shutdown Engine", vectors).
- SetAngle(90).
- print " v thrust: " + vlimitcopy at (0,0).
- print "servo angle: " + anglecopy at (0,1).
- info("gain speed").
- lock aoa to vang(srfprograde:vector, ship:facing:vector).
- lock p to max(aoa+0.5,min(45, aoa+(airspeed-400)/5 )).
- fuelcells on.
Add Comment
Please, Sign In to add comment