Fix issue with the region subscription system not updating on view distance changes and other semi related changes
See merge request veloren/veloren!3557
* Properly set view_distance field in Client when sending it to the
server in request_character/request_spectator.
* Removed invalid check I had included in Client::set_view_distance
* ViewDistances::clamp now clamps min to 1 for both types of view distance.
entities are synced from and displayed in.
NOTE: Syncing entities work at the granularity regions which are
multi-chunk squares but the display of entities in voxygen is limited in
a circle with the radiues of the supplied distance.
Additional details and changes:
* Added `ViewDistances` struct in `common` that contains separate
terrain and entity view distances (the entity view distance will be
clamped by the terrain view distance in uses of this).
* View distance requests from the client to the server now use this
type.
* When requesting the character or spectate state the client now passes
its desired view distances. This is exposed as a new parameter on
`Client::request_character`/`Client::request_spectate`. And the client
no longer needs to send a view distance request after entering these
states. This also allows us to avoid needing to initialize `Presence`
with a default view distance value on the server.
* Removed `DerefFlaggedStorage` from `Presence` and `RegionSubscription` since the
change tracking isn't used for these components.
* Add sliders in voxygen graphics and network tabs for this new setting.
Show the clamped value as well as the selected value next to the
slider.
* Rename existing "Entities View Distance" slider (which AFAIK controls
the distance at which different LOD levels apply to figures) to
"Entities Detail Distance" so we can use the former name for this new
slider.
* When client gets its view distance set by the server it stores that as
the max view distance allowed by the server.
* This is used to avoid skip sending requests if `set_view_distance` is
called with larger values.
* This is then also displayed in the UI via greying out the slider when
it goes past the limit and drawing another slide at the limit.
* The server clamping the client's view distance no longer leads to
edits in voxygen's view distance settings (the view distance setting
is instead preserved).
distance changes (until the player crossed a chunk boundary and
triggered the normal update).
This introduces a `ViewDistance` struct that provides an abstraction
around limiting the rate the view distance can be cycled up and down.
This helps avoid unnecessary sending, deleting, and then resending of
synced things like entities (the client will still delete its terrain
locally and re-request it though).
The second part of this fix is storing the last view distance in the
`RegionSubscription` struct and then updating region subscriptions if
this doesn't match the current view distance in the `Presence`
component.
Trade canceling related tweaks, make kill_npcs not leave clutter (and actually remove entities in the first place), and misc tweaks
See merge request veloren/veloren!3555