Some fixes to the handling of in-space bodies in flight-ui#4794
Merged
sturnclaw merged 3 commits intopioneerspacesim:masterfrom Mar 4, 2020
Merged
Some fixes to the handling of in-space bodies in flight-ui#4794sturnclaw merged 3 commits intopioneerspacesim:masterfrom
sturnclaw merged 3 commits intopioneerspacesim:masterfrom
Conversation
- Make a more important body the cluster's new main body already when building up the clusters: This prevents changing the main body later when sorting the cluster's bodies by importance. Since the main body's coordinates are used when forming and displaying clusters, a late change of the main body may lead to clusters which are closer together than the cluster size. - Use circular cluster areas: That way, the clusters don't change with the viewing angle of the player.
- Don't clear the setspeed target when in setspeed mode and a different nav target is selected. - Change or clear the setspeed target in setspeed mode when ctrl-selecting a new nav target or ctrl-deselecting the old setspeed target, respectively. - When not in setspeed mode, implicitly clear the setspeed target on any target change.
d0ab038 to
3fbce03
Compare
Contributor
Author
|
Rebased to resolve merge conflicts due to advanced master branch |
sturnclaw
approved these changes
Mar 4, 2020
Member
sturnclaw
left a comment
There was a problem hiding this comment.
Also looks good, sorry for the delay in getting to this!
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
I noticed a few issues that remained after #4764:
In certain (rare) situations it is possible that two clusters of bodies are displayed very close to one another, closer than the cluster size. The problem is not the algorithm which groups the bodies into clusters, but the fact that after creating the clusters, when the bodies of each cluster are sorted according to their importance, the most important body becomes the new main body. That is, the clusters remain unchanged, but the main body which is used to put the body icon on screen might not be the centre of the cluster anymore.
As an example, in the following savefile Ceres and Jupiter are very close together on screen and cause the described problem: debug_grouped.gz
The fix I implemented is to make sure that already when grouping the bodies into clusters a new body immediately becomes the new main body if it is more important than the old one.
The old cluster area was rectangular. This makes the clusters depend on the viewing angle: If you roll your ship around a cluster, so that a body's relative position to a cluster changes e.g. from left of the centre to upper-left of the centre, the body may be absorbed into the cluster and then pop out again once it is directly above the centre.
I found this behaviour odd, and so I changed the cluster area to a circle.
When using setspeed mode with a setspeed target different than the frame of reference (i.e. ctrl-selecting that target), the setspeed target is reset to the frame of reference once you select any other target. This is rather unpleasent when you want to use setspeed to accelerate towards some planet, and then want to set a different nav target - temporarily only - to check e.g. your relative speed against it.
I implemented the following new behaviour:
Don't clear the setspeed target when in setspeed mode and a
different nav target is selected.
Change or clear the setspeed target in setspeed mode when
ctrl-selecting a new nav target or ctrl-deselecting the old
setspeed target, respectively.
When not in setspeed mode, implicitly clear the setspeed target on
any target change.
The last one is to keep you from surprises in case you forget that some setspeed target was ctrl-selected and you are now on some different body and turn on setspeed mode to hover, e.g. Since you probably selected some other target in the meantime, the old setspeed target was implicitly cleared and setspeed is thus again relative to body over which you want to hover.
The last commit is not really related to in-space bodies but only a small lua code clean-up suggested in Make continue button load _quicksave if autosave not active #4758 (comment)