Delete unused recipe rows in the production table#172
Draft
DaleStan wants to merge 10 commits intoShadowTheAge:masterfrom
Draft
Delete unused recipe rows in the production table#172DaleStan wants to merge 10 commits intoShadowTheAge:masterfrom
DaleStan wants to merge 10 commits intoShadowTheAge:masterfrom
Conversation
Obey version
Recalculate the recipes after changing reactor layout or mining productivity.
…solver from getting confused.
DaleStan
commented
Jul 6, 2022
| flow = flowArr; | ||
| } | ||
|
|
||
| public void RemoveUnusedRecipes(bool unpackToo) |
Contributor
Author
There was a problem hiding this comment.
I tried spamming calls to RecordUndo in this method, but that sent the undo system into a stack overflow loop, both with and without unpacking.
Contributor
Author
|
Here's a demonstration of me mis-handling the undo system. Load DeleteUnusedTest.yafc.zip with this mod list, and use either of the two new buttons. Then try to undo the changes. After undo, the page will unexpectedly consume five of the six "Purified *" items, among other things. It will also unexpectedly produce gold ore, titanium sheet coil, uranium ore, nickel carbonyl, and tungsten ore. If the modlist doesn't work, you should also be able to sync with this save: DeleteUnusedTest.zip |
…ws using recipesPerSecond instead.
DaleStan
referenced
this pull request
Jan 5, 2023
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This is a follow-up to #168. After adding all the recipes in existence, I want to delete the ones the solver decided not to use. It can be merged without #168, if desired.
This adds two buttons to the dropdown on the Recipe column:

The first button deletes all recipe rows that have zero assigned buildings, recursively through all nested tables.
The second button also unpacks any nested tables that only have a header recipe.
Given this nested table,



the first button converts it to this
and the second button converts it to this
Omit 1c0d336 to omit the second button. I can create a new PR if that's desired.
Required additional work
Potential future concerns
builtBuildings, but that the solver didn't use. I'm guessing those rows should be preserved, and can update this PR to do that once one or both of those are merged.