WaveFunctionP/KSPInterstellar — pull request #7 by jakkarth (2014-07-30 23:26:02+00:00)
Title: Development

OK. Working Visual Studio means I could actually compile and test this before sending the pull request. You do not want to know what I had to do to get that build environment set up.

When mining using ORS, if there's insufficient storage for the output product, I refund the fraction of the power that wasn't used. I also made the power usage gui element smooth out a bit for situations where the miner is racing the refinery.

When refining using the ISRU, if no output material was able to be stored, I refund all of the source materials and megajoules. Gui elements in the context menu properly display power usage and conversion rates.

When both ORS mining AND ISRU refining are active and competing for insufficient power, mining seems to get priority until the resource is full, at which point it'll start refunding power. The ISRU then has some power left when its turn comes around, and removes some of the base resource to produce whatever. On the next tick, mining isn't full anymore, so it'll use a fraction of a tick of power to top off, leaving the ISRU with a fraction of the power for the tick to do a small amount of conversion. At this point it's steady state until the ISRU's output products are full, at which point they'll both stop using power with their tanks completely full, and megajoules will begin to accumulate again.

Thus, a ship with an ISRU and an aluminum hybrid rocket on mun, with an un-upgraded 6.25m fission reactor and generator, can now (eventually) refuel by leaving the mining and electrolysis options turned on at the same time.