this post was submitted on 17 Mar 2024
58 points (96.8% liked)

Factorio

1716 readers
32 users here now

Dreaming of transport belts

Rules

Last updated: 2023/06/05

Useful links

Purchase

Factorio has never been on sale and will (probably) never be on sale

founded 1 year ago
MODERATORS
you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 1 points 8 months ago* (last edited 8 months ago)

Multiple operations per tick is a trick I learned early in my days of modding. What you do is use the modulo of an operation (for example a 132% completion is equal to 1.32 and its modulo is .32 or 32%) and run normal math on that, while outputting the factor of the whole number. So if you have 30% operations per tick it's just a simple "add 30% to your progress" but if I have something crazy like 810% than I will add 10% to the operation and then add an output equal to the normal output multiplied by 8 and output it that tick.

Put more simply, add the % of progress to your bar, if it's above 100% than divide your progress value by 100 and round down. The result will be amount of times to output the item while the reminder will become your new progress % value. If the process is something that can't be resolved to a simple number (such as pulling from a randomized loot table) than use a loop to run the operation x amounts of time.

The best part about this system is that it also fixes the bug where you have like 99% progress, add 13% and end up at 0% progress.