checkpoint

This commit is contained in:
2025-11-09 08:52:03 +00:00
parent 11fe895274
commit f9e1ad0768
4 changed files with 85 additions and 1 deletions

View File

@@ -8,6 +8,7 @@
<w>larrussite</w> <w>larrussite</w>
<w>quickwire</w> <w>quickwire</w>
<w>siterite</w> <w>siterite</w>
<w>tailings</w>
</words> </words>
</dictionary> </dictionary>
</component> </component>

30
main.py
View File

@@ -339,6 +339,36 @@ def index():
"inputs": step_inputs, "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 # Aggregate targets for display
result_targets = {} result_targets = {}
for itm, qty in targets.items(): for itm, qty in targets.items():

43
plus.py
View File

@@ -14,6 +14,8 @@ class Machines(Enum):
Foundry = Machine(name="Foundry") Foundry = Machine(name="Foundry")
FlexibleBlastFurnace = Machine(name="Flexible Blast Furnace") FlexibleBlastFurnace = Machine(name="Flexible Blast Furnace")
Reformer = Machine(name="Reformer") Reformer = Machine(name="Reformer")
WetWasher = Machine(name="Wet Washer")
class Items(Enum): class Items(Enum):
IronIngot = Item(name="Iron Ingot") IronIngot = Item(name="Iron Ingot")
@@ -85,6 +87,7 @@ class Items(Enum):
BrassPipes = Item(name="Brass Pipes") BrassPipes = Item(name="Brass Pipes")
ColdSlag = Item(name="Cold Slag") ColdSlag = Item(name="Cold Slag")
FanBlades = Item(name="Fan Blades") FanBlades = Item(name="Fan Blades")
TailingsSlurry = Item(name="Tailings Slurry")
class RawResources(Enum): class RawResources(Enum):
Water = Items.Water Water = Items.Water
@@ -186,7 +189,7 @@ class Recipes(Enum):
building=Machines.Sorter, building=Machines.Sorter,
outputs={ outputs={
Items.CrushedZinc: 96.0, Items.CrushedZinc: 96.0,
Items.CrushedMagnesium: 48.0, Items.Sand: 48.0,
Items.CrushedGangue: 60.0, Items.CrushedGangue: 60.0,
}, },
inputs={Items.CrushedLarrussite: 120.0}, inputs={Items.CrushedLarrussite: 120.0},
@@ -666,5 +669,43 @@ class Recipes(Enum):
Items.Water: 15.0, 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() Recipe.model_rebuild()

View File

@@ -151,6 +151,7 @@
<th>Recipe</th> <th>Recipe</th>
<th>Building</th> <th>Building</th>
<th>Inputs</th> <th>Inputs</th>
<th>Destinations</th>
<th class="mono">Target rate</th> <th class="mono">Target rate</th>
<th class="mono">Per-building output</th> <th class="mono">Per-building output</th>
<th class="mono">Buildings</th> <th class="mono">Buildings</th>
@@ -175,6 +176,17 @@
<span class="pill">None</span> <span class="pill">None</span>
{% endif %} {% endif %}
</td> </td>
<td>
{% if s.destinations and s.destinations|length > 0 %}
<div>
{% for d in s.destinations %}
<div>{{ d.recipe }}{% if d.building %} ({{ d.building }}){% endif %} — <span class="mono">{{ '%.2f'|format(d.rate) }}</span></div>
{% endfor %}
</div>
{% else %}
<span class="pill">None</span>
{% endif %}
</td>
<td class="mono">{{ '%.2f'|format(s.target_rate) }}</td> <td class="mono">{{ '%.2f'|format(s.target_rate) }}</td>
<td class="mono">{{ '%.2f'|format(s.per_building_output) }}</td> <td class="mono">{{ '%.2f'|format(s.per_building_output) }}</td>
<td class="mono">{{ '%.2f'|format(s.buildings_float) }} (~ {{ s.buildings }})</td> <td class="mono">{{ '%.2f'|format(s.buildings_float) }} (~ {{ s.buildings }})</td>