diff --git a/data/production_planner-readme.png b/data/production_planner-readme.png index 951f6bd..4a44714 100644 Binary files a/data/production_planner-readme.png and b/data/production_planner-readme.png differ diff --git a/src/production_planner/cells/power.py b/src/production_planner/cells/power.py index efec933..d5a563a 100644 --- a/src/production_planner/cells/power.py +++ b/src/production_planner/cells/power.py @@ -10,7 +10,7 @@ class PowerCell(Cell): - name = "Power" + name = "-Power" vispath = "node_main.energy" read_only = True justify = "right" diff --git a/src/production_planner/cells/producer.py b/src/production_planner/cells/producer.py index e2e274c..c61fd8d 100644 --- a/src/production_planner/cells/producer.py +++ b/src/production_planner/cells/producer.py @@ -50,7 +50,7 @@ def bool_to_mark(a, mark="x"): rows = [] for p in self.data_filtered: rows += [[ProducerCell(NodeInstance(Node(p, Recipe.empty()))).get_styled(), - Text(str(p.base_power), justify="right"), + Text(str(int(p.base_power)), justify="right"), bool_to_mark(p.is_miner), bool_to_mark(p.is_pow_gen)]] table.add_rows(rows) diff --git a/src/production_planner/core.py b/src/production_planner/core.py index 1b4de2e..454be48 100644 --- a/src/production_planner/core.py +++ b/src/production_planner/core.py @@ -193,6 +193,11 @@ class Ingredient: name: str count: int + def __post_init__(self): + if self.name == "Energy": + self.name = "+Power" + self.count /= 60 + def __str__(self): return f"({self.count}x {self.name})" diff --git a/src/production_planner/gamedata/__init__.py b/src/production_planner/gamedata/__init__.py index 013fd23..420ce34 100644 --- a/src/production_planner/gamedata/__init__.py +++ b/src/production_planner/gamedata/__init__.py @@ -15,8 +15,6 @@ from docopt import docopt -from . import parse - import os import re import json @@ -123,6 +121,7 @@ def get(major=None, minor=None, patch=None, postfix=None, build=None) -> Path: def main(): + import parse from production_planner.core import ProducerEncoder arguments = docopt(__doc__) diff --git a/src/production_planner/gamedata/parse.py b/src/production_planner/gamedata/parse.py index 9ae0ef8..fdaafa5 100644 --- a/src/production_planner/gamedata/parse.py +++ b/src/production_planner/gamedata/parse.py @@ -3,7 +3,7 @@ # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. -from .. import core +from production_planner import core import re from typing import Optional, Self @@ -225,11 +225,11 @@ def generate_recipes(self, ctx: ParseContext): fuel_energy = float(fuel_class.energy_value) burn_time = fuel_energy / self.power_production items_per_minute = 60 / burn_time - items_per_minute = _convert_units(fuel_class, items_per_minute) + outputs += [[fuel_energy * items_per_minute, "Energy"]] + items_per_minute = _convert_units(fuel_class, items_per_minute) inputs += [[items_per_minute, fuel_class.display_name]] # FIXME ? - outputs += [[fuel_energy * items_per_minute, "Energy"]] if self.requires_supplemental_resource: supplemental_resource = fuel["mSupplementalResourceClass"] diff --git a/src/production_planner/gamedata/production_buildings_v1.0.0.1_366202.json b/src/production_planner/gamedata/production_buildings_v1.0.0.1_366202.json index 2b93545..552ec29 100644 --- a/src/production_planner/gamedata/production_buildings_v1.0.0.1_366202.json +++ b/src/production_planner/gamedata/production_buildings_v1.0.0.1_366202.json @@ -6327,8 +6327,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6343,8 +6343,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6359,8 +6359,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6375,8 +6375,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6391,8 +6391,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6407,8 +6407,8 @@ ], [ [ - 1800.0, - "Energy" + 30.0, + "+Power" ] ], false @@ -6436,8 +6436,8 @@ ], [ [ - 4500.0, - "Energy" + 75.0, + "+Power" ] ], false @@ -6456,8 +6456,8 @@ ], [ [ - 4500.0, - "Energy" + 75.0, + "+Power" ] ], false @@ -6476,8 +6476,8 @@ ], [ [ - 4500.0, - "Energy" + 75.0, + "+Power" ] ], false @@ -6501,8 +6501,8 @@ ], [ [ - 15.0, - "Energy" + 250.0, + "+Power" ] ], false @@ -6517,8 +6517,8 @@ ], [ [ - 15.0, - "Energy" + 250.0, + "+Power" ] ], false @@ -6533,8 +6533,8 @@ ], [ [ - 15.0, - "Energy" + 250.0, + "+Power" ] ], false @@ -6549,8 +6549,8 @@ ], [ [ - 15.000000000000002, - "Energy" + 250.00000000000003, + "+Power" ] ], false @@ -6565,8 +6565,8 @@ ], [ [ - 15.0, - "Energy" + 250.0, + "+Power" ] ], false @@ -6585,8 +6585,8 @@ [], [ [ - 18000, - "Energy" + 300.0, + "+Power" ] ], false @@ -6614,8 +6614,8 @@ ], [ [ - 150000.0, - "Energy" + 2500.0, + "+Power" ], [ 50.0, @@ -6638,8 +6638,8 @@ ], [ [ - 150000.0, - "Energy" + 2500.0, + "+Power" ], [ 10.0, @@ -6662,8 +6662,8 @@ ], [ [ - 150000.0, - "Energy" + 2500.0, + "+Power" ] ], false diff --git a/tests b/tests index 5b8a001..cd1a97b 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 5b8a0019ab22dad828a3b17be080079a75102bc6 +Subproject commit cd1a97b20dde1932c4d1c437efd3a7e7551bbd91