Advertisement
space_is_hard

CMLS englist

Mar 25th, 2015
301
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 3.20 KB | None | 0 0
  1. //This bit of code is designed to add every engine on the rocket into
  2. //an appropriate list. Each engine is tagged based on when it needs
  3. //to be activated. Alpha = center engine, Bravo = the two opposing
  4. //engines on the nadir and zenith of the booster, and Charlie =
  5. //the remaining four engines. All seven on each booster will be used
  6. //during launch, but only the Alpha and Bravo will be used for the
  7. //boostback, and only the Alpha engine will be used for the suicide
  8. //burn. Each is also assigned to an "All" list for each booster, and
  9. //an "All" list for the entire launch vehicle. The second stage has
  10. //its own list; there is only the one-engine version but I'm leaving
  11. //it able to support a future two-engine version.
  12.  
  13. //The FOR loop throws an error, saying that the eng variable created
  14. //for the loop cannot have the suffix PARTSTAGGED. Can anyone help
  15. //with this? Why can't the eng variable have that suffix when I can
  16. //use the PARTSTAGGED suffix with the engineList variable?
  17.  
  18. LIST ENGINES IN engineList.
  19.  
  20. SET S1Alpha TO LIST().      //First stage engine 1
  21. SET S1Bravo TO LIST().      //First stage engines 2,3
  22. SET S1Charlie TO LIST().        //First stage engines 4,5,6,7
  23. SET S1All TO LIST().        //First stage all engines
  24.  
  25. SET S2Alpha TO LIST().      //Second stage engine 1
  26.  
  27. SET LBAlpha TO LIST().      //Left booster engine 1
  28. SET LBBravo TO LIST().      //Left booster engine 2,3
  29. SET LBCharlie TO LIST().        //Left booster engine 4,5,6,7
  30. SET LBAll TO LIST().        //Left booster all engines
  31. SET RBAlpha TO LIST().      //Right booster engine 1
  32. SET RBBravo TO LIST().      //Right booster engine 2,3
  33. SET RBCharlie TO LIST().        //Right booster engine 4,5,6,7
  34. SET RBAll TO LIST().        //Right booster all engines
  35.  
  36. SET engAll TO LIST().       //All first stage and side booster engines
  37.  
  38. FOR eng IN engineList {     //Loop to assign engines to all engine lists
  39.     IF eng:PARTSTAGGED("S1Alpha"):LENGTH > 0 {      //First stage engine 1
  40.         S1Alpha:ADD(eng).
  41.         S1All:ADD(eng).
  42.         engAll:ADD(eng).
  43.  
  44.     } ELSE IF eng:PARTSTAGGED("S1Bravo"):LENGTH > 0 {       //First stage engine 2,3
  45.         S1Bravo:ADD(eng).
  46.         S1All:ADD(eng).
  47.         engAll:ADD(eng).
  48.  
  49.     } ELSE IF eng:PARTSTAGGED("S1Charlie"):LENGTH > 0 {     //First stage engine 4,5,6,7
  50.         S1Charlie:ADD(eng).
  51.         S1All:ADD(eng).
  52.         engAll:ADD(eng).
  53.  
  54.     } ELSE IF eng:PARTSTAGGED("S2Alpha"):LENGTH > 0 {       //Second stage engine 1
  55.         S2Alpha:ADD(eng).
  56.  
  57.     } ELSE IF eng:PARTSTAGGED("LBAlpha"):LENGTH > 0 {       //Left booster engine 1
  58.         LBAlpha:ADD(eng).
  59.         LBAll:ADD(eng).
  60.         engAll:ADD(eng).
  61.  
  62.     } ELSE IF eng:PARTSTAGGED("LBBravo"):LENGTH > 0 {       //Left booster engine 2,3
  63.         LBBravo:ADD(eng).
  64.         LBAll:ADD(eng).
  65.         engAll:ADD(eng).
  66.  
  67.     } ELSE IF eng:PARTSTAGGED("LBCharlie"):LENGTH > 0 {     //Left booster engine 4,5,6,7
  68.         LBCharlie:ADD(eng).
  69.         LBAll:ADD(eng).
  70.         engAll:ADD(eng).
  71.  
  72.     } ELSE IF eng:PARTSTAGGED("RBAlpha"):LENGTH > 0 {       //Right booster engine 1
  73.         RBAlpha:ADD(eng).
  74.         LBAll:ADD(eng).
  75.         engAll:ADD(eng).
  76.  
  77.     } ELSE IF eng:PARTSTAGGED("RBBravo"):LENGTH > 0 {       //Right booster engine 2,3
  78.         RBBravo:ADD(eng).
  79.         LBAll:ADD(eng).
  80.         engAll:ADD(eng).
  81.  
  82.     } ELSE IF eng:PARTSTAGGED("RBCharlie"):LENGTH > 0 {     //Right booster engine 4,5,6,7
  83.         RBCharlie:ADD(eng).
  84.         LBAll:ADD(eng).
  85.         engAll:ADD(eng).
  86.  
  87.     }. //IF-ELSE eng   
  88. }. //FOR engineList
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement