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.
rationale:
* it's just boilerplate, as these just fill out the structs. can also be done at call site
* they are usually only called at one place
* it would lead to many includes (or at least forward defs) in sscsm_controller.h and
sscsm_environment.h
20 us was the value, firefox used as first response to the spectre attacks.
now it's 100 us or 5 us, depending on whether it's "cross-origin isolated".
we only have one origin, so choosing 20 us is probably fine, I guess
see also:
https://www.mozilla.org/en-US/security/advisories/mfsa2018-01/https://developer.mozilla.org/en-US/docs/Web/API/Performance/now#security_requirements
other clocks:
* os.time() and os.date() only have seconds precision, AFAIK.
* dtime is only given once per step, so it's not useful
* there might be other ways to build clocks (if we get async envs for sscsm,
with a busy loop, for example)
tostring({}) and string.format("%s", {}) give you pointers.
(see lj_strfmt_obj)
this is not very critical, but attacks could be made harder if we change this.
the effort of overwriting is not worth it I think right now
Reduces memory usage on the server, especially with many user and/or large viewing distances.
Currently disabled on the client due to known data races on a block's data.
Large structures which are generated in on_generated callbacks
independently by Lua cannot influence decoration placement. This
change enables such a callback to assume responsibility for generating
decorations itself, presumably after structures are placed, by
disabling decorations in mg_flags and executing
core.generate_decorations.
---------
Co-authored-by: Po Lu <luangruo@yahoo.com>
These changes were initially made to improve performance. However,
on modern hardware, these changes turned out to make no difference.
This commit unifies the calculations in 'draw' and 'getDimension' and
adds comments to make it more understandable.
A few functions tried to dereference a ServerEnvironment nullptr by
calling 'getEnv()'. This change makes use of a macro where possible.
This also cleans up incorrect macro uses, with no functional difference.