Connect/Disconnect Train

User avatar
DaveMcW
Smart Inserter
Smart Inserter
Posts: 3749
Joined: Tue May 13, 2014 11:06 am
Contact:

Connect/Disconnect Train

Post by DaveMcW »

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.

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

Return to “Implemented mod requests”