Factory solver based on IPMs for LP

by B_head

The Factorio calculator. Calculate the quantities of machines and ingredients required in a factory to hit your target production rate.

Utilities
8 hours ago
2.0
2.25K

b Crash on selecting a solution

1 year, 3 months ago

Hi, just wanted to let you know that removing a machine from a mod will cause the solver to crash upon selecting a solution that relies on that machine:

The mod Factory solver based on IPMs for LP (0.3.13) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event factory_solver::on_gui_selection_state_changed (ID 63)
__factory_solver__/manage/save.lua:451: attempt to index local 'machine' (a nil value)
stack traceback:
    __factory_solver__/manage/save.lua:451: in function 'get_total_modules'
    __factory_solver__/ui/solution_editor.lua:52: in function 'handler'
    __flib__/gui.lua:177: in function 'dispatch'
    __factory_solver__/fs_util.lua:138: in function 'dispatch_to_subtree'
    __factory_solver__/ui/solution_selector.lua:61: in function 'handler'
    __flib__/gui.lua:177: in function <__flib__/gui.lua:160>

This may also happen right as the gui is opened. There seems to be no way of removing the offending solution to avoid the crash.

19 days ago

Hi ZarSasha, sorry for the very late follow-up. This is fixed in 0.4.0 (just released): a production line that references a prototype removed by a disabled or updated mod now degrades gracefully instead of crashing in get_total_modules, so existing saves with affected solutions should load again. Thanks for the detailed stack trace — it made the root cause easy to pin down once I came back to the project.

18 days ago

Nice, thanks for the update! I have taken a break from the game myself as well, but I recall that I really like the way that the mod goes about calculating things, compared to other factory planners. I have just done a bit of testing, and it seems to be working well: Whether an end product or a required machine is missing, a simple question mark replaces the relevant icon, without any crash happening.

It's great to see the mod updated, and I look forward to relying on it for future projects.

New response