Closed Wuzzy2 closed 5 years ago
I think the way to do this would be to make a mod that keeps track of "revealed" items and registers a recipe filter that returns recipes that use only revealed items. You might want to use the reveal data outside of the craft guide.
I suppose this mod already knows which items are revealed, it seems silly to do it in any different mod.
Hmm. I think @pauloue has a point. If the current API allows to do that in a separate mod, then the current API is good enough.
If the current API allows to do that in a separate mod
How?
Copy the code in the if progressive_mode
block to your mod (along with any helper functions that it uses). Then add an API function to add to the saved inv_items
. For the callback you will need to check for not already discovered items when you get the new ones here:
https://github.com/minetest-mods/craftguide/blob/3f44ae00d20b7056718ee840ef76b62487bd5724/init.lua#L886-L887
Closing. This might be re-opened if some limits in the current API are hit for your purposes.
For progressive mode, I'd like to suggest a convenience function to “reveal” new recipes to a player by API call (as if the player had collected the item). I also suggest a callback that fires whenever a new recipe is revealed.
Use case: So for example, mods and games could reveal some basic but crucial “starter” recipes (like wood, torch). And they could reveal groups of items on certain events.