Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add per-recipe setting to show/hide the total I/O #340

Merged
merged 4 commits into from
Oct 31, 2024

Conversation

veger
Copy link
Collaborator

@veger veger commented Oct 31, 2024

As discussed in #338 it might be more convenient to make the recipe total I/O configurable per recipe, sicne we cannot figure out a 'catch all' that covers all of the seablock, py and space-age, etc. mods...

The screenshot shows the same recipe twice, one with I/O enabled and one disabled:
image
Note that the label is renamed to "Show total Input/Output"

@veger veger requested a review from shpaass as a code owner October 31, 2024 10:54
@veger veger requested a review from DaleStan October 31, 2024 10:54
@shpaass
Copy link
Owner

shpaass commented Oct 31, 2024

Nice!
What do you think about naming the option Show total input/output?

Copy link
Collaborator

@DaleStan DaleStan left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think there's space for more improvement, to improve discoverability, but this could come later.

When setting (but not deserializing) RecipeRow.entity, add showTotalIO = value.has_vector_to_place_result && recipe.products.Length > 1, or maybe |= instead of =. (Which requires adding and setting a has_vector_to_place_result property.)

I don't think that needs a preference for how many products the recipe has before setting showTotalIO, but then again, I thought that a number-of-products preference was good enough in the previous version of this feature.

Yafc/Windows/PreferencesScreen.cs Outdated Show resolved Hide resolved
@veger
Copy link
Collaborator Author

veger commented Oct 31, 2024

When setting (but not deserializing) RecipeRow.entity, add showTotalIO = value.has_vector_to_place_result && recipe.products.Length > 1, or maybe |= instead of =. (Which requires adding and setting a has_vector_to_place_result property.)

You mean automatically setting showTotalIO to true, if the recipe is created and has more than on product?

I do not understand what you mean with value.has_vector_to_place_result though...

@DaleStan
Copy link
Collaborator

Oh, I'm sorry. I meant to add a link to https://lua-api.factorio.com/latest/prototypes/CraftingMachinePrototype.html#vector_to_place_result

It appears vanilla only sets this property on miners (which only have one output for YAFC) and the recycler.

@veger
Copy link
Collaborator Author

veger commented Oct 31, 2024

It took a bit of refactoring the 'setter' in order to process the showTotalIO |= ... properly.

With this change the recipe automatically has its showTotalIO set to true, when the crafter entity has an 'unloader' and the recipe produces more than one product.

@shpaass shpaass merged commit 6afd3de into shpaass:master Oct 31, 2024
1 check passed
@veger veger deleted the make_IO_optional branch October 31, 2024 22:53
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.

3 participants