From e1832832b95f9aec4bdabe0624814edd6a8d7d94 Mon Sep 17 00:00:00 2001 From: Dorus Date: Fri, 7 Feb 2025 10:21:04 +0100 Subject: [PATCH] Added remove link button to link summary screen. --- .../ProductionTable/ProductionLinkSummaryScreen.cs | 9 +++++++++ changelog.txt | 1 + 2 files changed, 10 insertions(+) diff --git a/Yafc/Workspace/ProductionTable/ProductionLinkSummaryScreen.cs b/Yafc/Workspace/ProductionTable/ProductionLinkSummaryScreen.cs index 5f611451..8d7564da 100644 --- a/Yafc/Workspace/ProductionTable/ProductionLinkSummaryScreen.cs +++ b/Yafc/Workspace/ProductionTable/ProductionLinkSummaryScreen.cs @@ -48,11 +48,20 @@ public override void Build(ImGui gui) { _ = gui.BuildFactorioObjectButtonWithText(link.goods, tooltipOptions: DrawParentRecipes(link.owner, "link")); } scrollArea.Build(gui); + if (gui.BuildButton("Remove link", link.owner.links.Contains(link) ? SchemeColor.Primary : SchemeColor.Grey)) { + DestroyLink(link); + Close(); + } if (gui.BuildButton("Done")) { Close(); } } + private void DestroyLink(ProductionLink link) { + _ = link.owner.RecordUndo().links.Remove(link); + Rebuild(); + } + protected override void ReturnPressed() => Close(); private void BuildFlow(ImGui gui, List<(RecipeRow row, float flow)> list, float total, bool isLinkOutput) { diff --git a/changelog.txt b/changelog.txt index f5e1856c..795507a5 100644 --- a/changelog.txt +++ b/changelog.txt @@ -19,6 +19,7 @@ Version: Date: Features: - Detect lightning rods/collectors as electricity sources, and estimate the required accumulator count. + - Added button to remove link from link summary screen. Fixes: - When creating launch recipes, obey the rocket capacity, not the item stack size. - Improve detection of special (e.g. barrelling, caging) recipes, especially with SA's recycling recipes.