Page 1 of 1

Train ID should not change

Posted: Wed Nov 28, 2018 10:17 pm
by Skeletpiece
As title says, train id (More specific, Locomotive ID) should not change.

The main reason is with circuit networks setup stop working using T as signal (From train)

It changes sequentially if you add/remove a wagon (not locomotive). Locomotive ID should remain the same

Re: Train ID should not change

Posted: Thu Nov 29, 2018 1:04 am
by Tekky
I think the best solution to this problem would be that every locomotives acts as a constant combinator, which effectively allows the player to set the train/locomotive ID himself.

This has been suggested in the following threads:
viewtopic.php?f=6&t=46969 Constant Combinator for Locomotive
viewtopic.php?f=6&t=56302 Train ID as Constant Combinator

Re: Train ID should not change

Posted: Thu Nov 29, 2018 3:24 pm
by ggrnd0
Tekky wrote:
Thu Nov 29, 2018 1:04 am
I think the best solution to this problem would be that every locomotives acts as a constant combinator, which effectively allows the player to set the train/locomotive ID himself.
+1

Re: Train ID should not change

Posted: Thu Nov 29, 2018 5:59 pm
by Optera
On one hand it would make tracking trains through train id a lot simpler as we no longer have to listen to on_train_changed to update all id references.

On the other hand though it's not so easy to come up with a usable way of having static id's that are unique to one train.
I can think of two ways to make train id unique.
  1. find the main locomotive and use its unique entity.unit_number to identify a train.
    That's what I used in LTN before train.id existed.
  2. Concat entity.unit_number of all carriages into one massive string.
    Sending that into circuit network would very likely be unreadable for players.

Re: Train ID should not change

Posted: Thu Nov 29, 2018 6:12 pm
by Tekky
I'm not sure if I want my Train IDs to be unique. If I want two trains to be treated the same way by the circuit network, it would make more sense to set both trains to the same ID.

Having custom Train IDs would also allow grouping and assigning properties to trains. For example, I could assign all my iron ore trains an ID between 1000 and 1999 and all my copper trains an ID between 2000 and 2999. In other words, the first digit would define the type of train (1 = iron, 2 = copper). Also, I could, for example, assign the length of the train to the second digit. That way, a train with an ID of 2348 would be a copper train with a length of 3. All of this information could easily be extracted by the circuit network simply by reading the ID of the train. The possibilities would be endless.

Re: Train ID should not change

Posted: Fri Nov 30, 2018 9:13 am
by JimBarracus
as a workaround you can use copper wire as an alternative for the train id
why copper wire?
-stack size 200
-usually not transported by train

just put a certain amount in the train to identify it and use circuit condtitions working with the amount of copper wire
advantages
-not fixed train id
-multiple trains can have the same id
-doesnt change when you change the train setup
downside:
-cant be used on fluid trains
-needs one slot
-requires cargo filters and inserters