[1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Bugs that are actually features.
Post Reply
PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

[1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Post by PFQNiet »

My mod - among many other things - rescales fluids to closer match the numbers of solid items being used. So instead of a recipe for example taking 1 iron plate, 5 sulfur, 100 water to make 50 sulfuric acid, it would take 1 plate, 5 sulfur, 10 water and produce 5 acid.

This is an overhaul mod and I'm kind of abusing the game engine in some parts, and here's where I found breakage:

If a recipe produces fractional amounts of fluid, that's fine. It's all good, the game handles it just fine. I can have a recipe produce 1.66666 fluid for a 1-second craft and it will perfectly produce 100 per minute. But there's a certain point where very small numbers just round down to zero, and this is a problem.

In the example of rescaling water, instead of an offshore pump producing 1200 water per second, mine produces... 2. When I then went to feed this water into a boiler, I set the values such that it would consume 0.75 water per second to produce the same amount of steam. This was when I discovered that the modded boiler would happily consume the 0.75 water, but would output no steam at all.

More recently I've discovered that this applies to assembling machines as well. They will happily consume fractional amounts of fluid - I even tested it with a recipe that consumes 0.0125 water per craft, and it does so just fine. But if I have a product with a very low value then it just rounds that down to zero. After a bit more testing, this happens if the product amount is <= 0.05. Interesting that 0.05 itself exhibits the problem...

Steps to reproduce: mod in a recipe with the following:

Code: Select all

ingredients = {{type="fluid", name="water", amount=0.05}},
energy_required = 0.1,
results = {{type="fluid", name="crude-oil", amount=0.05}}
This "recipe" should convert water into crude oil at a rate of 0.5/s, but instead it just consumes the water without producing anything.

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

Re: [1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Post by Bilka »

This doesn't sound very surprising considering viewtopic.php?p=538288#p538288.
I'm an admin over at https://wiki.factorio.com. Feel free to contact me if there's anything wrong (or right) with it.

PFQNiet
Filter Inserter
Filter Inserter
Posts: 289
Joined: Sat Sep 05, 2020 7:48 pm
Contact:

Re: [1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Post by PFQNiet »

Oh. Well. That explains that! Thanks for the link.

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

Re: [1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Post by kovarex »

First of all, fluid numbers are intentionally high, to avoid bigger precision when it comes to circuit network, which uses natural numbers.
Second of all, small amount of fluids are nullified to solve some corner cases.

boran_blok
Long Handed Inserter
Long Handed Inserter
Posts: 93
Joined: Fri Mar 01, 2019 7:56 am
Contact:

Re: [1.1.26] Modded recipes producing tiny amounts of fluid produce zero instead

Post by boran_blok »

Just to everything times 100 and say the units are in cl. Problem solved, as the unit is never mentioned anyways.

Post Reply

Return to “Not a bug”