[0.17.14] Recipes with more than one instance of the same ingredient

This subforum contains all the issues which we already resolved.
GotLag
Filter Inserter
Filter Inserter
Posts: 510
Joined: Sat May 03, 2014 3:32 pm
Contact:

[0.17.14] Recipes with more than one instance of the same ingredient

Post by GotLag » Sat Mar 16, 2019 7:32 pm

In the process of testing a mod I ended up with a recipe containing the following ingredients:

Code: Select all

    ingredients =
    {
      {"copper-cable", 5},
      {"electronic-circuit", 2},
      {"copper-cable", 1},
      {"copper-cable", 1}
    }
In-game this shows up in tooltips and assemblers as having four separate ingredients: 5x copper cable, 1x copper cable, 1x copper cable and 2x electronic circuit.
Inserters only place copper cable in the first slot (5x) in an assembler and leave the other two slots empty, so nothing is crafted.

Inserters probably shouldn't have to have logic added to check for this, and should this sort of recipe definition even be allowed?
However, I can imagine it's possible someone might want multiple slots for the same fluid input, for example they might have some kind of building they want to require having water pumped into from both sides, for whatever reason.

Edit: added an image:
Image
Last edited by GotLag on Sat Mar 16, 2019 7:40 pm, edited 1 time in total.

tehfreek
Filter Inserter
Filter Inserter
Posts: 347
Joined: Thu Mar 17, 2016 7:34 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by tehfreek » Sat Mar 16, 2019 7:39 pm

I'm comfortable with leaving this as Undefined Behavior, i.e. "stop hitting yourself".

GotLag
Filter Inserter
Filter Inserter
Posts: 510
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by GotLag » Sat Mar 16, 2019 7:41 pm

Yeah I'm not aching to see this fixed somehow, but I feel it's an odd behaviour that the devs should at least be aware of (if they're not already).

User avatar
dog80
Fast Inserter
Fast Inserter
Posts: 224
Joined: Thu Dec 08, 2016 11:57 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by dog80 » Sat Mar 16, 2019 7:44 pm

tehfreek wrote:
Sat Mar 16, 2019 7:39 pm
I'm comfortable with leaving this as Undefined Behavior, i.e. "stop hitting yourself".
dx

Rseding91
Factorio Staff
Factorio Staff
Posts: 9432
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by Rseding91 » Sat Mar 16, 2019 8:23 pm

Thanks for the report. I can either ignore it or enforce that there aren't duplicates in recipe inputs. There's no need for duplicate recipe inputs since a single input stack is allows to exceed the input stack limits (assuming the item itself won't crash the game if stacked > 1).
If you want to get ahold of me I'm almost always on Discord.

kovarex
Factorio Staff
Factorio Staff
Posts: 7362
Joined: Wed Feb 06, 2013 12:00 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by kovarex » Sat Mar 16, 2019 9:16 pm

I vote for never allowing duplicate inputs and checking it on prototype load.

GotLag
Filter Inserter
Filter Inserter
Posts: 510
Joined: Sat May 03, 2014 3:32 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by GotLag » Sun Mar 17, 2019 2:48 am

I was really tired when I posted this, or I would have thought of another possibility: if a recipe has multiple entries for a single item type, consolidate them into a single entry. So the recipe in my first post would become:

Code: Select all

    ingredients =
    {
      {"copper-cable", 7},
      {"electronic-circuit", 2}
    }

coderpatsy
Inserter
Inserter
Posts: 41
Joined: Tue Apr 17, 2018 11:45 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by coderpatsy » Sun Mar 17, 2019 3:53 am

If they don't just ignore it, I think it's better to just error out and let the mod maker decide if they want to sum the duplicates or just keep one.

robot256
Long Handed Inserter
Long Handed Inserter
Posts: 61
Joined: Sun Mar 17, 2019 1:52 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by robot256 » Thu Apr 04, 2019 6:50 pm

Yeah, the only way this should matter is if a mod is modifying recipes to add ingredients. There is no reason not to require them to search and consolidate with existing ingredients entries when they do it, since it's always during game loading and won't impact gameplay performance.

TRauMa
Inserter
Inserter
Posts: 30
Joined: Fri Jan 15, 2016 3:48 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by TRauMa » Thu Apr 04, 2019 7:23 pm

This breaks Angel's Bio processing. He uses recipes where you use a temperate garden (rare item found as tree entity on the map) and get one garden back, plus a some % chance for another. Changing that to a 51% chance to get two gardens would have the same expected yield, but it wouldn't be the same because you had a real chance of ending up without the item at all, and it might not be replaceable.

So I agree that the change makes sense for inputs, but not necessarily for outputs, too. Are there any bugs with multiple same outputs? Or maybe you could add an exception in the check to allow two same item outputs if exactly one of them has a probability?

Rseding91
Factorio Staff
Factorio Staff
Posts: 9432
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by Rseding91 » Thu Apr 04, 2019 7:49 pm

TRauMa wrote:
Thu Apr 04, 2019 7:23 pm
This breaks Angel's Bio processing. He uses recipes where you use a temperate garden (rare item found as tree entity on the map) and get one garden back, plus a some % chance for another. Changing that to a 51% chance to get two gardens would have the same expected yield, but it wouldn't be the same because you had a real chance of ending up without the item at all, and it might not be replaceable.

So I agree that the change makes sense for inputs, but not necessarily for outputs, too. Are there any bugs with multiple same outputs? Or maybe you could add an exception in the check to allow two same item outputs if exactly one of them has a probability?
I'll just remove the check for products for the next version of 0.17. I wasn't sure on the check for ingredients in the first place - since there are so many weird cases that stuff like these checks can break. So, I don't mind not having it for products until some future time when someone finds an issue with it.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Arch666Angel
Smart Inserter
Smart Inserter
Posts: 1603
Joined: Sun Oct 18, 2015 11:52 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by Arch666Angel » Thu Apr 04, 2019 8:25 pm

Rseding91 wrote:
Thu Apr 04, 2019 7:49 pm
TRauMa wrote:
Thu Apr 04, 2019 7:23 pm
This breaks Angel's Bio processing. He uses recipes where you use a temperate garden (rare item found as tree entity on the map) and get one garden back, plus a some % chance for another. Changing that to a 51% chance to get two gardens would have the same expected yield, but it wouldn't be the same because you had a real chance of ending up without the item at all, and it might not be replaceable.

So I agree that the change makes sense for inputs, but not necessarily for outputs, too. Are there any bugs with multiple same outputs? Or maybe you could add an exception in the check to allow two same item outputs if exactly one of them has a probability?
I'll just remove the check for products for the next version of 0.17. I wasn't sure on the check for ingredients in the first place - since there are so many weird cases that stuff like these checks can break. So, I don't mind not having it for products until some future time when someone finds an issue with it.
Well I wouldn't mind if you implement other options to model cases like the one mentioned by Trauma. There have been multiple suggestions over time what could be added to recipe outputs in regards to probability and products. But anyway thanks for the fix.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 608
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by DRY411S » Fri Apr 05, 2019 4:23 am

Has this fix also stopped there being duplicate results in recipes? My Recycling Machines Mod has broken in 0.17.25.

Image

I believe that it's not possible for an assembler to produce more than 1 stack of anything. Therefore when recycling anything that is made with more than 1 stack of any ingredient, the Recycling Machines produce the relevant number of stacks as output.

For example, when recycling Power Armor Mk2 [which includes 30 (3 stacks of 10) low density structures], the mod produces this recipe:

Code: Select all

  ["dry411srev-power-armor-mk2"] = {
    category = "recycling-1",
    enabled = false,
    energy_required = 25,
    group = "dry411srev-combat",
    hidden = false,
    icon = "__base__/graphics/icons/power-armor-mk2.png",
    icon_size = 32,
    ingredients = {
      {
        "power-armor-mk2",
        1
      }
    },
    localised_name = {
      "recipe-name.recycledparts",
      {
        "item-name.power-armor-mk2"
      }
    },
    name = "dry411srev-power-armor-mk2",
    order = "e[power-armor-mk2]",
    results = {
      {
        "effectivity-module-2",
        25
      },
      {
        "speed-module-2",
        25
      },
      {
        "processing-unit",
        60
      },
      {
        "electric-engine-unit",
        40
      },
      {
        "low-density-structure",
        10
      },
      {
        "low-density-structure",
        10
      },
      {
        "low-density-structure",
        10
      }
    },
    subgroup = "dry411srev-armor",
    type = "recipe"
  },
3 stacks of low density structures.

Note though that these are RESULTS not ingredients.
Rseding91 wrote:
Thu Apr 04, 2019 7:49 pm
I'll just remove the check for products for the next version of 0.17. I wasn't sure on the check for ingredients in the first place - since there are so many weird cases that stuff like these checks can break. So, I don't mind not having it for products until some future time when someone finds an issue with it.
Good news thanks. Didn't spot that when I posted yesterday. As highlighted by me and others, there are already issues for some mods if you DO have the limitation on products.
Last edited by DRY411S on Fri Apr 05, 2019 1:43 pm, edited 1 time in total.

AriatCowboy
Manual Inserter
Manual Inserter
Posts: 1
Joined: Fri Apr 05, 2019 1:32 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by AriatCowboy » Fri Apr 05, 2019 1:34 pm

Arch666Angel wrote:
Thu Apr 04, 2019 8:25 pm
Rseding91 wrote:
Thu Apr 04, 2019 7:49 pm
TRauMa wrote:
Thu Apr 04, 2019 7:23 pm
This breaks Angel's Bio processing. He uses recipes where you use a temperate garden (rare item found as tree entity on the map) and get one garden back, plus a some % chance for another. Changing that to a 51% chance to get two gardens would have the same expected yield, but it wouldn't be the same because you had a real chance of ending up without the item at all, and it might not be replaceable.

So I agree that the change makes sense for inputs, but not necessarily for outputs, too. Are there any bugs with multiple same outputs? Or maybe you could add an exception in the check to allow two same item outputs if exactly one of them has a probability?
I'll just remove the check for products for the next version of 0.17. I wasn't sure on the check for ingredients in the first place - since there are so many weird cases that stuff like these checks can break. So, I don't mind not having it for products until some future time when someone finds an issue with it.
Well I wouldn't mind if you implement other options to model cases like the one mentioned by Trauma. There have been multiple suggestions over time what could be added to recipe outputs in regards to probability and products. But anyway thanks for the fix.
I second this, that would be nice.

nuhll
Filter Inserter
Filter Inserter
Posts: 820
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by nuhll » Fri Apr 05, 2019 3:14 pm

Please update? I cant play with newest version :(

Allow duplicates...

EmperorZelos
Long Handed Inserter
Long Handed Inserter
Posts: 56
Joined: Sat Mar 05, 2016 5:44 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by EmperorZelos » Fri Apr 05, 2019 4:26 pm

The input one might make sense but for output, we NEED to be able to have duplicates to make certain features work nicely and there you don't need a check in the same way, it is just grab what ever is in the slot and shove it out!

User avatar
DiegoPro77
Fast Inserter
Fast Inserter
Posts: 145
Joined: Tue Feb 20, 2018 1:40 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by DiegoPro77 » Fri Apr 05, 2019 4:43 pm

EmperorZelos wrote:
Fri Apr 05, 2019 4:26 pm
The input one might make sense but for output, we NEED to be able to have duplicates to make certain features work nicely and there you don't need a check in the same way, it is just grab what ever is in the slot and shove it out!
Yeah, he's right, this feature makes sense in the input (also for make order in a game that can easily become chaotic), but in the output it's needed for run many features of many mods.

For example, one of my mods uses a recipe like this:

Code: Select all

  {
    type = "recipe",
    name = name,
	(other things needed for a recipe)
    ingredients =
    {
      {"ingredient", 10},
    },
    results =
    {
      {
        name = "result",
        amount = a particular amount that you're sure to obtain
      },
	  
      {
        name = "result",
	probability = 0.5,
        amount = the probability to obtain a bigger amount than the normal
      },
	},  
  }
  
My discord page, if you want to tell me your idea and/or have any suggestion on my mods: https://discord.gg/6NGYQdX
My mods: https://mods.factorio.com/user/diegopro77
"Anyone who has never made a mistake has never tried anything new." A.Einstein

Bilka
Factorio Staff
Factorio Staff
Posts: 1927
Joined: Sat Aug 13, 2016 9:20 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by Bilka » Fri Apr 05, 2019 4:50 pm

Rseding already said that duplicate products will be allowed again in the next version.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

User avatar
DRY411S
Filter Inserter
Filter Inserter
Posts: 608
Joined: Sun Mar 13, 2016 9:48 am
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by DRY411S » Fri Apr 05, 2019 7:31 pm

Bilka wrote:
Fri Apr 05, 2019 4:50 pm
Rseding already said that duplicate products will be allowed again in the next version.
Reading also said it might be reimplemented if there are issues in the future. So I guess a few of us are wading in to say that there are issues NOW for mods BECAUSE it's been implemented. 8-)

nuhll
Filter Inserter
Filter Inserter
Posts: 820
Joined: Mon Apr 04, 2016 9:48 pm
Contact:

Re: [0.17.14] Recipes with more than one instance of the same ingredient

Post by nuhll » Sat Apr 06, 2019 11:03 am

Bilka wrote:
Fri Apr 05, 2019 4:50 pm
Rseding already said that duplicate products will be allowed again in the next version.
I really dont want to stress or anything.

But with this change my whole mod pack is not working anymore, i need to disable bio processing and other mods relay on it.

Cant you push a quick update to correct this? :roll:

Post Reply

Return to “Resolved Problems and Bugs”

Who is online

Users browsing this forum: No registered users