X Tutup
Skip to content

Some fixes to the handling of in-space bodies in flight-ui#4794

Merged
sturnclaw merged 3 commits intopioneerspacesim:masterfrom
cwyss:inspace-bodies
Mar 4, 2020
Merged

Some fixes to the handling of in-space bodies in flight-ui#4794
sturnclaw merged 3 commits intopioneerspacesim:masterfrom
cwyss:inspace-bodies

Conversation

@cwyss
Copy link
Contributor

@cwyss cwyss commented Feb 15, 2020

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)

@sturnclaw sturnclaw self-requested a review February 16, 2020 18:00
- 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.
@cwyss
Copy link
Contributor Author

cwyss commented Feb 23, 2020

Rebased to resolve merge conflicts due to advanced master branch

Copy link
Member

@sturnclaw sturnclaw left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also looks good, sorry for the delay in getting to this!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants

X Tutup