Advertisement
Guest User

Untitled

a guest
Apr 2nd, 2015
237
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.31 KB | None | 0 0
  1. SET tanklist to LIST().
  2. SET srblist to LIST().
  3. SET tanknum to 0.
  4. SET srbnum to 0
  5.  
  6. //Search for fuel tanks and SRBs on SHIP and add to lists.
  7. for i in SHIP:PARTS
  8. {
  9. //Walk through resources for that part
  10. for res in i:resources
  11. {
  12. if res:name = "LIQUIDFUEL"
  13. {
  14. SET child to i.
  15. //Check to see if it has an engine or fuel line attached
  16. //We do this so stacked tanks are staged properly,
  17. //rather than staging as soon as one of them is empty
  18. for j in child:CHILDREN
  19. {
  20. if j:name = "fuelLine" OR j:name = "liquidEngine"
  21. {
  22. tanklist:ADD (i).
  23. break.
  24. }
  25. }
  26. }
  27. if res:name = "SOLIDFUEL"
  28. {
  29. srblist:ADD (i).
  30. break.
  31. }
  32.  
  33. }
  34. }
  35.  
  36. //Check tanks to see if empty and stage if needed
  37. WHEN TRUE THEN
  38. {
  39. if (tanklist:length > 0)
  40. {
  41. if tanklist[tanknum]:resources[0]:AMOUNT < 0.01
  42. {
  43. PRINT "Staging due to empty fuel tank".
  44. tanklist:REMOVE(tanknum).
  45. STAGE.
  46. }
  47. if tanknum < (tanklist:length - 1) { set tanknum to tanknum + 1.}
  48. else
  49. SET tanknum to 0.
  50. }
  51.  
  52. if (srblist:length > 0)
  53. {
  54. if srblist[srbnum]:resources[0]:AMOUNT < 0.01
  55. {
  56. PRINT "Staging due to empty SRB".
  57. srblist:REMOVE(srbnum).
  58. STAGE.
  59. }
  60. if srbnum < (srblist:length - 1 ){ set srbnum to srbnum + 1.}
  61. else
  62. SET srbnum to 0.
  63. }
  64. PRESERVE.
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement