Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Open
amckinley opened this issue Feb 11, 2023 · 2 comments
Assignees
Labels

Comments

@amckinley
Copy link

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

@0ptera
Copy link
Owner

0ptera commented Feb 11, 2023

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 highly doubt Wube made changes like that without mentioning it in their changelogs.
However some mods create locomotives with integrated cargo wagons.

I don't have time to download a heavily modded 400MB save and filter out all mod interactions.
To start analyzing I need the following:

  1. factorio-current.log with LTN's debug log enabled.
    The logfile must be complete and have the logging option enabled for a few seconds before the delivery was created and include everything until the train arrives at the provider.
  2. Names of stops between which the delivery was created

Even better would be if you can reproduce the error on a newly created map with only LTN running.

@amckinley
Copy link
Author

Thanks for the quick response! I'll start working on a more compact repro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants