Automatic Train Builder deprecated


Build Trains Automatically-See Mod Portal for instructions

Content
6 years ago
0.14 - 0.16
22
Trains

b Train Schedule Not Copying

6 years ago

Every so often, when I go to create one of these stations, it doesn't copy the train schedule.

I'm working from a blueprint of a working station, so I know it's wired up correctly, but I've checked it many times as well.

The new train does get created, but its schedule just has "Trains" (for the wired stop, called "n Trains").

The train is at the stop, saving and reloading doesn't work, nor does restarting the game.

6 years ago
(updated 6 years ago)

I did some digging, and it looks like an error with the position offset calculations in get_station_schedule. I'm not sure if this is something which changed in a recent version, as I do recall it being somewhat more reliable in the past, but here's what I found for 0.16.43:

The results seem to depend entirely on the direction. North (0) and east (6) work, but south and west don't. Changing the condition on line 319 to 0 or 4 did not fix the problem.

Anyway, I redid the offsets manually, and the following code works for me.

if (direction < 4) then
x = x - 2
else
x = x + 2
end

if (direction == 2) or (direction == 4) then
y = y - 2
else
y = y + 2
end

It looks like that's good enough to pass in the position to find_entitites_filtered, rather than an area. I mention it because earlier hacking had me using an expanding area and sometimes picking up nearby trains rather than the one at the stop.

6 years ago

Works for me, thank you offtheball!

New response