SSPP Logistics Train Mod

by jagoly

A logistics train mod that aims to be as pleasant to use as possible, even when knee-deep in byproducts. SSPP stands for Source-Sink-Push-Pull.

Content
11 days ago
2.0
584
Logistics Trains

g Crash when copy-pasting blueprints

a month ago
(updated a month ago)

Here's the report:

The mod SSPP Logistics Train Mod (0.3.20) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event SourceSinkPushPull::on_gui_opened (ID 98)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__SourceSinkPushPull
/scripts/lib.lua:603: in function 'get_station_parts'
SourceSinkPushPull/scripts/gui/station.lua:1018: in function 'station_open'
SourceSinkPushPull/scripts/gui.lua:194: in function <SourceSinkPushPull/scripts/gui.lua:188>

What I think caused it was that:

(a) I created a requester station "for use later on";
(b) I came back to it "later on" and pasted a blueprint over the layout that caused two Request I/O modules to be attached to the train stop;
(c) I deleted one of the modules (I'm not sure whether it was the original or the extra one that I had just added);
(d) I clicked on the station to set the class; and
(e) I clicked on the blank "Class" button.

The game crashed, as above.

It may have crashed at step (d), but I think it was (e).

a month ago

Jusr got another crash, so the above actions may not be the true cause:

The mod SSPP Logistics Train Mod (0.3.20) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event SourceSinkPushPull::on_tick (ID 0)
SourceSinkPushPull/scripts/tick.lua:400: attempt to index field '?' (a nil value)
stack traceback:
SourceSinkPushPull/scripts/tick.lua:400: in function 'pop_best_dispatch_hauler_if_any'
SourceSinkPushPull/scripts/tick.lua:771: in function 'tick_dispatch'
SourceSinkPushPull/scripts/tick.lua:867: in function <SourceSinkPushPull/scripts/tick.lua:843>

This one happened when I typed "1" into the throughput text box. I didn't get as far as typing the rest of the number. :)

a month ago
(updated a month ago)

The first and second crashes are different, the second one is most likely the same issue as https://mods.factorio.com/mod/SourceSinkPushPull/discussion/67d535aae9b0f05e9352cf7f, which I have already fixed for the next release but haven't published yet.

As for the first crash, that one definitely still needs fixing. Keeping track of all of the different parts that make up a station without allowing duplicates is rather complicated, I thought I'd finally handled all of the edge cases, but apparently not 😅

EDIT: I'm struggling to reproduce the issue. I'm copying, breaking, clicking, etc in every way I can think of but apparently not in the exact order that you managed to. Are you able to provide a more precise explanation of how you caused the issue? A short screen recording would be ideal if you can make one.

a month ago

I'll see if I can get a repeatable case. Here's another variation. This one happened because I happened to have too many modules attached to the station. I deleted one of them and it failed:

The mod SSPP Logistics Train Mod (0.3.20) caused a non-recoverable error.
Please report this error to the mod author.

Error while running event SourceSinkPushPull::on_pre_player_mined_item (ID 14)
LuaEntity API call when LuaEntity was invalid.
stack traceback:
[C]: in function 'index'
__SourceSinkPushPull
/scripts/main/station.lua:56: in function 'try_create_station'
SourceSinkPushPull/scripts/main/station.lua:301: in function 'comb_broken'
SourceSinkPushPull/scripts/main.lua:51: in function <SourceSinkPushPull/scripts/main.lua:36>

I'm not sure which one I deleted but thought I'd post this before I lose the trace.

Watch this space for a repeatable sequence ... :)

a month ago

And here's another one:

Error while running event SourceSinkPushPull::on_robot_built_entity (ID 17)
SourceSinkPushPull/scripts/main/station.lua:262: bad argument #1 of 2 to 'pairs' (table expected, got nil)
stack traceback:
[C]: in function 'pairs'
SourceSinkPushPull/scripts/main/station.lua:262: in function 'stop_broken'
SourceSinkPushPull/scripts/main/station.lua:160: in function 'stop_built'
SourceSinkPushPull/scripts/main.lua:30: in function <SourceSinkPushPull/scripts/main.lua:10>

This happened while I was moving the character across a blueprint while it was building a couple of stations (adjacent to each other). Unfortunately, it still seems like it's not repeatable. Is there some sort of debug log I can set up to record what is happening and when? It looks like a classic hazard problem that depends on the relative timing of lots of things.

a month ago

Debug logging is currently ad-hoc sadly. I can add some to the relevant code though and give you a custom mod zip if you think that will help.

I am starting to suspect that the issue is specifically with the handling of ghosts though. Ghosts aren't as frequently tested as most of the time when designing stations I'm in the editor. I'll look into that first and if I still can't reproduce the issue I'll do up a version with extra debug logging for you.

a month ago

OK I THINK I FOUND IT

The issue is to do with pasting ghost entities over the top of other ghost entities, then destroying the original ghost entities. At least, this seems to be the cause of the most recent issue you posted, but I suspect the other issues are all related. Now I can finally start working on fixing things anyway.

a month ago
(updated a month ago)

So it's looking like this is actually a bug in the base game https://forums.factorio.com/viewtopic.php?p=666167#p666167

This means it's not something I can fix, at least not without complicated and annoying hacks. Hopefully the issue gets fixed soon, but in the meantime, you can avoid this by just not pasting SSPP ghosts over the top of other SSPP ghosts.

a month ago

Great detective work!

I can easily avoid doing that.

Thank you

a month ago

Fixed in the new version! The base game bug still exists, but I've worked around it for now.

New response