[15.34] get_trains() doesn't return wagon-only trains

This subforum contains all the issues which we already resolved.
Post Reply
quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

[15.34] get_trains() doesn't return wagon-only trains

Post by quyxkh »

This causes inconsistencies in mod state when a map is reloaded or a mod is added to a map, and having to postprocess the results of find_entities_filtered seems crude and redundant and error-prone, since discovering all the variants isn't at all trivial.

To see it,

Code: Select all

/c script.on_event(defines.events.on_train_created, function(e) game.print(e.train.id) end)
place a lone cargo wagon, then run

Code: Select all

/c for _,f in pairs(game.forces) do for _,t in pairs(f.get_trains()) do game.print(t.id) end end
and the train that was just created won't be listed in the get_trains() output. This also happens for all the other ways I've tried that create locomotive-less trains.

Place a locomotive, repeat the dump, remove the locomotive, repeat the dump, mouseover the lone wagon and for a good time call /c game.player.selected.train.speed=4

The train's still there, and you can see it still affects the signalling system, but being sure you've found all no-locomotive trains is, so far as I can tell, not cheap.

(edit: or of course just add the get_trains dump to the on_train_created function . . . )

Rseding91
Factorio Staff
Factorio Staff
Posts: 13209
Joined: Wed Jun 11, 2014 5:23 am
Contact:

Re: [15.34] get_trains() doesn't return wagon-only trains

Post by Rseding91 »

Thanks for the report. It's now fixed for 0.16.
If you want to get ahold of me I'm almost always on Discord.

quyxkh
Smart Inserter
Smart Inserter
Posts: 1028
Joined: Sun May 08, 2016 9:01 am
Contact:

Re: [15.34] get_trains() doesn't return wagon-only trains

Post by quyxkh »

I had a humorous expression of amazement and gratitude at the consistent responsiveness here, but I think I'll just go with "thanks for being so consistently responsive over such a long stretch."

Post Reply

Return to “Resolved Problems and Bugs”