Blueprint Signals (continued)

by Yenz

Read a blueprint and generate a set of combinators containing the item signals and counts.

Utilities
9 months ago
1.1
5.38K
Blueprints

b Crash when mod-settings change via script

9 months ago
(updated 9 months ago)

Any time a global-runtime-setting is changed via script (i.e. not using the mod-settings GUI) this will happen in BlueprintSignals_continued.

8657.040 Error MainLoop.cpp:1382: Exception at tick 17589266: The mod LTN - Logistic Train Network (1.18.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event LogisticTrainNetwork::ltn-toggle-dispatcher (ID 245)
The mod Blueprint Signals (continued) (0.4.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event BlueprintSignals_continued::on_runtime_mod_setting_changed (ID 61)
BlueprintSignals_continued/control.lua:103: bad argument Haxtorio#3 of 3 to '__index' (string expected, got nil)
stack traceback:
[C]: in function '__index'
BlueprintSignals_continued/control.lua:103: in function <BlueprintSignals_continued/control.lua:102>
stack traceback:
[C]: in function '__newindex'
LogisticTrainNetwork/script/hotkey-events.lua:13: in function <LogisticTrainNetwork/script/hotkey-events.lua:8>
8657.040 Error ServerMultiplayerManager.cpp:92: MultiplayerManager failed: "The mod LTN - Logistic Train Network (1.18.3) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event LogisticTrainNetwork::ltn-toggle-dispatcher (ID 245)
The mod Blueprint Signals (continued) (0.4.2) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event BlueprintSignals_continued::on_runtime_mod_setting_changed (ID 61)
BlueprintSignals_continued/control.lua:103: bad argument Haxtorio#3 of 3 to '__index' (string expected, got nil)
stack traceback:
[C]: in function '__index'
BlueprintSignals_continued/control.lua:103: in function <BlueprintSignals_continued/control.lua:102>
stack traceback:
[C]: in function '__newindex'
LogisticTrainNetwork/script/hotkey-events.lua:13: in function <LogisticTrainNetwork/script/hotkey-events.lua:8>"

BlueprintSignals/control.lua

Lines 100 to 105 in 4e946d7

 add_event_handler( 
         defines.events.on_runtime_mod_setting_changed, 
         function(event) 
             GUI.setup(game.players[event.player_index]) 
         end 
 ) 

on_runtime_mod_setting_changed.player_index can be nil
https://lua-api.factorio.com/latest/events.html#on_runtime_mod_setting_changed

This function should probably be something like this, assuming it will still resolve the crash scenario that caused you to add it in the first place. I did not explore that.

add_event_handler(
        defines.events.on_runtime_mod_setting_changed,
        function(event)
            if not event.player_index then
                return
            end

            GUI.setup(game.players[event.player_index])
        end
)
9 months ago

Thanks for the detailed report and the provided fix. I've uploaded a new version (0.4.3).

New response