joined recipe outputs dependent on probability

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
protocol_1903
Fast Inserter
Fast Inserter
Posts: 133
Joined: Fri Sep 09, 2022 4:33 pm
Contact:

joined recipe outputs dependent on probability

Post by protocol_1903 »

I don't really know how to put it all into one sentence. Hopefully I can properly explain what I wish to do. I also hope I haven't missed a previous post on this topic, but I found it hard to title this one and searching for someone else's title was proving difficult

I wish that you could specify a product of a recipe with a probability, and if that probability check fails, then another item will be returned instead. Like so:

An example recipe where you try to fill a water barrel, but spill some.

Code: Select all

ingredients = {
  { type = "item", name = "barrel", amount = 1 },
  { type = "fluid", name = "water", amount = 100 }
},
results = {
  {
    type = "chance",
    probability = 0.8,
    success = { type = "item", name = "water-barrel", amount = 1 },
    failure = { type = "item", name = "barrel", amount = 1 }
  },
  { type = "fluid", name = "water", amount = 20 } -- normal fluid output
}
Another example recipe where you try to fill a water barrel, but get all the water back if you fail

Code: Select all

ingredients = {
  { type = "item", name = "barrel", amount = 1 },
  { type = "fluid", name = "water", amount = 100 }
},
results = {
  {
    type = "chance",
    probability = 0.8,
    success = { type = "item", name = "water-barrel", amount = 1 },
    failure = {
      { type = "item", name = "barrel", amount = 1 },
      { type = "fluid", name = "water", amount = 100 }
    }
  }
}
You could also not specify a failure product, so you can get multiple items if the probability check passes, but nothing if it fails.

This might be useful in certain recipes in SA and mods, where some percent of products should be x, and the rest y, but the total number of products is the same across different trials. In general gameplay, as a common recipe, it wouldn't be noticeable and could be easily replicated with the current probability system (although the number of barrels might fluctuate in some cases). It's the edge case of specialized recipes, stuff like satellite launches, that I'm interested in.
If you need to reach me, message me on discord.

I make qol mods. Check them out, maybe.
https://mods.factorio.com/user/protocol_1903
If you have a mod idea, I can look into it.
curiosity
Filter Inserter
Filter Inserter
Posts: 515
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: joined recipe outputs dependent on probability

Post by curiosity »

Post Reply

Return to “Modding interface requests”