Skip to content

Stop auto mode repairing healthy factories - #36

Open
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:repair-auto-no-fix-healthy
Open

Stop auto mode repairing healthy factories#36
grepsedawk wants to merge 1 commit into
EdenMinecraft:mainfrom
grepsedawk:repair-auto-no-fix-healthy

Conversation

@grepsedawk

Copy link
Copy Markdown

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.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant