Krastorio 2


An overhaul mod focusing on end-game technologies and moderately increased complexity.

Overhaul
9 days ago
0.18 - 1.1
308K
Transportation Logistics Trains Combat Armor Mining Fluids Logistic network Manufacturing Power Storage

b [Fixed] Using upgrade planner on blueprint causes crash

4 years ago
(updated 4 years ago)

I've tested this with Krastorio 2 as the only mod to verify that no other mods are interfering.

I've been able to cause this crash by doing the following:
1. Start a new game with Krastorio 2 as the only mod.
2. Create a blueprint with a yellow transport belt.
3. Create an upgrade planner to upgrade yellow transport belts to red fast transport belts.
4. Edit the blueprint and apply the upgrade planner to the blueprint. Crash happens when clicking save.

Excerpt from the factorio-current.log:

  48.651 Error MainLoop.cpp:1202: Exception at tick 1326: The mod Krastorio 2 (0.9.11) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event Krastorio2::on_player_configured_blueprint (ID 70)
Item is not blueprint.
stack traceback:
    ..._/lib/private/control-scripts/electric-offshore-pump.lua:45: in function 'callback'
    ...control-scripts/control-lib/control-callbacks-merger.lua:90: in function <...control-scripts/control-lib/control-callbacks-merger.lua:88>
stack traceback:
    [C]: in function 'is_blueprint_setup'
    ..._/lib/private/control-scripts/electric-offshore-pump.lua:45: in function 'callback'
    ...control-scripts/control-lib/control-callbacks-merger.lua:90: in function <...control-scripts/control-lib/control-callbacks-merger.lua:88>
4 years ago

I'm not a modder, but I've been a programmer for over 20 years.

I believe that this issue is because the last thing in the cursor_stack was the upgrade planner, even though the blueprint is being edited. If that is the case, maybe you can check if the item in player.cursor_stack is a blueprint before calling is_blueprint_setup?

As an experiment I made the following change and it worked without crashing.

In lib/private/control-scripts/electric-offshore-pump.lua I change line 45-47 from

if player and player.valid and player.cursor_stack.valid_for_read and player.cursor_stack.is_blueprint_setup() then
    local blueprint_entities = player.cursor_stack.get_blueprint_entities()
    if blueprint_entities and next(blueprint_entities) then

to

if player and player.valid and player.cursor_stack.valid_for_read then
    local blueprint_entities = player.cursor_stack.get_blueprint_entities()
    if blueprint_entities and player.cursor_stack.is_blueprint_setup() and next(blueprint_entities) then

I do not know if the call to is_blueprint_setup is needed at that point, or if this will cause other bugs.

4 years ago

I am also getting the following error when I try to upgrade a blueprint with the upgrade planner. I have not narrowed it down to transport belts, and I also have a whole bunch of other mods.

Let me know if you would like any further information from me.

Error while running event Krastorio2::on_player_configured_blueprint (ID 70)
Item is not blueprint.
stack traceback:
.../lib/private/control-scripts/electric-offshore-pump.lua:45: in function 'callback'
...control-scripts/control-lib/control-callbacks-merger.lua:90: in function <...control-scripts/control-lib/control-callbacks-merger.lua:88>
stack traceback:
[C]: in function 'is_blueprint_setup'
...
/lib/private/control-scripts/electric-offshore-pump.lua:45: in function 'callback'
...control-scripts/control-lib/control-callbacks-merger.lua:90: in function <...control-scripts/control-lib/control-callbacks-merger.lua:88>

Linver β˜†
4 years ago
(updated 4 years ago)

Hi, thank u for the bug report.
Should be fixed in the latest versions, if persist notify it!