diff --git a/.idea/dictionaries/project.xml b/.idea/dictionaries/project.xml index 4fb2906..2937e44 100644 --- a/.idea/dictionaries/project.xml +++ b/.idea/dictionaries/project.xml @@ -8,6 +8,7 @@ larrussite quickwire siterite + tailings \ No newline at end of file diff --git a/main.py b/main.py index c78d1cb..fc72dda 100644 --- a/main.py +++ b/main.py @@ -339,6 +339,36 @@ def index(): "inputs": step_inputs, }) + # Build consumers index per item from the steps' inputs + consumers_by_item: Dict[str, List[dict]] = defaultdict(list) + for s in steps: + for inp in s.get("inputs", []): + consumers_by_item[inp["item"]].append({ + "recipe": s["recipe"], + "building": s["building"], + "rate": inp["rate"], + }) + # Targets by item for final outputs annotation + target_rates_by_item: Dict[str, float] = {} + for itm, qty in targets.items(): + if qty > 0: + target_rates_by_item[itm.value.name] = qty + + # Attach destinations to each step (who consumes this step's primary output) + for s in steps: + item_name = s["item"] + dests = list(consumers_by_item.get(item_name, [])) + # If this item is also a final target, add a synthetic destination + if item_name in target_rates_by_item: + dests.append({ + "recipe": "Final output", + "building": "", + "rate": target_rates_by_item[item_name], + }) + # Sort destinations by descending rate for display + dests.sort(key=lambda x: x["rate"], reverse=True) + s["destinations"] = dests + # Aggregate targets for display result_targets = {} for itm, qty in targets.items(): diff --git a/plus.py b/plus.py index fc3faa9..4f40908 100644 --- a/plus.py +++ b/plus.py @@ -14,6 +14,8 @@ class Machines(Enum): Foundry = Machine(name="Foundry") FlexibleBlastFurnace = Machine(name="Flexible Blast Furnace") Reformer = Machine(name="Reformer") + WetWasher = Machine(name="Wet Washer") + class Items(Enum): IronIngot = Item(name="Iron Ingot") @@ -85,6 +87,7 @@ class Items(Enum): BrassPipes = Item(name="Brass Pipes") ColdSlag = Item(name="Cold Slag") FanBlades = Item(name="Fan Blades") + TailingsSlurry = Item(name="Tailings Slurry") class RawResources(Enum): Water = Items.Water @@ -186,7 +189,7 @@ class Recipes(Enum): building=Machines.Sorter, outputs={ Items.CrushedZinc: 96.0, - Items.CrushedMagnesium: 48.0, + Items.Sand: 48.0, Items.CrushedGangue: 60.0, }, inputs={Items.CrushedLarrussite: 120.0}, @@ -666,5 +669,43 @@ class Recipes(Enum): Items.Water: 15.0, } ) + # Wet Washer + # - Washing + WashedIron = Recipe( + name="Washed Iron", + building=Machines.WetWasher, + outputs={ + Items.CrushedIron: 60.0, + Items.TailingsSlurry: 40.0 + }, + inputs={ + Items.SiteriteOre: 40.0, + Items.Water: 40.0, + } + ) + WashedCopper = Recipe( + name="Washed Copper", + building=Machines.WetWasher, + outputs={ + Items.CrushedCopper: 36.0, + Items.TailingsSlurry: 24.0 + }, + inputs={ + Items.CallaniteOre: 24.0, + Items.Water: 24.0, + } + ) + WashedTin = Recipe( + name="Washed Tin", + building=Machines.WetWasher, + outputs={ + Items.CrushedTin: 45.0, + Items.TailingsSlurry: 60.0 + }, + inputs={ + Items.SiteriteOre: 60.0, + Items.Water: 30.0, + } + ) Recipe.model_rebuild() \ No newline at end of file diff --git a/templates/index.html b/templates/index.html index faeaac5..2d7b46c 100644 --- a/templates/index.html +++ b/templates/index.html @@ -151,6 +151,7 @@ Recipe Building Inputs + Destinations Target rate Per-building output Buildings @@ -175,6 +176,17 @@ None {% endif %} + + {% if s.destinations and s.destinations|length > 0 %} +
+ {% for d in s.destinations %} +
{{ d.recipe }}{% if d.building %} ({{ d.building }}){% endif %} — {{ '%.2f'|format(d.rate) }}
+ {% endfor %} +
+ {% else %} + None + {% endif %} + {{ '%.2f'|format(s.target_rate) }} {{ '%.2f'|format(s.per_building_output) }} {{ '%.2f'|format(s.buildings_float) }} (~ {{ s.buildings }})