This is the main functionality behind the automation:
// number between 0 and 1, where 0 is no storage and 1 is full storage
local energyStoredRatio = self:GetEconomyStoredRatio('ENERGY')
// current energy income - energy expense
local energyTrend = 10 * self:GetEconomyTrend('ENERGY')
if energyStoredRatio < 0.9 then
// find a fabricator to disable
elseif energyStoredRatio >= 1.0 and energyTrend > 100 then
// find a fabricator to enable
end
It is made to be:
- Simple. It should be intuitive to reason about the system.
- Prefer full storage. It should not prevent you to use overcharge.
- Efficient. It should have no impact on the simulation speed, at any point in time.
Because of that it is:
- Unintelligent. It may make sub optimal choices at times.
And because it is new, it can be:
- Frustrating. It may not do what you think it should be doing.
In general, if you want your fabricators enabled then you should have more power production . Not micro-manage them.
Personally, if someone can figure out how to make this elegant in the UI, I'd like a three-position toggle - Off/Auto/On, with the default behavior being Auto.
I'm not a huge fan of giving people more control over the system - there's no real need for it either. If you want to prevent it from deactivating suddenly, have more storage. If you want to always have your fabs turned on, build more power (or less fabricators). You already have control over the system by adjusting how you approach the game.
I would be interested in the creation of an UI that can help you identify the number of excess power that your economy can take. Something that informs you how many fabricators are enabled at once. The tweaking of the parameters (when to enable / disable) are open for discussion too.