Fill4Me

by kovus

Fill4Me will automatically insert fuel and/or ammunition from your main inventory into entities when you place them. It is mod-agnostic and will learn about items & entities in other mods. It is an alternative to the Autofill mod.

Utilities
3 years ago
0.16 - 1.1
110K

b Console error upon loading

3 years ago
(updated 3 years ago)

Large mod pack, but upon adding Fill4Me to it in 1.1 it prints this error to the console:

__Fill4Me__/fill4me/ammo.lua:107: stack overflow
__Fill4Me__/fill4me/ammo.lua:131: stack overflow

However, the game does continue to work and function.

The first function referenced on line 107 is:

function Ammo.damage_from_actions(actionset)
    local damage = 0
    for _, act in pairs(actionset) do
        damage = damage + Ammo.damage_from_action(act) * act.repeat_count
    end
    return damage
end

This is indeed recursive, it should instead be made iterative, or at the very least prebake the values into a memoized cache. Similar for remaining functions as well. Lua is not a recursive-safe language as it uses the system stack instead of stackless functions unless using coroutines and trampolines.

3 years ago

What mod pack is this pairing with that it's causing problems? It will be hard to reproduce without knowing it.

I'm having a hard time imagining building an action set more than a few levels deep, which should be a far cry from where a stack overflow occurs.

3 years ago

While making a new game with this pack and this mod I got this error upon world creation and it bailed back to the menu:

The mod Fill4Me (0.9.5) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Fill4Me::on_init()
__Fill4Me__/stdlib/event/event.lua:156: __Fill4Me__/stdlib/event/event.lua:156: __Fill4Me__/fill4me/ammo.lua:107: stack overflow
stack traceback:
    [C]: in function 'error'
    __Fill4Me__/stdlib/event/event.lua:156: in function 'dispatch'
    __Fill4Me__/stdlib/event/event.lua:38: in function <__Fill4Me__/stdlib/event/event.lua:37>

Removing this mod and making a new save game with the rest, download it here then just load and sync it (it's the space exploration defaults for the map options), then add this mod and make a new game: https://overminddl1.com/Factorio/saves/PackGame.zip

3 years ago

While I'm tempted to push this back as an issue in Space Exploration (as well as Barons Turrets) because they both generate action sets which are self referential, it's just not entirely my style (if I can avoid it). So, this issue should be resolved in v0.10.0. Fill4Me now keeps track of actions that create entities to make sure that it doesn't end up in a loop. If it does, it stops processing, throws a warning, and ends up with a not-really-valid damage value for that ammunition.

Space Exploration has a plague rocket, which creates a plague wave, which creates a plague cloud, which creates a plague wave, and back & forth.
Barons Turrets seems to have a similar issue with the cannon turret cluster grenade.

I don't know how either one of these mods prevent those actions from being infinite in scope, but I haven't looked very deep into it, and don't plan on it. I consider their prototype definitions for those items to be broken.

3 years ago
(updated 3 years ago)

Yeah, the plague rocket is designed to wipe the life from an entire surface out to surface generation range. Unsure what the barons turrets cannon turret cluster grenade is doing to cause it. They both still work fine with the game though. Thanks much for this update!

New response