Advertisement
space_is_hard

CMLS1

Mar 27th, 2015
245
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 2.59 KB | None | 0 0
  1. //CMLS1
  2. //Version 0.1
  3.  
  4. WHEN loxRemaining <= (S1SepLevel / 100) THEN {      //Checks to see if first stage is at sep level, shutdown engines and extend fins if true
  5.     FOR eng IN S1All {
  6.         eng:GETMODULE("ModuleEngines"):DOEVENT("Shutdown Engine").
  7.     }. //FOR eng shutdown
  8.  
  9.  
  10.    
  11.     IF opMode = "1R" {
  12.         FOR part IN S1finHinges {
  13.             PART:GETMODULE("MuMechToggle"):DOACTION("move -",TRUE).
  14.         }. //FOR finhinge move
  15.         S1Ant:GETMODULE("ModuleRTAntenna"):DOEVENT("Activate").
  16.        
  17.     }. //IF opMode
  18.    
  19.     RCS ON.
  20.     SAS ON.
  21.     PRINT "T+" + missionClock + " Stage 1 at sep level, staging" AT(0,nextLine).
  22.     SET nextLine TO nextLine + 1.
  23.     SET S1ECOtimer to missionClock.     //Marks the time at which S1ECO occurred
  24.    
  25.     WHEN missionClock >= (S1ECOtimer + 1.5) THEN {      //Checks to see if 1.5 seconds has passed since S1ECO, quit extending fins if true
  26.         IF opMode = "1R" {
  27.             FOR part IN finHinges {
  28.                 PART:GETMODULE("MuMechToggle"):DOACTION("move -",FALSE).
  29.             }. //FOR finhinge stop
  30.            
  31.             PRINT "T+" + missionClock + " Fins extended" AT(0,nextLine).
  32.             SET nextLine TO nextLine + 1.
  33.            
  34.         }. //IF opMode
  35.        
  36.         WHEN missionClock >= (S1ECOtimer + 2.5) THEN {      //Checks to see if 2.5 seconds have passed since S1ECO, stage sep if true
  37.             interStage:GETMODULE("ModuleDecouple"):DOEVENT("Decouple").
  38.             PRINT "T+" + missionClock + " Staging confirmed" AT(0,nextLine).
  39.             SET nextLine TO nextLine + 1.
  40.             SET activeStage TO 2.       //Denotes that stage 2 is now the active stage
  41.             SET loxCap TO S2Tank:RESOURCES[1]:CAPACITY.
  42.             LOCK loxAmount TO S2Tank:RESOURCES[1]:AMOUNT.
  43.        
  44.             WHEN missionClock >= (S1ECOtimer + 7.5) THEN {      //Checks to see if 5 seconds have passed since stage sep, MEI if true
  45.                 FOR eng IN S2Alpha {
  46.                     eng:GETMODULE("ModuleEngines"):DOEVENT("Activate Engine").
  47.                 }.
  48.                
  49.                 PRINT "T+" + missionClock + " MEI" AT(0,nextLine).
  50.                 SET nextLine TO nextLine + 1.
  51.    
  52.                 WHEN SHIP:ALTITUDE > 60000 AND missionClock >= (S1ECOtimer + 10.5) THEN {       //Fairing sep at 60km or 3 seconds after stage 2 ignition, both conditions need satisfied
  53.                         FOR PART IN fairingShell {
  54.                             PART:GETMODULE("ProceduralFairingDecoupler"):DOEVENT("Jettison").
  55.                         }. //FOR loop
  56.                         SET fairingSep TO TRUE.     //Readout will update to confirm fairing sep status
  57.                         S2Ant:GETMODULE("ModuleRTAntenna"):DOEVENT("Activate").     //Activate small omni on second stage
  58.                         PRINT "T+" + missionClock + " Fairing separation confirmed" AT(0,nextLine).
  59.                         SET nextLine TO nextLine + 1.
  60.                    
  61.                 }. //WHEN SHIP:ALTITUDE
  62.             }. //WHEN stage2StartTimer
  63.         }. //WHEN BECOtimer decouple
  64.     }. //WHEN BECOtimer finHinges
  65. }. //WHEN loxRemaining
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement