Crafting Combinator Xeraph's Fork

by Xeraph

Includes combinators that allow you to set or read the recipe of any crafting machine, get ingredients or products of a recipe and more!

Content
1 year, 1 month ago
1.1
5.42K
Circuit network Manufacturing

i [won't implement - require cache overhaul] suggestion: ignore undiscovered recipes

1 year, 1 month ago

Hi, thanks again for this great mod!

I use crafting combinator for "mini smart malls", linking it to a costant combinator to craft in a single assember all that items that are "useful to have, but rarely used".

Would it be possibile (and easy for you to implement) for the crafting combinator to ignore the recipes that are not yet discovered ? Handling them requires a lot of external logic ATM.

In my view, there is no point (for the crafting combinator) to consider and try to send to the assembler an unknown recipe, the assembler won't set it anyway. If it ignores/skip it, the other items in the list can be made (now, it gets stuck until it's the recipe is discovered)

Thanks :)

1 year, 1 month ago
(updated 1 year, 1 month ago)

hi there, I believe the feature you mentioned has already been implemented here. As of current, crafting combinators do not attempt to make assemblers craft disabled recipe. However, the presence of unresearched recipe signals do affect the signal priority for crafting combinators - I believe this is what you have observed.

Currently, the get_recipe result is gated behind the get_highest function call, which relies on a signal cache mechanism to reduce the ups cost of this mod. For context, get_highest checks the cache to decide whether the mod needs to scan the circuit network (i.e. is the cached signal still the highest signal? has the signal count changed? if no, then scan circuit), which returns the highest numbered signal for get_recipe function to be translated into recipe.

To implement your suggestion, crafting combinator will have to abandon the cache mechanism because the highest signal isn't necessary something that points to a valid recipe (enabled recipe). On top of that, whenever the highest signal isn't linked to a valid recipe, crafting combinator will have to fallback to the next highest signal and do it repeatedly until it finds a signal linked to a valid recipe.

Besides, I cannot think of a way that can cache this "highest signal with valid recipe" state using the current cache mechanism. The mod will have to run the aforementioned algorithm (+circuit scan) every update cycle.

TLDR: Due to how the cache works, implementing this will require abandoning the cache mechanism and I do not think it is worth it.

1 year, 1 month ago

On a second thought, it might be possible to cache the state for "highest signal with valid recipe" using memory cells as cache (current mechanism uses lamps). However, it requires an overhaul for the cache mechanism which I currently do not have the time to do so.

This suggestion belongs to "require cache overhaul" group for now.

New response