Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //setup
- Clearscreen. Set eLT to 0. //for some reason kOS doesn't think eLT is defined?
- Set count to 10. Set relog to 0.
- Set cpuDisplay to PROCESSOR("cpuDisplay").
- Set allEngines to ship:partsdubbed("eng1").
- Wait until not core:messages:empty.
- //edit n9LaunchParameters.ks to select parameters:
- When not core:messages:empty then {
- Set received to core:messages:pop.
- If received:content = "ManualStaging" {
- cpuDisplay:connection:sendmessage("Rocket Profile Selected: Manual Staging.").
- cpuDisplay:connection:sendmessage("Staging: Shutting Down...").
- Shutdown.
- }
- If received:content = "shutdown"{
- cpuDisplay:connection:sendmessage("Staging: Shutting Down...").
- Shutdown.
- }
- If received:content = "L4" {
- cpuDisplay:connection:sendmessage("Rocket Profile Selected: L4.").
- Set eLT to 3098.
- Set sR to 2.
- Lock fT to round(ship:Kerosene).
- Set fTT to 25000.
- Set bS to 1.
- When sR = 1 then {
- Lock fT to round(ship:HTP).
- Set fTT to 137.
- }
- }
- Preserve.
- }.
- function liftOff {
- parameter expectedLaunchThrust.
- cpuDisplay:connection:sendmessage("Hit '0' to initiate countdown!").
- On Ag10 {
- Until count = 0 {
- cpuDisplay:connection:sendmessage("T minus " + count + " seconds...").
- If count = 3 {
- Stage.
- }
- Wait 1.
- Set count to (count - 1).
- }
- }
- Wait until count = 0.
- Wait until ship:maxThrust > (expectedLaunchThrust * 0.9).
- Stage.
- cpuDisplay:connection:sendmessage("Lift Off!").
- }.
- function stageProgram {
- parameter stagesRemaining.
- parameter fuelType.
- parameter fuelTypeThreshold.
- parameter boosterStage.
- Set expectedThrust to ship:maxThrust.
- Wait until ship:maxThrust < (expectedThrust * 0.9).
- Wait 1.
- If fuelType < fuelTypeThreshold {
- Wait 3. Stage.
- cpuDisplay:connection:sendmessage("Stage Separation!").
- If boosterStage = 0 {
- cpuDisplay:connection:sendmessage("Ullaging...").
- Wait 1. Stage.
- cpuDisplay:connection:sendmessage("Lighting Next Stage").
- Wait 4.
- If ship:maxThrust > (expectedThrust * 0.7) {
- cpuDisplay:connection:sendmessage("Good Light!").
- set sR to (stagesRemaining - 1).
- }
- If ship:maxThrust < (expectedThrust * 0.7) {
- cpuDisplay:connection:sendmessage("Engine Failure...").
- }
- }
- If boosterStage = 1 {
- Set bS to 0.
- }
- }
- If fuelType > fuelTypeThreshold {
- cpuDisplay:connection:sendmessage("Unexpected Thrust Loss!").
- cpuDisplay:connection:sendmessage(fuelType + " is more than " + fuelTypeThreshold).
- Wait 1. Set previousThrust to ship:maxThrust. Wait 1.
- If ship:maxThrust = 0 {
- cpuDisplay:connection:sendmessage("Switching to Manual Staging.").
- Shutdown.
- }
- If ship:maxThrust < (previousThrust * 0.9) {
- cpuDisplay:connection:sendmessage("Switching to Manual Staging.").
- Shutdown.
- }
- If ship:maxThrust > (previousThrust * 0.9) {
- cpuDisplay:connection:sendmessage("Stable. Manual Separation Required.").
- Set relog to 1.
- If boosterStage = 1 {
- Set bS to 0.
- }
- set sR to (stagesRemaining - 1).
- }
- }
- Wait until sR = (stagesRemaining - 1).
- }
- liftOff(eLT).
- Until sR = 0 {
- stageProgram(sR,fT,fTT,bS).
- If relog = 1 {
- Set sR to (sR + 1).
- Set relog to 0.
- }
- Wait 0.1.
- }.
- cpuDisplay:connection:sendmessage("Staging: Shutting Down...").
- Shutdown.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement