Page 1 of 1

Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Wed Dec 04, 2024 2:09 pm
by kocur4d
I made a post yesterday asking if it is possible for an item to spoil into multiple items based on probability. This feature aligns closely with the idea I’m working on for my mod, which revolves around a new type of ore called Probabilitium. This ore can be processed into basic resources like iron, copper, stone, or coal based on probabilistic outcomes.

While there were some helpful suggestions and hacks on how to achieve this, I believe the ItemPrototype->SpoilResult property would benefit greatly from more flexibility. In my mind, it seems conceptually similar to how RecipePrototype->Results behaves, allowing for more complex outcomes such as multiple possible results with assigned probabilities.

Expanding the functionality of SpoilResult would not only help my mod but could open up new possibilities for other mods as well.

Please let me know your thoughts on this suggestion.

Link to my post: viewtopic.php?f=25&t=123628

Re: Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Wed Dec 04, 2024 2:58 pm
by boskid
This is quite unlikely to happen because this creates a lot of new corner cases we would have to handle. For example if you have a lab and a science pack would spoil into 5 items, where would those new items go? We cannot simply reject spoiling and so if more items would be created, some of them would have to be inserted into the inventory but if the inventory has no space for other items then what, should those items get dropped on ground? What if such item is inside of a script inventory which is not associated with any point on surface so we cannot drop the items around.

Re: Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Wed Dec 04, 2024 3:17 pm
by kocur4d
Oh, bummer! That makes sense regarding the corner cases :sad-face:

I do find it kind of amusing to imagine a delayed Probabilitium train traveling from the ore site to the processing site, "spilling the beans" along the way! Though, I can see how that might not be everyone’s idea of fun.

Re: Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Wed Dec 04, 2024 3:22 pm
by kocur4d
How about if it would spoil to one out of many? Aka always single item but from choice of items.

Is something like that possible in the codebase?

Re: Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Wed Dec 04, 2024 8:11 pm
by curiosity
Can't you just put a trigger on it and do it yourself?

Re: Suggestion: Make ItemPrototype->SpoilResult Behave Like RecipePrototype->Results for Greater Flexibility

Posted: Thu Dec 05, 2024 9:12 pm
by protocol_1903
Related post asking for spoil_result to be a weighted table. I feel like this would be a better alternative, but still in the same vein as having a results table