Stop auto mode repairing healthy factories - #36
Open
grepsedawk wants to merge 1 commit into
Open
Conversation
In auto mode the repair recipe ran on every redstone pulse, even at full health, so a factory with a repair kit in its chest burned through kits fixing nothing. Auto mode now only repairs when the factory is fully broken. The rest of the time it runs production, and after a repair it returns to the recipe the player selected instead of the first one in the list. That preference is remembered across restarts. Recipe selection moved into a small pure method covered by unit tests for the broken, healthy, and out-of-materials cases.
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.
A factory in auto mode kept running its repair recipe on every redstone pulse, even at full health. With a repair kit in the chest, it burned through kits to fix nothing. This came up in-game on a compactor running on a monthly clock.
Auto mode now only repairs when the factory is fully broken. The rest of the time it runs production, and after a repair it returns to the recipe the player selected rather than the first one in the recipe list. That preference is persisted, so it survives a restart.
The recipe-selection decision moved into a pure method,
chooseAutoRecipe, with unit tests covering the broken, healthy, and out-of-materials cases.Manual repair behaves as before, and a fully broken factory still auto-repairs back to full.