Code: Select all
data.raw["item"]["iron-plate"].spoil_result = {
{
name = "copper-ore",
weight = 1
},
{
name = "iron-ore",
weight = 99
}
}
Code: Select all
data.raw["item"]["iron-plate"].spoil_result = {
{
name = "copper-ore",
weight = 1
},
{
name = "iron-ore",
weight = 99
}
}
Nope, currently you can only specify a single spoil_result, unless you do more complex shenanigans with spoil_to_trigger_result.Puke wrote: Thu Dec 05, 2024 10:17 am Currently, you can have multiple "spoil_result" for an item. Each spoil result can have a probability to happen.
It wouldn't really be that janky. When combining items into a stack, the spoilage time is averaged, so it's already "janky" by your definition. Making the whole stack spoil into the same item based on the defined weights would be no less jank, and still makes sense.MacFeejj wrote: Thu Dec 05, 2024 9:31 pm This is a nice idea, but technically it'd raise a _lot_ of implementation issues. Currently, one stack of items will always spoil into one stack of items - if a stack spoils while an inserter is moving it, or in a container with limited size, or while being carried in a rocket, it'll spoil into exactly one stack replacing the one already there - if one stack of items could spoil into multiple stacks, that would raise a _lot_ of issues. The only sane way I can see this working is if each stack spoils into the same item, which, while averaging out into the same result, would be quite janky.
A simple suggestion, which I think is clean and clearRseding91 wrote: Mon Aug 11, 2025 3:30 pm Code wise this would be fairly simple to do. Tooltip wise I have zero idea how it would be shown.
I recall raiguard(?) had a WIP implementation of weighted recipe products. See how he's done it?Rseding91 wrote: Mon Aug 11, 2025 3:30 pm Code wise this would be fairly simple to do. Tooltip wise I have zero idea how it would be shown.
That's not great, because the weight is divorced from the item.
Well… in fact one of the two kind of blocker issues with that was the tooltip.curiosity wrote: Tue Aug 12, 2025 12:18 am I recall raiguard(?) had a WIP implementation of weighted recipe products. See how he's done it?
The point was to have it weighted such that there would only ever be one outcome. So item A could spoil into item B or item C with a set probability for each totaling 100%, but not both. One of the other suggestions which i like is also having a "spoil to nothing" option where the item just disappears, so you can have item B @ 30%, item C @ 20%, and nothing @ 50%snouz wrote: Tue Aug 12, 2025 12:46 pm Something to consider: if the result is like recipe results, that means you could have several items out of 1 spoiling item? That would mean you could hit a container max and items would need to be able to spill, but I guess that's already taken into account since it can already theoretically spoil into an item with a lower stack size.