Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- SET tanklist to LIST().
- SET srblist to LIST().
- SET tanknum to 0.
- SET srbnum to 0
- //Search for fuel tanks and SRBs on SHIP and add to lists.
- for i in SHIP:PARTS
- {
- //Walk through resources for that part
- for res in i:resources
- {
- if res:name = "LIQUIDFUEL"
- {
- SET child to i.
- //Check to see if it has an engine or fuel line attached
- //We do this so stacked tanks are staged properly,
- //rather than staging as soon as one of them is empty
- for j in child:CHILDREN
- {
- if j:name = "fuelLine" OR j:name = "liquidEngine"
- {
- tanklist:ADD (i).
- break.
- }
- }
- }
- if res:name = "SOLIDFUEL"
- {
- srblist:ADD (i).
- break.
- }
- }
- }
- //Check tanks to see if empty and stage if needed
- WHEN TRUE THEN
- {
- if (tanklist:length > 0)
- {
- if tanklist[tanknum]:resources[0]:AMOUNT < 0.01
- {
- PRINT "Staging due to empty fuel tank".
- tanklist:REMOVE(tanknum).
- STAGE.
- }
- if tanknum < (tanklist:length - 1) { set tanknum to tanknum + 1.}
- else
- SET tanknum to 0.
- }
- if (srblist:length > 0)
- {
- if srblist[srbnum]:resources[0]:AMOUNT < 0.01
- {
- PRINT "Staging due to empty SRB".
- srblist:REMOVE(srbnum).
- STAGE.
- }
- if srbnum < (srblist:length - 1 ){ set srbnum to srbnum + 1.}
- else
- SET srbnum to 0.
- }
- PRESERVE.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement