-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
Detect and warn about crafting with rotten food #36610
Detect and warn about crafting with rotten food #36610
Conversation
c4b63ae
to
78a7e38
Compare
Does this apply to things like Lamp Oil that intentionally allow for rotten ingredients for a non-rotten product? That could get annoying, and in some cases confusing. |
there I would like to see the opposite! I want to use the rotten stuff, so I don't loose the "fresh" one, which I would use for food cooking. |
+1 |
Yes, this is handled correctly, in that it doesn't warn you about it. There's no prioritization of ingredient choice based on age for any crafting. That might indeed be a useful thing, but I don't want to tackle it in this PR. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This looks great to me. I like the idea of the recipe_filter_flags
enum you introduced, it makes the filtering code a good deal cleaner and more extensible than what I was initially picturing.
78a7e38
to
aa5b77c
Compare
To deal with the long-standing issue of accidentally using rotting food in crafting (especially when crafting a large batch) and thus wasting time and materials. Allow a recipe filter to exclude rotten components. Use this new feature when selecting items for crafting to prefer non-rotten ones. When non-rotten ones do not suffice, warn the player of this fact before proceeding. In the crafting GUI, mark crafts in brown when they can only be crafted with rotten ingredients. If the result doesn't care about rottenness, as with e.g. lamp oil, then no warnings or marking of the recipes is done. This only catches the case where the ingredients are rotten when you start the craft. There is also the situation where things start non-rotten, but become rotten while you craft. This change does not attempt to handle that, but it could now be handled by a localized change in recipe::get_component_filter.
aa5b77c
to
142fdfe
Compare
Oops, I actually referenced this PR instead of #36611 about 34 times |
Summary
SUMMARY: Interface "Detect and warn about crafting with rotten food"
Purpose of change
Partial solution to #33385.
To deal with the long-standing issue of accidentally using rotting food in crafting (especially when crafting a large batch) and thus wasting time and materials.
Describe the solution
Based on idea of @ifreund.
Allow a recipe filter to exclude rotten components.
Use this new feature when selecting items for crafting to prefer non-rotten ones. When non-rotten ones do not suffice, warn the player of this fact before proceeding.
In the crafting GUI, mark crafts in brown when they can only be crafted with rotten ingredients.
Describe alternatives you've considered
The brown text might be difficult to read; if so, suggested alternatives are welcome.
This only catches the case where the ingredients are rotten when you start the craft. There is also the situation where things start non-rotten, but become rotten while you craft. This change does not attempt to handle that, but it could now be handled by a localized change in
recipe::get_component_filter
.It would be nice for the specific rotten ingredients to be highlighted in the crafting GUI, but that would require fairly invasive changes elsewhere, and certainly shouldn't be part of this PR. One issue that arises with the current implementation is that the GUI might suggest you have (say) two options to choose from, but if one is rotten then it will pick the other automatically without asking you, which might be surprising.
It would be nice to have unit tests for this, but the player interactivity aspects make that difficult.
Testing
Ran unit tests.
In-game experiments with milk crafting.
Additional context
See how crafts are listed in brown when they require rotten ingredients:
And when crafting beyond a particular number of batches requires rotten ingredients the higher numbers are brown similarly:
If you go ahead and craft, you get this warning:
And there's a similar warning for continuing an interrupted craft: