Skip to content

Commit

Permalink
Saner power generation display
Browse files Browse the repository at this point in the history
  • Loading branch information
mitaa committed Sep 17, 2024
1 parent 0d75bf1 commit 71b4bb3
Show file tree
Hide file tree
Showing 7 changed files with 47 additions and 43 deletions.
Binary file modified data/production_planner-readme.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion src/production_planner/cells/power.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@


class PowerCell(Cell):
name = "Power"
name = "-Power"
vispath = "node_main.energy"
read_only = True
justify = "right"
Expand Down
5 changes: 5 additions & 0 deletions src/production_planner/core.py
Original file line number Diff line number Diff line change
Expand Up @@ -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})"

Expand Down
3 changes: 1 addition & 2 deletions src/production_planner/gamedata/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,6 @@

from docopt import docopt

from . import parse

import os
import re
import json
Expand Down Expand Up @@ -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__)
Expand Down
6 changes: 3 additions & 3 deletions src/production_planner/gamedata/parse.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6327,8 +6327,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand All @@ -6343,8 +6343,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand All @@ -6359,8 +6359,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand All @@ -6375,8 +6375,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand All @@ -6391,8 +6391,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand All @@ -6407,8 +6407,8 @@
],
[
[
1800.0,
"Energy"
30.0,
"Power+"
]
],
false
Expand Down Expand Up @@ -6436,8 +6436,8 @@
],
[
[
4500.0,
"Energy"
75.0,
"Power+"
]
],
false
Expand All @@ -6456,8 +6456,8 @@
],
[
[
4500.0,
"Energy"
75.0,
"Power+"
]
],
false
Expand All @@ -6476,8 +6476,8 @@
],
[
[
4500.0,
"Energy"
75.0,
"Power+"
]
],
false
Expand All @@ -6501,8 +6501,8 @@
],
[
[
15.0,
"Energy"
250.0,
"Power+"
]
],
false
Expand All @@ -6517,8 +6517,8 @@
],
[
[
15.0,
"Energy"
250.0,
"Power+"
]
],
false
Expand All @@ -6533,8 +6533,8 @@
],
[
[
15.0,
"Energy"
250.0,
"Power+"
]
],
false
Expand All @@ -6549,8 +6549,8 @@
],
[
[
15.000000000000002,
"Energy"
250.00000000000003,
"Power+"
]
],
false
Expand All @@ -6565,8 +6565,8 @@
],
[
[
15.0,
"Energy"
250.0,
"Power+"
]
],
false
Expand All @@ -6585,8 +6585,8 @@
[],
[
[
18000,
"Energy"
300.0,
"Power+"
]
],
false
Expand Down Expand Up @@ -6614,8 +6614,8 @@
],
[
[
150000.0,
"Energy"
2500.0,
"Power+"
],
[
50.0,
Expand All @@ -6638,8 +6638,8 @@
],
[
[
150000.0,
"Energy"
2500.0,
"Power+"
],
[
10.0,
Expand All @@ -6662,8 +6662,8 @@
],
[
[
150000.0,
"Energy"
2500.0,
"Power+"
]
],
false
Expand Down
2 changes: 1 addition & 1 deletion tests
Submodule tests updated 64 files
+83 −83 __snapshots__/test_base_screens/test_startup_screen.svg
+82 −82 __snapshots__/test_init_data_folder/test_init_data.svg
+82 −82 __snapshots__/test_load/test_load_file.svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys0].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys1].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys2].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys3].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys4].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys5].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys6].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys7].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_CLOCKRATE[keys8].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys0].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys1].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys2].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys3].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys4].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys5].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys6].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys7].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys8].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_MK[keys9].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys0].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys1].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys2].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys3].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys4].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys5].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys6].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys7].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys8].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_PURITY[keys9].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys0].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys1].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys2].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys3].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys4].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys5].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys6].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys7].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys8].svg
+84 −84 __snapshots__/test_num_inputs/test_num_inputs_QTY[keys9].svg
+84 −84 __snapshots__/test_rows/test_rows_ADD[keys0].svg
+84 −84 __snapshots__/test_rows/test_rows_ADD[keys1].svg
+84 −84 __snapshots__/test_rows/test_rows_ADD[keys2].svg
+84 −84 __snapshots__/test_rows/test_rows_ADD[keys3].svg
+78 −78 __snapshots__/test_rows/test_rows_REMOVE[keys0].svg
+78 −78 __snapshots__/test_rows/test_rows_REMOVE[keys1].svg
+84 −84 __snapshots__/test_rows/test_rows_REMOVE[keys2].svg
+84 −84 __snapshots__/test_rows/test_rows_REMOVE[keys3].svg
+78 −78 __snapshots__/test_rows/test_rows_REMOVE[keys4].svg
+84 −84 __snapshots__/test_rows/test_rows_REMOVE[keys5].svg
+83 −83 __snapshots__/test_rows/test_rows_REMOVE[keys6].svg
+84 −85 with_modules/__snapshots__/test_expand/test_module_COLLAPSE[keys0].svg
+84 −84 with_modules/__snapshots__/test_expand/test_module_COLLAPSE[keys1].svg
+85 −85 with_modules/__snapshots__/test_expand/test_module_EXPAND[keys0].svg
+85 −85 with_modules/__snapshots__/test_expand/test_module_EXPAND[keys1].svg
+84 −85 with_modules/__snapshots__/test_save_with_expanded_module/test_save_with_module[keys0].svg
+85 −85 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys0].svg
+83 −83 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys1].svg
+78 −78 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys2].svg
+84 −85 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys3].svg
+85 −85 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys4].svg
+84 −85 with_modules/__snapshots__/test_show_hide/test_module_hide_show[keys5].svg

0 comments on commit 71b4bb3

Please sign in to comment.