I hope I have fixed the "Let's rotate once more, even if we're already in the dock" bug, but that isn't a bug I can reproduce "on demand", so instead of forwarding the fix to phkb I
uploaded a beta OXZ file for those adventurous and willing to help me test it. Debug is on, so there will be a lot of trace messages in Latest.log, specially if you dock at slow speed (more time docking, more frame callback calls, more messages...)
Beware you might crash while docking and lose everything you accomplished in that game session!
That said, I tested it on several kinds of dockables, docking at slow speed (120), medium speed (250), high speed (500) and break-neck speed (1100 with Q-Charger) from a 90 degrees to the docking lane starting point, and a 90 degrees rotation mis-alignment for non-rotating dockables whithout a crash. I was able to dock with injectors all the way if I started with a low angle to the docking lane (<45 degrees).
I changed some things besides fixing that bug, dealing with several edge cases:
- the code to discover the docking bay orientation and get the orientation of its wide dimension was for particular cases of docking bays aligned with the station model axes, i.e., if rotated, rotated 90 degrees; I generalized it to any rotation (arbitrarily rotated docking bays are not tested - I don't know of any - but the 90 degrees rotated were tested)
- the code took for granted the docking bays were facing forward (same heading as the station) and used the station heading, I changed it to use the docking bay final heading, so it should work with the docking bay facing any direction (but for rotating dockables the rotation axis must go through the docking centre, so we are talking about aft-facing docking bays - again untested because I don't know of any);
- the code rotated the ship without caring about the ship's maxRoll, so you could dock at a really fast-rotating station with a very roll-limited ship; I limited the amount of rotation when matching the station rotation to the ship's maxRoll - if you have a ship that can't match station rotation, you will have to engage ILS, stop just before entering the dock (that is, speed=0 but ILS still engaged), wait for the dock to align with your ship (it will, but might take some time), then jump forward at top speed - as ILS does for NPCs).
If anybody have any trouble, send me the logs, if nobody reports problems I will forward the fix to phkb in two or three weeks.