Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function info {
- parameter message.
- print char(7).
- set logmessage to round(missionTime,1):tostring():padleft(6) + ": " + message.
- print logmessage.
- }
- for rap in ship:partsdubbedpattern("rapier") turbos:add(rap).
- for m in ship:modulesnamed("WBIModuleGeneratorFX") if m:hasevent("activate fusion power") m:doevent("activate fusion power").
- set steeringmanager:rollcontrolanglerange to 180.
- set proprad to 5.8.
- set complete to false.
- set chaseSpeed to 350.
- set turboSpeed to 300.
- set rotormods to ship:modulesnamed("ModuleRoboticServoRotor").
- set rotors to list().
- for rm in rotormods {
- local rotor to lexicon().
- if(rm:getfield("motor") <> "Unpowered")
- {
- set rotor["part"] to rm:part.
- set rotor["mod"] to rm.
- if rotor:part:parent:name:contains("bay") {
- set baymod to rotor:part:parent:getmodule("ModuleAnimateGeneric").
- if baymod:hasevent("open") baymod:doevent("open").
- }
- set rotor["blades"] to list().
- for bm in rm:part:ModulesNamed("ModuleControlSurface") {
- local b to bm:part.
- local blade to lexicon().
- set blade["mod"] to bm.
- set blade["offset"] to vdot(-b:Facing:starvector, b:position - b:parent:position).
- set blade["proprad"] to proprad.
- bm:setfield("deploy", true).
- rotor["blades"]:add(blade).
- }
- rotors:add(rotor).
- if rm:hasfield("torque limit(%)") rm:setfield("torque limit(%)", 100).
- }
- }
- lock rpmtarget to min(459,max(0, throttle * 460)).
- set props to true.
- on round(time:seconds * 20) {
- if props {
- set rpmcopy to rpmtarget.
- for rotor in rotors {
- rotor:mod:setfield("rpm limit", rpmcopy ).
- set calcAirspeed to (2 * constant:pi * (rotor:blades[0]:proprad + rotor:blades[0]:offset) * rpmcopy/60).
- set deploycopy to max(3, 4.5 + arctan2(airspeed, calcAirspeed)).
- for blade in rotor:blades {
- blade:mod:setfield("deploy angle", deploycopy).
- }
- }
- }
- return props.
- }
- set x to choose 90 if vang(heading(90,0):vector,ship:facing:vector) < 45 else 0.
- lock p to 0.
- lock steering to heading(x,p).
- brakes on.
- bays on.
- wait 4.
- brakes off.
- lock throttle to 1.
- SetAngle(15).
- startup(vectors).
- startup(turbos).
- when airspeed > 90 then {
- info("takeoff").
- set p to 10.
- }
- when airspeed > 110 then {
- info("climb").
- set p to 20.
- setangle(25).
- }
- when airspeed > 150 and apoapsis < 2000 then {
- info("vector full push").
- setangle(90).
- set p to 40.
- gear off.
- }
- when apoapsis > 2000 then {
- info("will clear mountain, locking to surface prograde").
- lock p to max(10,vang(srfprograde:vector,heading(x,0):vector)).
- }
- when airspeed > 300 then {
- info("put away props").
- set props to false.
- for rotor in rotors {
- rotor:mod:setfield("torque limit(%)", 0).
- rotor:mod:setfield("rpm limit", 0 ).
- for blade in rotor:blades {
- blade:mod:setfield("deploy angle", 90).
- }
- }
- for m in ship:modulesnamed("WBIModuleGeneratorFX") if m:hasevent("deactivate fusion power") m:doevent("deactivate fusion power").
- wait 0.
- bays off.
- }
- when airspeed > turboSpeed then {
- info("Resume Airbreathing Flight").
- shutoff(vectors).
- set vlimit to 100.
- set angletarget to 90.
- autoVectoring off.
- }
- when altitude > 14000 then {
- info("engage nukes").
- startup(nukes).
- lock p to 15.
- }
- when altitude > 20000 then {
- info("push to orbit").
- lock p to min(35,airspeed/50).
- startup(vectors).
- ThrustLimit(vectors, 100).
- }
- when apoapsis > body:Atm:height + 10e3 then {
- info("apoapsis achieved").
- lock throttle to 0.
- lock steering to srfprograde.
- shutoff(turbos).
- }
- when altitude > body:atm:height then {
- info("in space").
- lock steering to prograde.
- lock throttle to 30-eta:apoapsis.
- }
- when periapsis > body:atm:height then {
- lock desiredVel to vxcl(up:vector,velocity:orbit):normalized * sqrt(body:MU/(body:Radius + altitude)).
- lock dV to desiredVel - velocity:orbit.
- lock steering to lookdirup(dV, ship:facing:topvector).
- when true then {
- if vang(facing:vector,dV) > 10 lock throttle to 0. else lock throttle to dv:mag / 2.
- if dv:mag > 0.3 return true. else {
- set complete to true.
- lock throttle to 0.
- info("welcome to orbit").
- info(" On nukes: " + nukedv).
- info(" On vectors: " + vectordv).
- info(" On nukes last: " + nukelastdv).
- info("On vectors last: " + vectorlastdv).
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement