Page 1 of 1
allow rotating carriages while connected
Posted: Sun Jun 24, 2018 4:08 pm
by Optera
What:
Extend entity.rotate() for carriages to rotate the carriage and swap the connection points without disconnecting it from a train.
Why:
Currently to rotate a locomotive you have to disconnect, rotate and reconnect and prey it's not in some weird position or right next to another train so it connects properly.
Code: Select all
loco.disconnect_rolling_stock(defines.rail_direction.back)
loco.disconnect_rolling_stock(defines.rail_direction.front)
loco.rotate()
loco.connect_rolling_stock(defines.rail_direction.back)
loco.connect_rolling_stock(defines.rail_direction.front)
Doing all rotation in one command could also add the benefit of retaining train.id.
Re: allow rotating carriages while connected
Posted: Sun Jun 24, 2018 10:55 pm
by eradicator
Slight (?) addition: Add LuaTrain.rotate() to rotate the whole train in place like in Open Transport Tycoon Deluxe or any other train-simulator, where trains in Terminus stations can rotate in place when leaving.
Re: allow rotating carriages while connected
Posted: Mon Jun 25, 2018 12:04 am
by Rseding91
I would attempt to add support for one or both of those but I have no idea how to rotate a rolling stock while it's connected to other rolling stocks. The internal train logic is still one of the things that alludes me.
Re: allow rotating carriages while connected
Posted: Mon Jun 25, 2018 7:37 am
by Godmave
Brute force for the luaTrain.rotate() would be serialization and deserialization in the opposite direction, but (since you can on the c++ side) keep the trainId.
Same should work for the lone carriage/loco.
Re: allow rotating carriages while connected
Posted: Mon Jun 25, 2018 10:22 am
by betrok
In general, the ability to rebuild a train without changing its id will be extrimly useful.
Even better if it will be possible to save train, modify it and place it somewhere later with same id as before.
Re: allow rotating carriages while connected
Posted: Sun Feb 10, 2019 7:54 am
by Optera
Are there plans on making rotating carriages without decoupling a feature for 0.17?
All it'd take is flip front and back connection and spin the carriage 180° without changing the train.id.