Page 1 of 1

[0.17.42] Recipe with probability has other result as befor the update

Posted: Tue May 21, 2019 9:59 pm
by AmatorPhasma
Hi,

I dont know if it is a bug or something related to my misunderstanding of the recipe definitions.
My recipes in my mod have an other result after updating to 0.17.42
looks related to:
[*]Fixed that products wouldn't allow amount_min of 0 for items. (71014)

My recipe definition:

Code: Select all

data:extend(
{
    {
        type = "recipe",
        name = "apm_crusher_drumms_used_repair",
        category = "crafting-with-fluid",
        icons = {
                    apm.power.icons.crusher_drumms_used,
                    apm.lib.utils.icon.dynamics.recycling,
                },
        icon_size = 32,
        group = "apm_power",
        subgroup = "apm_power_tools",
        order = 'ac_b',
        normal = {
            enabled = false,
            energy_required = 3,
            ingredients = {
                {type="fluid", name="water", amount=30},
                {type="item", name="apm_crusher_drumms_used", amount=5},
                {type="item", name="repair-pack", amount=1},
            },
            results = { 
                {type="item", name="apm_crusher_drumms", amount=4, catalyst_amount=4},
                {type="item", name="apm_crusher_drumms", amount_min=0, amount_max=1, probability=0.95, catalyst_amount=1},
                {type="item", name="repair-pack", amount_min=0, amount_max=1, probability=0.95, catalyst_amount=1},
                {type="fluid", name="apm_dirt_water", amount=30, catalyst_amount=30},
            },
            main_product = '',
            requester_paste_multiplier = 4,
            always_show_products = true,
            always_show_made_in = true,
            allow_decomposition = false,
            allow_as_intermediate = false,
            allow_intermediates = false,
        },
        expensive = {
            enabled = false,
            energy_required = 3,
            ingredients = {
                {type="fluid", name="water", amount=30},
                {type="item", name="apm_crusher_drumms_used", amount=5},
                {type="item", name="repair-pack", amount=1},
            },
            results = { 
                {type="item", name="apm_crusher_drumms", amount=4, catalyst_amount=4},
                {type="item", name="apm_crusher_drumms", amount_min=1, amount_max=1, probability=0.95, catalyst_amount=1},
                {type="item", name="repair-pack", amount_min=1, amount_max=1, probability=0.95, catalyst_amount=1},
                {type="fluid", name="apm_dirt_water", amount=30, catalyst_amount=30},
            },
            main_product = '',
            requester_paste_multiplier = 4,
            always_show_products = true,
            always_show_made_in = true,
            allow_decomposition = false,
            allow_as_intermediate = false,
            allow_intermediates = false,
        }
    },
})
In the attatchments two images:
- version 0.17.41 (also tested on version .40, .39 ... down to 0.32)
- version 0.17.42

The question is: bug or not bug? :)

Re: [0.17.42] Recipe with probability has other result as befor the update

Posted: Wed May 22, 2019 12:36 am
by Rseding91
Thanks for the report. I would say the recipe is now correct after the update and was wrong before.

As you have the recipe defined you have: a 95% chance to get an item between 0 and 1.

So you have a 95% chance to get a 50% chance at an item which is a 47.5% chance at an item. Rounded up that's 48% which is what you see in the tooltip.

Re: [0.17.42] Recipe with probability has other result as befor the update

Posted: Sat Sep 07, 2019 5:31 pm
by Trblz
This thread is the closest i can find an answer to my question.

In latest beta:

Let's take Chemical Plant as example: ingredients: 5x steel-plate, 5x iron-gear-wheel, 5x electronic circuit, 5x pipe

Now i am looking for the following probability behavior:

Input: 5x steel-plate, 5x iron-gear-wheel, 5x electronic circuit, 5x pipe
Success-Output: 1x chemical-plant
Failure-Output : 5x steel-plate-scrap, 5x iron-gear-wheel-scrap, 5x electronic circuit-scrap, 5x pipe-scrap

Probability for Success-Output:Failure-Output = 80:20 % ; its either Success or Failure, so no 16% (0.8*0.2) chance of both outputs at the same time.

Is this possible with the current recipe structure definitions?

Re: [0.17.42] Recipe with probability has other result as befor the update

Posted: Sat Sep 07, 2019 10:12 pm
by Rseding91
Trblz wrote: Sat Sep 07, 2019 5:31 pm Is this possible with the current recipe structure definitions?
Unfortunately no.