Reactor Feed and Shutdown

Hey Folks! More reactor work today. Was a bit more productive today, tackling a few more necessary features of the reactor system: drawing fuel/propellants, and shutting down.

First order of business was to get the reactor to draw fuel from the ship tanks, since where I left off yesterday would run forever not using any fuel to operate. I already knew the propellant mass flow from my thrust research, as well as the mass ratio between reactants in the fusion reaction. So it wasn't too hard to just figure out how much I'd need of each per simulation time step, and subtract it from the tanks.

For now, I'm not worrying about pipes or connections for propellant. That might be interesting to do someday, but it's a can of worms and doesn't add a lot right now. Bigger fish to fry, so I'm just magically tapping the tanks by searching anywhere on the ship for them.

A bit of testing, and my trip from Mars to the moon was visibly draining propellants!

Next step: what happens when the propellants (i.e. reaction fuel) is gone? Well, instant shut-down in this case. Fusion is a bit different than fission in this regard, as fission just burns uncontrollably once started, while fusion can be stopped quickly.

So I setup the necessary data for a shut-down version of the reactor, and some data connections to specify transitioning between on and off states. Then, when the code to draw fuel doesn't get enough, I can queue that interaction (how the game handles mode switches on items) and swap out the running reactor for an "off" one.

This turned out to be trickier, as there was a lot of data involved, some GUI issues to patch, and some null pointers to resolve. I had to have the ship re-query the tiles for connected power sources after removing/adding power sources.

However, with that stuff in, the reactor officially shuts down! Then, one more minor bug needed solving: the ship movement needed to stop when the reactor was offline. I had two acceleration calculations in my code, and missed one of them when doing the throttle stuff yesterday.

So, as of now, we have most of the reactor/thrust stuff we need. I think, anyway. No way to turn a reactor "on" just yet, so that might be one. And I'll have to see if I can think of any other missing things to complete a trip.

Or, you know, maybe just throw the ship into space and see what happens :)