Skip to content

Commit c06c384

Browse files
authored
Fix deleting beacon modules (#212)
You could set the number of modules in a beacon to 0, but you couldn't delete them: ![image](https://github.com/user-attachments/assets/5a107974-4c7a-4e08-ae9b-9a7595c744cd) Also, when you explicitly set no modules for a recipe, right-clicking didn't reset them to the default. ![fix-deleting-beacon-modules](https://github.com/user-attachments/assets/458fb75e-a96b-4df7-8c4f-18e90e5a158a)
2 parents 01526a3 + ca50956 commit c06c384

File tree

3 files changed

+7
-4
lines changed

3 files changed

+7
-4
lines changed

Yafc/Workspace/ProductionTable/ModuleCustomizationScreen.cs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -170,7 +170,8 @@ private void DrawRecipeModules(ImGui gui, EntityBeacon? beacon, ref ModuleEffect
170170
if (evt == GoodsWithAmountEvent.LeftButtonClick) {
171171
SelectSingleObjectPanel.SelectWithNone(GetModules(beacon), "Select module", sel => {
172172
if (sel == null) {
173-
_ = modules.RecordUndo().list.Remove(rowCustomModule);
173+
_ = modules.RecordUndo();
174+
list.Remove(rowCustomModule);
174175
}
175176
else {
176177
rowCustomModule.RecordUndo().module = sel;

Yafc/Workspace/ProductionTable/ProductionTableView.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -561,7 +561,7 @@ void drawItem(ImGui gui, FactorioObject? item, int count) {
561561
case Click.Left:
562562
ShowModuleDropDown(gui, recipe);
563563
break;
564-
case Click.Right when item is not null:
564+
case Click.Right when recipe.modules != null:
565565
recipe.RecordUndo().RemoveFixedModules();
566566
break;
567567
}
@@ -597,7 +597,7 @@ private void ShowModuleDropDown(ImGui gui, RecipeRow recipe) {
597597
.OrderByDescending(x => x.template.IsCompatibleWith(recipe))];
598598

599599
gui.ShowDropDown(dropGui => {
600-
if (dropGui.BuildButton("Use default modules").WithTooltip(dropGui, "Shortcut: right-click") && dropGui.CloseDropdown()) {
600+
if (recipe.modules != null && dropGui.BuildButton("Use default modules").WithTooltip(dropGui, "Shortcut: right-click") && dropGui.CloseDropdown()) {
601601
recipe.RemoveFixedModules();
602602
}
603603

changelog.txt

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,14 @@ Version x.y.z
1515
Date:
1616
Features:
1717
- Autofocus the project name field when you create a new project
18+
- When opening the main window, use the same column widths as when it was last closed.
19+
Bugfixes:
20+
- Sometimes, deleting and/or right-click resetting modules would not work.
1821
----------------------------------------------------------------------------------------------------------------------
1922
Version 0.7.4
2023
Date: July 24th 2024
2124
Features:
2225
- Add the ability to switch through project pages with control-tab and control-shift-tab
23-
- When opening the main window, use the same column widths as when it was last closed.
2426
Bugfixes:
2527
- Fix a possible threading race while destroying textures, which could cause an illegal access crash.
2628
- Fix a loading error when mods use non-ASCII characters in their settings.

0 commit comments

Comments
 (0)