Add energy integer value (default 0) to RuleBaseFacility
If value is positive - facility generates energy, if negative - consumes
On facility construction, if facility's energy != 0 check base's energy budget, update BaseView::getPlacementError, new display with "low energy" error.
On facility dismantle or upgrade, if it's energy > 0, check if base's budget will be positive after it, otherwise show error.
If facility's energy != 0, show its value in ArticleStateBaseFacility
Show total base energy in BaseInfoState if isFtA == true (equal _game->getMod()->isFTAGame()) in place of _txtHangars, _numHangars and _barHangars.
Step 2
Respect lack of energy due to facility destruction.
Develop new facility status - disabled due to energy. Show it with sprite above facility in BaseView (load sprite Surface from Mod)
Replace existing facility disabling code.
After base defense check, if base energy budget >0, else disable most expensive facilities.
Step 1 minimal functions
Add energy integer value (default 0) to RuleBaseFacility If value is positive - facility generates energy, if negative - consumes On facility construction, if facility's energy != 0 check base's energy budget, update
BaseView::getPlacementError
, new display with "low energy" error. On facility dismantle or upgrade, if it's energy > 0, check if base's budget will be positive after it, otherwise show error. If facility's energy != 0, show its value inArticleStateBaseFacility
Show total base energy inBaseInfoState
ifisFtA == true
(equal_game->getMod()->isFTAGame()
) in place of _txtHangars, _numHangars and _barHangars.Step 2
Respect lack of energy due to facility destruction. Develop new facility status - disabled due to energy. Show it with sprite above facility in BaseView (load sprite
Surface
fromMod
) Replace existing facility disabling code. After base defense check, if base energy budget >0, else disable most expensive facilities.