Skip to content

Commit

Permalink
Added remove link button to link summary screen. (#408)
Browse files Browse the repository at this point in the history
A list of nice-to-have things:
* [x] A changelog 
* [ ] The link from the PR to the issue that it fixes. -> [This was
mentioned on discord and created based on
that.](https://discord.com/channels/560199483065892894/1210135763422027837/1335116053696479266)
* [x] A description of what testing was done.
I clicked around the link and it even unlinks when you navigate to new
links from there.


![afbeelding](https://github.com/user-attachments/assets/46faf453-2a6e-49ab-a2bb-3cfb430258f1)
  • Loading branch information
shpaass authored Feb 13, 2025
2 parents d4e0707 + e183283 commit f3b0e97
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
9 changes: 9 additions & 0 deletions Yafc/Workspace/ProductionTable/ProductionLinkSummaryScreen.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down
1 change: 1 addition & 0 deletions changelog.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand Down

0 comments on commit f3b0e97

Please sign in to comment.