Skip to content

Commit a1bd055

Browse files
authored
fix: Inserters cannot hold more than one stack of items. (#453)
This applies especially to asteroid chunks: inserters are limited to a maximum of 1 stack of items, regardless of their actual hand size. With this change, the value on the left (0.42 inserters) will be shown regardless of the inserter capacity, since asteroid chunks have a stack size of 1. In general, the calculations are now done based on either the hand size or the stack size, whichever is smaller. ![image](https://github.com/user-attachments/assets/5471e864-3999-4c1c-bfdb-963d1b7aa5c5)
2 parents e7281dd + d3077bb commit a1bd055

File tree

2 files changed

+5
-4
lines changed

2 files changed

+5
-4
lines changed

Yafc/Workspace/ProductionTable/ProductionTableView.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,8 +1193,8 @@ void dropDownContent(ImGui gui) {
11931193
}
11941194
#endregion
11951195

1196-
if (goods.Is<Item>()) {
1197-
BuildBeltInserterInfo(gui, amount, recipe?.buildingCount ?? 0);
1196+
if (goods is { target: Item item }) {
1197+
BuildBeltInserterInfo(gui, item, amount, recipe?.buildingCount ?? 0);
11981198
}
11991199
}
12001200
}
@@ -1408,7 +1408,7 @@ private static List<RecipeRow> GetRecipesRecursive(RecipeRow recipeRoot) {
14081408

14091409
private void BuildShoppingList(RecipeRow? recipeRoot) => ShoppingListScreen.Show(recipeRoot == null ? GetRecipesRecursive() : GetRecipesRecursive(recipeRoot));
14101410

1411-
private static void BuildBeltInserterInfo(ImGui gui, float amount, float buildingCount) {
1411+
private static void BuildBeltInserterInfo(ImGui gui, Item item, float amount, float buildingCount) {
14121412
var preferences = Project.current.preferences;
14131413
var belt = preferences.defaultBelt;
14141414
var inserter = preferences.defaultInserter;
@@ -1431,7 +1431,7 @@ private static void BuildBeltInserterInfo(ImGui gui, float amount, float buildin
14311431
}
14321432

14331433
using (gui.EnterRow()) {
1434-
int capacity = preferences.inserterCapacity;
1434+
int capacity = Math.Min(item.stackSize, preferences.inserterCapacity);
14351435
float inserterBase = inserter.inserterSwingTime * amount / capacity;
14361436
click |= gui.BuildFactorioObjectButton(inserter, ButtonDisplayStyle.Default) == Click.Left;
14371437
string text = DataUtils.FormatAmount(inserterBase, UnitOfMeasure.None);

changelog.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Date:
2020
Fixes:
2121
- (regression) Fix opening new unnamed files.
2222
- (.NET 9) Fix page name display in the search-all dropdown.
23+
- When calculating the required inserters, remember that inserters cannot hold more than one stack.
2324
Internal changes:
2425
- Quality objects now have reference equality and abstract serialization, like FactorioObjects.
2526
----------------------------------------------------------------------------------------------------------------------

0 commit comments

Comments
 (0)