Implement energy and power classes to allow appropriate units to be used everywhere, separate batteries from magazines #32067
Labels
Items: Battery / UPS
Electric power management
(P5 - Long-term)
Long-term WIP, may stay on the list for a while.
Is your feature request related to a problem? Please describe.
Working with integer kJ values for power draw under 1kW requires using RNG to decide if a charge will be consumed in a given turn, which becomes more inconsistent the lower the power draw is. See #30656.
See also the original PR #31079 which is being split up as it was going to get far too big.
Describe the solution you'd like
Energy and power should have supporting code for quantity classes that allow much higher precision.
units::quantity
- Add energy units class #31988read_from_json_string
to load any quantity string - Template read_from_json_string #32015units::quantity
data - Implement battery item type #32141BATTERY
with energy quantity - Implement battery item type #32141BATTERY
items - Fully support use of BATTERY items by tools #32193BATTERY
items - Fully support use of BATTERY items by tools #32193units::quantity
power_draw
Item_factory::check_definitions
for new itemsDescribe alternatives you've considered
Making battery charges millijoules would be the easiest solution but then we'd have to use that precision everywhere and some cases are more appropriately handled with larger units. Separating batteries from magazines will also allow easier modification in the future if there is interest in making batteries more detailed eg modeling maximum voltage and current.
The text was updated successfully, but these errors were encountered: