SpoilToTriggerResult : Trigger once per stack option

Puke
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 13, 2016 7:00 pm
Contact:

SpoilToTriggerResult : Trigger once per stack option

Post by Puke »

Hello !
Currently, SpoilToTriggerResult has a key "items_per_trigger" that allows us to define (if my understanding is correct) to trigger the script only if there is the required amount of items in the stack.

However, if we want to set this value to 1, meaning only one item is needed to trigger the script, it will fire one event PER item in the stack.
I see how this can be desirable, but there are many cases where it is not, and I wish I could only fire a single event.

Also, having many items stacks firing one event per item is very bad for performance. I tested it, just firing the events without doing anything else can kill the UPS counter.

Can we get a way to fire a single event / a single trigger per stack instead of per items in a stack, please ? :)

Thanks you for reading, cheers
Rseding91
Factorio Staff
Factorio Staff
Posts: 15231
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: SpoilToTriggerResult : Trigger once per stack option

Post by Rseding91 »

I could add such a value. But, currently the way it works is: it will always run at least once for a given stack. The health ratio for created entities will depend on the ratio between items_per_trigger and the count in the stack. If the trigger is not creating entities then that has no impact on things.
If you want to get ahold of me I'm almost always on Discord.
User avatar
boskid
Factorio Staff
Factorio Staff
Posts: 3757
Joined: Thu Dec 14, 2017 6:56 pm
Contact:

Re: SpoilToTriggerResult : Trigger once per stack option

Post by boskid »

For 2.0.42 i did 2 changes: fixed items_per_trigger computation because the trigger was not running correct amount of times, and also got rid of the health scaling artifact. That means in 2.0.42 you will be able to have "trigger once per stack" behavior by setting items_per_trigger set to the stack size of the item: any amount of items from 1 up to stack size will cause trigger to run exactly once.
Puke
Burner Inserter
Burner Inserter
Posts: 12
Joined: Mon Jun 13, 2016 7:00 pm
Contact:

Re: SpoilToTriggerResult : Trigger once per stack option

Post by Puke »

Thank you !
curiosity
Filter Inserter
Filter Inserter
Posts: 607
Joined: Wed Sep 11, 2019 4:13 pm
Contact:

Re: SpoilToTriggerResult : Trigger once per stack option

Post by curiosity »

Duplicate of (a poorly formulated) viewtopic.php?t=127091
Post Reply

Return to “Implemented mod requests”