Skip to content

Incorrect calculation of train slots available with mixed item types + double-headed trains #315

@amckinley

Description

@amckinley

Error message or bug description
While trying to use LTN with mixed-item shipments, I'm pretty sure I found a bug where LTN is incorrectly calculating a train's total stack size. I have a <CCL> train that was dispatched to pickup this load:

Screenshot from LTN Manager interface:
unnamed

Screenshot of signals coming from the LTN station's constant combinator output:
unnamed (1)

This load requires the following assignment of stacks:

  • Artillery Shells: 65 (stack size 1)
  • Uranium Ammo: 5 (stack size 200)
  • Repairs Packs: 4 (stack size 100)
  • Lbots: 2 (stack size 50)
  • Cbots: 2 (stack size 50)
  • Pipes: 2 (stack size 100)
  • Filtered inserters: 1 (stack size 50)
  • Stack inserters: 1 (stack size 50)
  • Flame turrets: 1 (stack size 50)

This is 83 stacks, which does not fit in the 2 wagons available on the train (80 stacks). It would "fit", however, if LTN was counting the final locomotive as having a 3-stack cargo, even though it's actually just the inventory.

I tried to trace through the code to see if I could find something suspicious, and I got as far as here. I wonder if some recent Factorio update started putting the non-head locomotives in the cargo_wagons variable?

I'm playing SE so my save file is like 400MB, but I'm happy to find a place to upload it if that would help.

To Reproduce
Request a complicated mixed wagon and have it filled by a train with locomotives at both ends.

LTN version
1.18.1

Log file

factorio-current.log

Metadata

Metadata

Assignees

Labels

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions