Inserter Fuel Leech


In addition to normal behaviour, all Inserters take fuel from entities containing a burner when they or their drop target have no fuel left.

Tweaks
5 days ago
0.16 - 2.1
90.6K
Logistics

g High script update time when an idle furnace has exactly 5 fuel items

7 days ago

Steps to reproduce:
1. Keep the mod's minimum target fuel count at its default value of 5.
2. Place an electric inserter feeding a furnace from a belt.
3. Ensure the furnace contains exactly 5 fuel items and has no remaining burning fuel (remaining_burning_fuel = 0).
4. Do not supply any ore.

Actual behavior:
The mod's script update time increases significantly when many furnaces are in this state.

The mod considers 5 fuel items sufficient, but calculates a retry delay of 0 ticks. This gets clamped to 1 tick, causing the same inserters to be checked every tick indefinitely.

Expected behavior:
Idle furnaces with sufficient fuel should not cause their inserters to be checked every tick.

I investigated this with codex and wrote upper section with codex as my english is bad as hell.

7 days ago

Sounds like an actual bug. I will probably look into it this weekend.
If Codex told you the exact location where the zero-result calculation happens, please tell me too; that would likely make fixing it much easier.

7 days ago
(updated 7 days ago)

At handleTargetFuelInventoryEmpty(), if there are "settingsCache.targetItemCountMin" or more fuels in the furnace, handleTargetFuelInventoryEmpty() will return nil.

getTicksTillNoFuelItemLeft subtracts "settingsCache.targetItemCountMin" from total fuel value. If the furnace have exactly "settingsCache.targetItemCountMin" fuels, return value will be zero.

ticksToWait becomes zero and clamped to 1 tick, meaning that the script will check the inserter for every tick.

5 days ago

It was a side effect of a workaround to prevent starvation in refueling chains. I replaced it with a setting for leaving N items behind when leaching from a fuel inventory and reduced the default wait time when well-fueled or no fuel is found.

New response