Page 1 of 1

New "total ingredients" mode for selector combinator

Posted: Fri Nov 08, 2024 7:55 pm
by Tinyboss
TL;DR
A new mode for the selector combinator to output all the ingredients for the recipes on its input.
What?
A new "total ingredients" mode for the selector combinator. It outputs the total ingredients needed to craft the items on its input, in quantities given by the signal values. For example, if the input is 10 red science and 1 red belt, then the output is:

(10 iron gears + 10 copper plates) + (1 yellow belt + 5 iron gears) = (15 iron gears + 10 copper plates + 1 yellow belt).

Items with no ingredients would output themselves, e.g. 100 iron ore would be output as 100 iron ore.

An item signal and its recipe signal would give the same output. Items with multiple recipes would use a default, and different recipe(s) could be sent specifically if needed.

Technologies would output the total science needed.

Recipes that produce multiples of their product would round up to the nearest multiple of the recipe inputs. For example, 3 yellow belt would output 2 iron plate + 2 iron gear.

A productivity bonus could be provided on the P signal and would be taken into account, making the assumption that the productivity bar is initially empty.

Why?
It's not just duplicative with the "read recipe" function on crafting entities, because it can work without the appropriate entity to read from. One great use would be to get the total materials needed for a logistic group, set on a constant combinator. Because items without ingredients return themselves, this function could be used repeatedly to calculate raw material requirements if desired.

This idea came to me while considering another suggestion for reading the current research and doing something different depending on whether Agricultural Science is used, and would enable half of that ability. (The other half being reading the research queue from labs.)

Re: New "total ingredients" mode for selector combinator

Posted: Fri Nov 08, 2024 8:24 pm
by mr_abomination
+1 to this. I think it could be very useful for fancy circuit automation and compacting down without having to use the assembler as an intermediate

Re: New "total ingredients" mode for selector combinator

Posted: Sun Nov 10, 2024 4:30 pm
by hitzu
I was just about to suggest the same thing! It’s frustrating that to create an automated setup based on available ingredients, we have to add dummy machines which work is only to list out the ingredients for each possible recipe first. Only then can we compare it with storage to decide what to craft. Using constant combinators and manually inputting every ingredient list is quite a tedious workaround for a game focused on automation!

Re: New "total ingredients" mode for selector combinator

Posted: Sat Dec 14, 2024 1:56 am
by SyrusVir
Wholehearted +1. That information is already available in the parametrized blueprint interface so it shouldn't be too hard to expose that information to the selector combinator.