probability in recipe output causing bloated numbers in production screen

This subforum contains all the issues which we already resolved.
Post Reply
kingarthur
Smart Inserter
Smart Inserter
Posts: 1459
Joined: Sun Jun 15, 2014 11:39 am
Contact:

probability in recipe output causing bloated numbers in production screen

Post by kingarthur »

i have a recipe that has 4 outputs and the second one has a probability of 10% and anytime that part of the results triggers it causes the production screen to show the recipe as having produced several million items per minute. the second result with probability doesnt do that at all and seems to report much more expected numbers.

Code: Select all

data:extend(
{
	{
    type = "recipe",
    name = "moondrop-seeds",
    category = "crafting",
    enabled = true,
    energy_required = 5,
    ingredients = {
        {type = "item", name = "iron-plate", amount = 5},
    },
    results = {
        {type = "item", name = "iron-plate", amount = 2, catalyst_amount = 2},
        {type = "item", name = "iron-plate", amount_min = 1, amount_max = 3, probability = 0.10, catalyst_amount = 3},
        {type = "item", name = "copper-plate", amount= 7},
        {type = "item", name = "copper-plate", amount_min = 1, amount_max = 3, probability = 0.25}
    },
    main_product = 'copper-plate',
	}
}
)
this one breaks

Code: Select all

 {type = "item", name = "iron-plate", amount_min = 1, amount_max = 3, probability = 0.10, catalyst_amount = 3}
this one is fine.

Code: Select all

 {type = "item", name = "copper-plate", amount_min = 1, amount_max = 3, probability = 0.25}
ive made a little example mod that recreates the problem using just base game items in an assembly machine
Attachments
example_0.0.1.zip
(646 Bytes) Downloaded 112 times

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2252
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: probability in recipe output causing bloated numbers in production screen

Post by boskid »

Hm.. uint32 underflow on substraction because there was 1 item produced while catalyst is set to 3. Not sure if this should be handled as "1 item produced, 3 lost" or as "2 items lost". Having less amount on output than catalyst amount feels quite troublesome.

User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 2252
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: probability in recipe output causing bloated numbers in production screen

Post by boskid »

Thanks for the report. Test case is added and issue is now fixed for 0.18.22

Post Reply

Return to “Resolved Problems and Bugs”