Several mistakes were made past where the stream was expected to raise
the EOF flag when reaching the end of stream. That is incorrect. The
flag is only raised if the current read operation fails.
This commit unifies all istream compatibility code to use 'canRead'
for reliable EOF detection. An exception is now thrown when a
value cannot be read completely (e.g. missing bytes).
Version comments are added for easier backtracing.
1) Add `node` and `node_pos` field for the `drown` field (analog to `node_damage` type)
2) Add `custom_type` field to allow a standardized way to report more details of the HP change
3) Make `builtin` report a `custom_type` for the HP changes caused by the `/kill` command and `core.do_item_eat`
4) Move the documentation of `PlayerHPChangeReason` to its own section
5) Fill in missing information of said documentation
The previous code immediately dropped identity overrides, even if there still was an interpolation to be done.
Also a little bit of cleanup, and setting an appropriate identity default for the scale property when interpolating.
For modders: As a workaround, you can add a tiny offset so that overrides aren't identity overrides.
Leaving players will have PEER_ID_INVALID for database saving purposes.
This patch clarifies that, and properly protects the batch send function.
Bug introduced by 5f5ea132.
The server already includes such check. There must be a desync issue that causes
an ID mismatch, resulting in client crashes. Any such crash must be prevented.
Previously, ServerEnv created a player instance before they're fully initialized.
This commit moves all initialization steps and callbacks into TOSERVER_CLIENT_READY
^ which includes StageTwoClientInit for player loading or creation
* Network: offload often changed constants to source file
This prevents unnecessary recompiling when using incremental builds.
There is also no need to have separate max proto version variables;
as they're subject to the handshake between client and server. The
code is also expected to support the same version (or higher).
Co-authored-by: sfan5 <sfan5@live.de>