Page 1 of 1

[2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 10:47 am
by sparr
I would expect that if I set an inserter to prioritize spoiled items first, it would pull spoilage before anything else. However, it pulls spoilage last, because it's technically an unspoilable item.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 1:51 pm
by boskid
Thanks for the report, however i am throwing this straight to Not a bug. Spoiled priority was implemented primarily for handling one item selection and in original shape it was not even considering items that were not spoilable (spoilage has no timeout to convert into something different so it is not spoilable). I am considering this to be more of "idea or suggestion" hidden behind a bug report because for you it appears as not working as intended when in fact it was never decided how this should behave when taking spoilage into consideration. It was barely defined for spoilables themselves because spoil priority compares ticks remaining until item becomes spoiled so items with different spoil time may appear as incorrectly comparing their spoil percentages. In theory i could add a flag to the ItemPrototype that an item should be considered as "the most spoiled" for the purpose of spoil priority causing the logic to be split into more pieces: "spoiled non spoilables, spoilables in order of spoil tick, non spoilables".

In short: Spoilage being an item that does not spoil anymore is not involved in the spoil priority logic and so this is Not a bug.

-- edit: Moved back to Bug reports because it is being decided by someone else

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 2:58 pm
by boskid
Ok, decision was made and this issue is now fixed for 2.0.18.

Spoilage even if being non spoilable, will be considered as more spoiled than spoilable items. This will be achieved by means of ItemPrototype::spoil_level that was also added for 2.0.18.

With those changes there will be also a behavior change in inserter priorities: When inserter grabs freshest items first, it will consider non spoilables (different than spoilage) to be more fresh than items that are already spoiling.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 3:26 pm
by Linnun
boskid wrote:
Thu Nov 14, 2024 2:58 pm
When inserter grabs freshest items first, it will consider non spoilables (different than spoilage) to be more fresh than items that are already spoiling
Doesn't that defeat the whole point of this setting? If I enable spoilage filter and set it to freshest first, I'd expect it to first grab spoilable items with the most freshness. Feels a bit unintuitive. Maybe a third spoilage filter mode would make more sense than changing this up? "Spoiled first" (behave like before), "Freshest first" (behave like before), "Non-spoilable first" (new behavior)

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 3:49 pm
by robot256
Linnun wrote:
Thu Nov 14, 2024 3:26 pm
boskid wrote:
Thu Nov 14, 2024 2:58 pm
When inserter grabs freshest items first, it will consider non spoilables (different than spoilage) to be more fresh than items that are already spoiling
Doesn't that defeat the whole point of this setting? If I enable spoilage filter and set it to freshest first, I'd expect it to first grab spoilable items with the most freshness. Feels a bit unintuitive. Maybe a third spoilage filter mode would make more sense than changing this up? "Spoiled first" (behave like before), "Freshest first" (behave like before), "Non-spoilable first" (new behavior)
Shouldn't you be using item filters to fix that? Personally I agree setting a freshness priority should not prevent it from grabbing unspoilable items.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 5:41 pm
by Linnun
robot256 wrote:
Thu Nov 14, 2024 3:49 pm
Linnun wrote:
Thu Nov 14, 2024 3:26 pm
boskid wrote:
Thu Nov 14, 2024 2:58 pm
When inserter grabs freshest items first, it will consider non spoilables (different than spoilage) to be more fresh than items that are already spoiling
Doesn't that defeat the whole point of this setting? If I enable spoilage filter and set it to freshest first, I'd expect it to first grab spoilable items with the most freshness. Feels a bit unintuitive. Maybe a third spoilage filter mode would make more sense than changing this up? "Spoiled first" (behave like before), "Freshest first" (behave like before), "Non-spoilable first" (new behavior)
Shouldn't you be using item filters to fix that? Personally I agree setting a freshness priority should not prevent it from grabbing unspoilable items.
Yes, everything on Gleba basically uses item filters already anyways, so it shouldn't matter too much. It's just that when reading the change, it feels unintuitive to me that "freshest first" generally prioritizes unspoilables.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 5:49 pm
by sparr
Linnun wrote:
Thu Nov 14, 2024 3:26 pm
boskid wrote:
Thu Nov 14, 2024 2:58 pm
When inserter grabs freshest items first, it will consider non spoilables (different than spoilage) to be more fresh than items that are already spoiling
Doesn't that defeat the whole point of this setting? If I enable spoilage filter and set it to freshest first, I'd expect it to first grab spoilable items with the most freshness. Feels a bit unintuitive. Maybe a third spoilage filter mode would make more sense than changing this up? "Spoiled first" (behave like before), "Freshest first" (behave like before), "Non-spoilable first" (new behavior)
Quite the opposite for me. I expect un-spoilable items to be considered 100% fresh, and spoilage to be considered 100% spoiled, and spoilable items to come in between. I built a whole factory module around this for iron production on gleba and then was distraught to find that neither of these behaviors worked as I expected. I am delighted that the response here matches my initial expectations about how this mechanic would work.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Thu Nov 14, 2024 6:53 pm
by DarkShadow44
sparr wrote:
Thu Nov 14, 2024 5:49 pm
Quite the opposite for me. I expect un-spoilable items to be considered 100% fresh, and spoilage to be considered 100% spoiled, and spoilable items to come in between. I built a whole factory module around this for iron production on gleba and then was distraught to find that neither of these behaviors worked as I expected. I am delighted that the response here matches my initial expectations about how this mechanic would work.
How do you use this mechanic? I don't understand why you'd want to insert spoilage first, for example.

Re: [2.0.17] Spoilage counts as not spoilable for inserter priority

Posted: Fri Nov 15, 2024 2:02 am
by Hares
DarkShadow44 wrote:
Thu Nov 14, 2024 6:53 pm
How do you use this mechanic? I don't understand why you'd want to insert spoilage first, for example.
You want to remove it first