OpenBVE icon indicating copy to clipboard operation
OpenBVE copied to clipboard

New: Allow coupling

Open leezer3 opened this issue 1 year ago • 0 comments

This PR allows us to couple to loose cars that we've previously dropped.

Currently, driving into a train with both at less than the critical collision speed (this is a fixed 8km/h value) will couple us.

Heavy WIP, but now appears to be working correctly.

TODO:

  • Trains need a way of distinguishing what they are. TFOs have this already by virtue of being a different type, but it's not quite right.
  • Need to implement a 'do you wish to couple' yes / no dialog.
  • It would be useful to allow us to place loose cars independantly on the route (sidings etc) so we could pick them up - Cars from the train.xml format would seem to fit this bill, as they should contain most if not all of the properties required. Would also require a new routefile command (Single XML, containing all loose cars??) Possibly for a later PR.

Glitches:

  • ~~Beacon reciever will likely be broken.~~
  • ~~Seem to need to switch back to exterior view again to get our coupled car to show.~~
  • ~~It's possible to couple with a preceeding train stopped at a station. This shouldn't happen.~~
  • ~~We should remove a disposed train from the list. Otherwise coupling / decoupling repeatedly causes the train list to grow exponentionally. Check if we rely on the length of this elsewhere???~~ Improved the logic, but this needs more testing.

leezer3 avatar Apr 11 '24 19:04 leezer3