LTN - Logistic Train Network

by Optera

Adds logistic-train-stops acting as anchor points for building a fully automated, train logistic network. It can handle all possible train configuration. Just send all trains to depots and LTN will pick the best suitable train for a job. LTN cuts the amount of rolling stock required to run a megabase down to 30% or less. With cargo ships installed also adds a logistic port for ships.

Content
11 days ago
0.14 - 2.0
257K
Trains Circuit network

g Error

a month ago

I was playing with this mod and got the following error. I was working around with fluid requests and got the same crash twice. Can someone help find out what caused this and get this fixed? If this isn't the right place to report this, LMK as I haven't used the mod portal before. Any help is appreciated!

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:588: attempt to index field '?' (a nil value)
stack traceback:
LogisticTrainNetwork/script/dispatcher.lua:588: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:141: in function <LogisticTrainNetwork/script/dispatcher.lua:22>

a month ago

I'm also working with fluid requests and getting a similar error:

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:706: attempt to index field '?' (a nil value)
stack traceback:
LogisticTrainNetwork/script/dispatcher.lua:706: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:139: in function <LogisticTrainNetwork/script/dispatcher.lua:23>

a month ago
(updated a month ago)

I'm getting the same error as CoralDeep.
Im trying to find out rn what excatly I did to trigger this error.

a month ago

Getting the exact same thing. I wonder if it is related to timeouts? I had a few trains in a deadlock, and it fixed for a while after I solved it. Now it crashed after requesting to one of my dual fluids stations.

Error is as following:

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:706: attempt to index field '?' (a nil value)
stack traceback:
LogisticTrainNetwork/script/dispatcher.lua:706: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:139: in function <LogisticTrainNetwork/script/dispatcher.lua:23>

a month ago

I'm also getting this error, but cannot pinpoint the exact cause. Any help would be appreciated.

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:706: attempt to index field '?' (a nil value)
stack traceback:
LogisticTrainNetwork/script/dispatcher.lua:706: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:139: in function <LogisticTrainNetwork/script/dispatcher.lua:23>

a month ago

Looking into this. Bug reports have a much better chance to be picked up quickly if filed on github. :-)

a month ago

I'm also getting this error, but cannot pinpoint the exact cause. Any help would be appreciated.

Do you run mixed trains (fluid wagons and cargo wagons) by any chance?

a month ago

So, looking through the errors and the logic, this narrows down to two possibilities:

  • some really weird items that do not have prototypes (unlikely)
  • some non-item/non-fluid signals that are present and interpreted as items

I pushed 2.1.1 which hardens the signal handling (basically ignore anything that is not either a virtual signal that controls LTN, an item or a fluid signal). This should make the second option go away.

If you still encounter problems with the 2.1.1 release, to be able to figure out the problem, I need

  • the stack trace
  • a game save (that is ideal but I understand if you don't have one). Send as a PM or a file share through the forum messaging.
  • what you were trying to ship
  • a list of mods that you have loaded in the game. Especially unusual mods or mods that change items and/or fluids around.
a month ago

Мод LTN - Logistic Train Network (2.1.1) вызвал неустранимую ошибку.
Пожалуйста, сообщите об этой ошибке автору мода.

Error while running event LogisticTrainNetwork::on_configuration_changed
LogisticTrainNetwork/script/tools.lua:182: Arguments count error for 'get_inventory_size': Expected 1 argument but 2 were given
stack traceback:
[C]: in function 'get_inventory_size'
LogisticTrainNetwork/script/tools.lua:182: in function 'cap_function'
LogisticTrainNetwork/script/tools.lua:171: in function <LogisticTrainNetwork/script/tools.lua:167>
(...tail calls...)
LogisticTrainNetwork/script/tools.lua:204: in function 'getTrainCapacity'
LogisticTrainNetwork/script/train-events.lua:111: in function 'TrainArrives'
LogisticTrainNetwork/script/init.lua:254: in function 'updateAllTrains'
LogisticTrainNetwork/script/init.lua:347: in function <LogisticTrainNetwork/script/init.lua:323>

a month ago

thanks. Will take a look.

a month ago

Are you running a version older than 2.0.18 by any chance? If yes, you need to upgrade to at least 2.0.18.

Мод LTN - Logistic Train Network (2.1.1) вызвал неустранимую ошибку.
Пожалуйста, сообщите об этой ошибке автору мода.

Error while running event LogisticTrainNetwork::on_configuration_changed
LogisticTrainNetwork/script/tools.lua:182: Arguments count error for 'get_inventory_size': Expected 1 argument but 2 were given
stack traceback:
[C]: in function 'get_inventory_size'
LogisticTrainNetwork/script/tools.lua:182: in function 'cap_function'
LogisticTrainNetwork/script/tools.lua:171: in function <LogisticTrainNetwork/script/tools.lua:167>
(...tail calls...)
LogisticTrainNetwork/script/tools.lua:204: in function 'getTrainCapacity'
LogisticTrainNetwork/script/train-events.lua:111: in function 'TrainArrives'
LogisticTrainNetwork/script/init.lua:254: in function 'updateAllTrains'
LogisticTrainNetwork/script/init.lua:347: in function <LogisticTrainNetwork/script/init.lua:323>

a month ago

I'm also getting this error, but cannot pinpoint the exact cause. Any help would be appreciated.

Do you run mixed trains (fluid wagons and cargo wagons) by any chance?

No, trains are strictly one or the other, but i use train stations that do both.
After latest update of LTN the error changed to the following:

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:709: item prototype undefined!
stack traceback:
[C]: in function 'assert'
LogisticTrainNetwork/script/dispatcher.lua:709: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:139: in function <LogisticTrainNetwork/script/dispatcher.lua:23>

a month ago

Thank you for the followup! I am pretty sure that LTN tries to create a mixed delivery and pulls in a non-item (a fluid probably) and that triggers the assertion.

I pushed a 2.1.2 version with a small change that enforces that only items will be considered for merging. This should make that problem go away.

a month ago

I crashed tooi right after the latest update. Same error message on the dispatcher.

a month ago

Thank you for the followup! I am pretty sure that LTN tries to create a mixed delivery and pulls in a non-item (a fluid probably) and that triggers the assertion.

I pushed a 2.1.2 version with a small change that enforces that only items will be considered for merging. This should make that problem go away.

With the new version the error is now

Error while running event LogisticTrainNetwork::on_nth_tick(2)
LogisticTrainNetwork/script/dispatcher.lua:780: assertion failed!
stack traceback:
[C]: in function 'assert'
LogisticTrainNetwork/script/dispatcher.lua:780: in function 'ProcessRequest'
LogisticTrainNetwork/script/dispatcher.lua:139: in function <LogisticTrainNetwork/script/dispatcher.lua:23>

a month ago

it was a typo that is fixed in 2.2.0.

a month ago

The issue seems to be fixed for me with 2.2.1
Thank you very much :)

New response