Would a recipe input of either/or ever work?

Place to post guides, observations, things related to modding that are not mods themselves.
GrumpyJoe
Filter Inserter
Filter Inserter
Posts: 496
Joined: Fri Apr 06, 2018 7:10 pm
Contact:

Would a recipe input of either/or ever work?

Post by GrumpyJoe »

Does anyone think/know if it is (will ever be) possible to have recipes that can use one of n inputs and make something of it?

Im thinking of
A1 OR A2 plus B = C
A1 OR A2 plus B1 OR B2 = C

I'd have an idea for a mod which could benefit from something like this
It would not be exactly like upgrading from crushed to washed ore like in angels for example, but still follow a vague idea keeping/increasing efficiency.
But for this, it would be thematically fit alot more, if you could set a recipe and forget about it for a while(forever) and still get some results.
User avatar
ickputzdirwech
Filter Inserter
Filter Inserter
Posts: 794
Joined: Sun May 07, 2017 10:16 am
Contact:

Re: Would a recipe input of either/or ever work?

Post by ickputzdirwech »

GrumpyJoe wrote: Thu Aug 19, 2021 9:58 am A1 OR A2 plus B = C
I think this should work if you use a furnace and define two recipes A1+B and A2+B. Since furnaces swap between recipes automatically based on their input. It is very limited however:
1. If you don't want the player to require a lot of combinators, the recipe should always require only one A1 or A2 (for B it doesn't matter). Otherwise the furnace can get stuck with one recipe with insufficient ingredients.
2. Some circuit logic will always be required though, because you have to input the A1 or A2 before the B. Otherwise the furnace will decide which recipe it will use before it knows what A is available. You need to force the furnace to decide which recipe to use based on the A you input.
GrumpyJoe wrote: Thu Aug 19, 2021 9:58 am A1 OR A2 plus B1 OR B2 = C
Again with four recipes for a furnace and some circuit logic that insures that you only insert even amounts of A's and B's this should be possible.
Mods: Shortcuts for 1.1, ick's Sea Block, ick's vanilla tweaks
Tools: Atom language pack
Text quickly seems cold and unfriendly. Be careful how you write and interpret what others have written.
- A reminder for me and all who read what I write
GrumpyJoe
Filter Inserter
Filter Inserter
Posts: 496
Joined: Fri Apr 06, 2018 7:10 pm
Contact:

Re: Would a recipe input of either/or ever work?

Post by GrumpyJoe »

Thanks for that answer.
However, I should habe been more clear about what I mean, or at least shouldn't have used angels as an example.

I don't actually want it to be ores only, in fact I didn't even think ores.
I would want actual items, crafted in assembling machines.

Meanwhile i thought about it some more, and now I'd also like reciepe changing, depending on what AM version is crafting it. I'm thinking about something like
AM1: 80% item D
AM2: 90% item D
AM3: 95% item D

Might be able to restrict recipes to certain machines.
But it would be a hell of a lot of hardcoding it I guess
User avatar
Silari
Filter Inserter
Filter Inserter
Posts: 539
Joined: Sat Jan 27, 2018 10:04 pm
Contact:

Re: Would a recipe input of either/or ever work?

Post by Silari »

Assembling machines can't swap recipes based on input ingredients, you'd pretty much have to use the furnace prototype as the base for a new building. A building made with the furnace prototype makes whatever recipes it has the category for, it's not limited only to ores.

IIRC AAI's fuel processor works that way. It's a furnace internally, but it has recipes for items with a fuel value to turn them into processed fuel. There's no selecting a recipe, it just uses what you give it.
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Would a recipe input of either/or ever work?

Post by eradicator »

GrumpyJoe wrote: Thu Aug 19, 2021 9:58 am Does anyone think/know if it is (will ever be) possible to have recipes that can use one of n inputs and make something of it?
Is right now? See below. Will ever be? Not a crystal ball expert. Sometimes even the devs are wrong about their own "this will never happen" future predictions.
ickputzdirwech wrote: Thu Aug 19, 2021 12:12 pm
GrumpyJoe wrote: Thu Aug 19, 2021 9:58 am A1 OR A2 plus B = C
I think this should work if you use a furnace and define two recipes A1+B and A2+B. Since furnaces swap between recipes automatically based on their input. I
As far as I know furnaces only work with recipes that have at most one item ingredient. So [(I1 or I2) and F1] would be possible by having two different recipes as long as F1 is a fluid. Not sure about [(I1 or I2) and (F1 or F2)]?
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
GrumpyJoe
Filter Inserter
Filter Inserter
Posts: 496
Joined: Fri Apr 06, 2018 7:10 pm
Contact:

Re: Would a recipe input of either/or ever work?

Post by GrumpyJoe »

[So basicly it would be restricted to a furnace type.

I guess the easier way would be with unlocking various different % recipes in AMs

Thinking mostly of a theme with recycling, quality control and waste products going back to the start of the chain.

The idea is that punching gears out of metal plates has no waste and that machines never fail to produce perfect items 100% of the time.

Im sure there is something like that already on the portal, and that my ideas may be overshooting the goal, but since I had to reduce playtime drastically, I'm more thinking of hacking something together than to actually play it myself 🤣
SoShootMe
Filter Inserter
Filter Inserter
Posts: 517
Joined: Mon Aug 03, 2020 4:16 pm
Contact:

Re: Would a recipe input of either/or ever work?

Post by SoShootMe »

GrumpyJoe wrote: Fri Aug 20, 2021 8:36 am So basicly it would be restricted to a furnace type.

I guess the easier way would be with unlocking various different % recipes in AMs
Or both? With some constraints, the best approach I think would work is to have "furnaces" to accept the faulty items and recycle them. And use crafting categories to allow different recipes in different crafting machines, eg to make assembling machine 3 less likely to produce faulty items or more efficient recycling (but consider the result of fast-replacing).
User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5211
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Would a recipe input of either/or ever work?

Post by eradicator »

Would you mind hard-linking the percentage to a certain machine class? I.e. AM1 can only make 80%, AM3 could only make 95% (not 80%!). That way progression is somewhat natural, gives a good reason to upgrade assemblers (I often don't because old recipes are fast enough), and there's only one recipe choice per machine. You'd "only" need a script that correctly handles up/downgrading of machines ("" quotes because it's not as straight forward as it sounds).
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.
Post Reply

Return to “Modding discussion”