Connect/Disconnect Train
Posted: Wed Dec 16, 2015 4:28 pm
Please add an API to connect and disconnect train carriages.
I wanted to add this feature to a mod, but gave up when I realized this is the algorithm I would need to use.
I wanted to add this feature to a mod, but gave up when I realized this is the algorithm I would need to use.
Code: Select all
function split_train_in_half()
Copy all properties of carriage n/2+1
Delete carriage n/2+1
Teleport the surviving carriages in the second train to an empty area of the map
Recreate carriage n/2+1
Paste all properties of carriage n/2+1
Teleport the second train back to its original position
end