Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //!runscript hN43FW08
- bays on.
- lock twr to ship:availablethrust/ship:mass/body:mu*body:position:sqrmagnitude.
- if (defined twrcutoff ) when twr < twrcutoff then {drills off. filled on.}
- function ShowResources {
- set elcount to 0.
- for el in ship:elements {
- print "[" + elcount + "] " + el:name.
- set elcount to elcount + 1.
- set rescount to 0.
- for res in el:resources {
- print (" [" + rescount + "] " + res:name):padright(21)
- + round(res:amount / res:capacity * 100):tostring():padright(4)
- + round(res:amount,1):tostring():padright(8)
- + "/ "
- + round(res:capacity,1):tostring().
- set rescount to rescount + 1.
- }
- print "-".
- }
- }
- kuniverse:quicksaveto("fuelbeginautosave").
- set res to gui(400, 200).
- Set res:x to -80.
- set res:y to 10.
- res:show.
- set reslist to list().
- for rs in ship:resources {
- set l to res:addlabel().
- Set l:style:fontsize to 26.
- reslist:add(l).
- }
- set warp to 1.
- radiators on.
- panels on.
- fuelcells on.
- radiators on.
- deploydrills on.
- wait 8.
- set warp to 1.
- wait until kuniverse:timewarp:issettled.
- isru on.
- drills on.
- set warp to 6.
- if not (defined watchlist) set watchlist to list("liquidfuel", "ore", "oxidizer").
- on time:second {
- drills on.
- set isrs to ship:modulesnamed("ModuleResourceConverter"). for isr in isrs { if isr:hasaction("start isru [lqdfuel]") isr:doaction("start isru [lqdfuel]",true).}
- set i to 0.
- set filled to true.
- // todo: handle locked tanks
- for rs in ship:resources {
- set reslist[i]:text to rs:name + " " + round(rs:amount,1) + " / " + rs:capacity.
- set reslist[i]:style:textcolor to rgb(1 - rs:amount/rs:capacity,rs:amount/rs:capacity,0.3).
- if watchlist:contains(rs:name) and (rs:capacity - rs:amount) > 1 set filled to false.
- set i to i + 1.
- }
- if filled {
- set warp to 1.
- radiators off.
- panels off.
- fuelcells off.
- isru off.
- deploydrills off.
- print "filled".
- kuniverse:quicksaveto("fuelautosaveinwarp").
- set res:visible to false.
- ShowResources().
- wait 1.
- set warp to 0.
- bays off.
- wait until kuniverse:timewarp:issettled.
- kuniverse:quicksaveto("fuelautosave").
- }
- return res:visible.
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement