Train IDs

Don't know how to use a machine? Looking for efficient setups? Stuck in a mission?
Post Reply
User avatar
husnikadam
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon May 21, 2018 1:56 pm
Contact:

Train IDs

Post by husnikadam »

Hi,
I couldn't find an answer (neither in wiki nor forum) for a question - what is train IDs range? How is the ID set? Can somehow happen that two trains get the same id? (f.e. through number overflow or too many trains). These info would be useful for my circuit network. Thank you.

User avatar
disentius
Filter Inserter
Filter Inserter
Posts: 694
Joined: Fri May 12, 2017 3:17 pm
Contact:

Re: Train IDs

Post by disentius »

- train ID is unique
- gets set when train is created, reset when you change the train composition (adding/removing wagons or locomotives)
- Range: could not find any info on that, probably standard factorio integer range (2^31)

User avatar
husnikadam
Long Handed Inserter
Long Handed Inserter
Posts: 73
Joined: Mon May 21, 2018 1:56 pm
Contact:

Re: Train IDs

Post by husnikadam »

So IDs start at (zero/one)? and then every train update uses a next unused ID, right? Thanks

User avatar
eradicator
Smart Inserter
Smart Inserter
Posts: 5206
Joined: Tue Jul 12, 2016 9:03 am
Contact:

Re: Train IDs

Post by eradicator »

husnikadam wrote:
Sat Dec 21, 2019 10:56 pm
So IDs start at (zero/one)? and then every train update uses a next unused ID, right? Thanks
It probably uses last_assigned_id+1, regardless of if there are currently unused ids before that. I.e. every ID should be unique for the duration of the whole game even if you destroy lots of trains.

See also viewtopic.php?p=360137#p360137
Author of: Belt Planner, Hand Crank Generator, Screenshot Maker, /sudo and more.
Mod support languages: 日本語, Deutsch, English
My code in the post above is dedicated to the public domain under CC0.

Post Reply

Return to “Gameplay Help”