Train Scaling


Automate the construction and deconstruction of your trains! Configure a train currently scheduled for a station as a template for the station - the mod's special train construction station will automatically build (or destroy) copies of the template train on demand, or in response to circuit conditions.

Content
3 years ago
0.16 - 1.1
5.91K
Trains

b Crashes upon building train

4 years ago

Just tried adding Train Scaling to our server, something appears to be causing a crash.

After the builder train gets placed, it moves forward to place the next entity and crashes just before placing. It crashed once, mentioning Nixie Tubes so I removed it to check but it crashed mentioning others too. It appears to be calling script_raised_built before the entity gets built or is passing a nil value for some reason. The nil value is causing other mods, who aren't doing a nil check to freak out.

factorio_1  | 2020-03-24T18:50:13.620213534Z  420.799 Error MainLoop.cpp:1202: Exception at tick 7408910: The mod Train Scaling (0.18.0) caused a non-recoverable error.
factorio_1  | 2020-03-24T18:50:13.620269681Z Please report this error to the mod author.
factorio_1  | 2020-03-24T18:50:13.620288730Z
factorio_1  | 2020-03-24T18:50:13.620301506Z Error while running event train-scaling::on_nth_tick(5)
factorio_1  | 2020-03-24T18:50:13.620322724Z The mod Pipelayer (0.4.1) caused a non-recoverable error.
factorio_1  | 2020-03-24T18:50:13.620334377Z Please report this error to the mod author.
factorio_1  | 2020-03-24T18:50:13.620345755Z
factorio_1  | 2020-03-24T18:50:13.620356207Z Error while running event pipelayer::script_raised_built (ID 77)
factorio_1  | 2020-03-24T18:50:13.620367628Z __pipelayer__/lualib/BaseEditor/BaseEditor.lua:1153: attempt to index local 'entity' (a nil value)
factorio_1  | 2020-03-24T18:50:13.620379212Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620390824Z    __pipelayer__/lualib/BaseEditor/BaseEditor.lua:1153: in function 'on_script_raised_built'
factorio_1  | 2020-03-24T18:50:13.620402779Z    __pipelayer__/Editor.lua:660: in function 'on_script_raised_built'
factorio_1  | 2020-03-24T18:50:13.620415030Z    __pipelayer__/control.lua:51: in function <__pipelayer__/control.lua:51>
factorio_1  | 2020-03-24T18:50:13.620427569Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620438787Z    __train-scaling__/control.lua:996: in function <__train-scaling__/control.lua:779>
factorio_1  | 2020-03-24T18:50:13.620451623Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620461853Z    [C]: in function 'raise_event'
factorio_1  | 2020-03-24T18:50:13.620472192Z    __train-scaling__/control.lua:996: in function <__train-scaling__/control.lua:779>
factorio_1  | 2020-03-24T18:50:13.620484828Z  420.799 Error ServerMultiplayerManager.cpp:92: MultiplayerManager failed: "The mod Train Scaling (0.18.0) caused a non-recoverable error.
factorio_1  | 2020-03-24T18:50:13.620496761Z Please report this error to the mod author.
factorio_1  | 2020-03-24T18:50:13.620507529Z
factorio_1  | 2020-03-24T18:50:13.620518061Z Error while running event train-scaling::on_nth_tick(5)
factorio_1  | 2020-03-24T18:50:13.620529694Z The mod Pipelayer (0.4.1) caused a non-recoverable error.
factorio_1  | 2020-03-24T18:50:13.620541111Z Please report this error to the mod author.
factorio_1  | 2020-03-24T18:50:13.620552345Z
factorio_1  | 2020-03-24T18:50:13.620563467Z Error while running event pipelayer::script_raised_built (ID 77)
factorio_1  | 2020-03-24T18:50:13.620591040Z __pipelayer__/lualib/BaseEditor/BaseEditor.lua:1153: attempt to index local 'entity' (a nil value)
factorio_1  | 2020-03-24T18:50:13.620604841Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620615290Z    __pipelayer__/lualib/BaseEditor/BaseEditor.lua:1153: in function 'on_script_raised_built'
factorio_1  | 2020-03-24T18:50:13.620625905Z    __pipelayer__/Editor.lua:660: in function 'on_script_raised_built'
factorio_1  | 2020-03-24T18:50:13.620636446Z    __pipelayer__/control.lua:51: in function <__pipelayer__/control.lua:51>
factorio_1  | 2020-03-24T18:50:13.620647735Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620657680Z    __train-scaling__/control.lua:996: in function <__train-scaling__/control.lua:779>
factorio_1  | 2020-03-24T18:50:13.620668387Z stack traceback:
factorio_1  | 2020-03-24T18:50:13.620679068Z    [C]: in function 'raise_event'
factorio_1  | 2020-03-24T18:50:13.620689227Z    __train-scaling__/control.lua:996: in function <__train-scaling__/control.lua:779>"
4 years ago

After some research, I found that when the carriage is built, there is a typo in the event call.

Currently line 996 in control.lua has this:
script.raise_event(defines.events.script_raised_built, {created_entity = wagon})
when it should be passed as:
script.raise_event(defines.events.script_raised_built, {entity = wagon})

4 years ago

Thanks for finding that, updated to fix!

New response