Baystation12/Baystation12 — pull request #6087 by mwerezak (2014-08-21 05:16:42+00:00)
Title: Fixes a couple of bugs in apc/process()

APCs were skipping vital processing if not connected or no power was available. Also, APCs were not taking into account the fact that their charging rate is limited by CHARGELEVEL when deciding how much power to draw from the power net.

Any other issues that I haven't noticed notwithstanding, the only other problem I can see is that rooms with a power draw that exceeds perapc (rooms with high power consumption machinery such as atmospherics) will not be able to stay charged. This is however an issue that affected the old APC code anyways, as it has to do with the fact that there is virtually no load-balancing (calculating perapc from the past tick's ```avail``` is not load balancing, and toggling between charging and not charging does not occur in this case).

Each SMES adds it's output to the powernet and then on the next tick the powernet simply divides that amount by the number of APCs. So if one APC uses more than perapc and other apcs use less than perapc, that APC won't be able to stay charged even though there is enough power available. Some options would be implementing actual load balancing that allows large consumers to use more than perapc when other APCs use less, or putting rooms with lots of high power consumption machinery on their own power net.