In particular it has been suggested here: viewtopic.php?f=9&t=30853&start=120 to make it possible to set the recipe of a machine. This has also been partially implemented in this mod: https://mods.factorio.com/mods/nbp/circuit-assembler
In this thread I was going to flesh out the main ideas a bit more and add some suggestions of my own.
So the main idea is to make it possible to set the recipe of an assembling machine using a signal. The machine would simply pick the first signal or largest signal (in whatever way is consistent with how other entities work) and change the recipe to that. There remains the issue of how to deal with residual items and modules (some modules can only be used for some items). For items one could
- Throw away any items that cannot be used for the new recipe.
This is nice because it is very simple to use and to understand. However it has obvious efficiency implications, especially when crafting very expensive things such as rockets and satellites. - Put all items that cannot be used for the new recipe in an internal chest from which inserters can only take out items, but not insert to. Potentially this could be accessed from a specific place on the assembling machine however I think for simplicity it is best not to do that and make inserters that are trying to remove items from the machine take items from both the internal chest and the output slot of the recipe. If one wanted to separate the residuals from the output one could simply use a filter inserter with the same signal as the assembling machine anyway. The size of the internal chest would be limited to say 6 slots to prevent it being used as an arbitrarily large chest.
- When switching the recipe the residual items would be available for an inserter to remove from the assembling machine and only when all residual items have been removed, the recipe will switch completely and the machine can start to produce the new recipe. This is a nice and almost stateless approach in my opinion. It does not require any changes to the UI except possibly that the "current/capacity" part of the tooltip should be removed when it is switching to a new recipe. The mechanics would be that: an assembling machine has an inventory. Items can be inserted into the machine if and only if the item is part of the recipe for the machine (based on the circuit network) and the machine has no items in its inventory that are not part of the recipe. An item in the assembling machines inventory can be removed using an inserter if and only if it is the output of the current recipe or if it is not an input to the current recipe. This is also stable even if input signal is unstable. Say that the input signal makes the machine switch to another recipe for a single tick and the next tick it switches the recipe back again. You would likely loose the progress for the current item, but the items are still in the input slots and the machine can start to produce a new item immediately. Compare this with the previous option which would immediately when the recipe was switched place the items in an internal inventory and would have to be removed and then inserted again before they could be used as inputs to the recipe again.
- Put all items into an internal active provider chest so that logistics robots can remove it for you. Could also be formulated as the previous option. This has the downside that logistics robots are required to remove the items and it may not be obvious for the player why they can be removed using logistics robots but not using an inserter.
I would also like to make an additional suggestion. A way to get the ingredients for a particular recipe. It may seem like there are few cases where you would need this, and there probably are. However together with setting the recipe for a machine, this would allow another level of automation in Factorio, namely automatic the layout and routing of everything that assembling machines produce and consume. For larger factories, one might want to automatically transport say processing chips to the assembling machines that actually use them. This is straight forward when the assembling machines have fixed recipes as if you would need the inputs to a recipe, you can just plonk down a constant combinator next to it, however when the assembling machines can change recipes there is no easy way to gain that information so that you factory can know where to route items. For an example where this is done, take a look at the video here https://youtu.be/3gAVgGCn04w. All assembling machine units use the circuit network to "request" items from the large central storage. The system will try to send just as many items to keep the assembling machines busy (the actual logic is implemented using a PID controller, but that is not so important for this discussion). To completely automate this (which is of course the ultimate goal in Factorio) one would want to automatically set the recipes on the assembling machines based on demand and resource availability (so that it could for example automatically add more assembling machines for blue science if there are enough ingredients and the supply of blue science is running low). However, at least for this layout, there would be no way to for the factory to know where items should be routed as there is no information about what the inputs to a recipe are.
The obvious way to implement this would be to simply have an option to make the assembling machines send the ingredients for the current recipe as a signal (so if a recipe required 5 iron and 2 coal, it would send exactly 5 iron and 2 coal as a signal).
Another option would be to introduce a special combinator which for an input signal outputs the ingredients for the (first?) signal. This has problems however since a particular item may not necessarily only be possible to produce in a single way. For example the various types of oil can be produced either in refineries or using cracking, so the output of the combinator would not be easily defined. This also has the downside that it introduces a new building, which is not desirable for a simple feature like this. It does raise the question however if there should exist a better way to gain this kind of more specialized information. For example one thing one might want to do is to get the time to craft a particular recipe to for example calculate the number of items per minute that an assembling machine would need when running at full capacity. This is not something I would need at the moment, and it is just an example. However it seems like there would undoubtedly be more kinds of information that one might want to extract from the factories and it is worth thinking about how that could be exposed. Currently it would be hard to output (for example) the crafting time as well as the recipe as there would be no way to distinguish what signal is the recipe and what signal is the crafting time.