allow rotating carriages while connected

Place to ask discuss and request the modding support of Factorio. Don't request mods here.
Post Reply
User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

allow rotating carriages while connected

Post 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.

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

Re: allow rotating carriages while connected

Post 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.

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

Re: allow rotating carriages while connected

Post 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.
If you want to get ahold of me I'm almost always on Discord.

User avatar
Godmave
Long Handed Inserter
Long Handed Inserter
Posts: 89
Joined: Tue Nov 15, 2016 3:52 pm
Contact:

Re: allow rotating carriages while connected

Post 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.

betrok
Fast Inserter
Fast Inserter
Posts: 101
Joined: Wed Feb 28, 2018 12:08 pm
Contact:

Re: allow rotating carriages while connected

Post 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.

User avatar
Optera
Smart Inserter
Smart Inserter
Posts: 2915
Joined: Sat Jun 11, 2016 6:41 am
Contact:

Re: allow rotating carriages while connected

Post 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.

Post Reply

Return to “Modding interface requests”