Tweaking Power Systems
Hey Folks! Progress was a bit limited today, due to a parent-teacher conference this morning, and some tax paperwork in the afternoon. However, I did manage to get a little bit of quality time with the reactor and battery system.
I'm trying to get the reactor to route power from batteries when its power bus is set to anything except "off." Sort of like a giant switch that can connect upstream batteries with downstream ship systems.
If you look at today's picture, there's a battery on the left, a bunch of equipment and lights on the right, and a reactor in the middle. You'll also notice some new bits on the battery and reactor with red arrows, showing their respective inputs and outputs. The battery's output is connected to the reactor's input. And the reactor's output is connected to the rest of the equipment and lights. (All the round yellow icons are a special power overlay to help debug power stuff.)
And if I switch the reactor override to "off," all the equipment shuts down. The reactor stops generating power, immediately draining any power inside the reactor to zero, and the batteries can no longer transmit their power through the reactor to the ship. Which is what I want.
There are some minor issues, though.
First, the ship's idea of what tiles are powered doesn't get updated. All the yellow icons remain, meaning the ship still thinks they have power. But when the equipment goes to draw that power, it finds zero power, and they shut off.
Ideally, the ship should recalculate the powered tiles. And I think what this means is that the reactor needs to actually shut down, and switch to the offline mode. This change of game objects will cause the ship to detect a tile with power source set on it was removed, triggering a recalc of the powered tiles.
I'll also need to make that "IsOverrideOff" flag persistent across mode switches, so it remembers that setting if anything switches its mode again. (Currently, this info is remembered in the reactor's UI, and re-applies it whenever the UI is opened, which is probably the wrong place for that.)
Once the override persists and is set on the reactor, we can shut it down, it will remember it's overridden to be off, and will stay that way. Ship gets updated. And Bob's your uncle!
There's more to it, of course. But those are the next steps :)