mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Expose client version information in non-debug builds (#15708)
Co-authored-by: SmallJoker <SmallJoker@users.noreply.github.com> Co-authored-by: Lars Mueller <appgurulars@gmx.de> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
parent
e6cf08169e
commit
dd0070a6b8
8 changed files with 95 additions and 24 deletions
|
@ -5578,7 +5578,7 @@ Utilities
|
|||
* It's possible that multiple Luanti instances are running at the same
|
||||
time, which may lead to corruption if you are not careful.
|
||||
* `core.is_singleplayer()`
|
||||
* `core.features`: Table containing API feature flags
|
||||
* `core.features`: Table containing *server-side* API feature flags
|
||||
|
||||
```lua
|
||||
{
|
||||
|
@ -5693,6 +5693,7 @@ Utilities
|
|||
```
|
||||
|
||||
* `core.has_feature(arg)`: returns `boolean, missing_features`
|
||||
* checks for *server-side* feature availability
|
||||
* `arg`: string or table in format `{foo=true, bar=true}`
|
||||
* `missing_features`: `{foo=true, bar=true}`
|
||||
* `core.get_player_information(player_name)`: Table containing information
|
||||
|
@ -5714,17 +5715,40 @@ Utilities
|
|||
min_jitter = 0.01, -- minimum packet time jitter
|
||||
max_jitter = 0.5, -- maximum packet time jitter
|
||||
avg_jitter = 0.03, -- average packet time jitter
|
||||
|
||||
-- The version information is provided by the client and may be spoofed
|
||||
-- or inconsistent in engine forks. You must not use this for checking
|
||||
-- feature availability of clients. Instead, do use the fields
|
||||
-- `protocol_version` and `formspec_version` where it matters.
|
||||
-- Use `core.protocol_versions` to map Luanti versions to protocol versions.
|
||||
-- This version string is only suitable for analysis purposes.
|
||||
version_string = "0.4.9-git", -- full version string
|
||||
|
||||
-- the following information is available in a debug build only!!!
|
||||
-- DO NOT USE IN MODS
|
||||
--serialization_version = 26, -- serialization version used by client
|
||||
--major = 0, -- major version number
|
||||
--minor = 4, -- minor version number
|
||||
--patch = 10, -- patch version number
|
||||
--version_string = "0.4.9-git", -- full version string
|
||||
--state = "Active" -- current client state
|
||||
}
|
||||
```
|
||||
|
||||
* `core.protocol_versions`:
|
||||
* Table mapping Luanti versions to corresponding protocol versions for modder convenience.
|
||||
* For example, to check whether a client has at least the feature set
|
||||
of Luanti 5.8.0 or newer, you could do:
|
||||
`core.get_player_information(player_name).protocol_version >= core.protocol_versions["5.8.0"]`
|
||||
* (available since 5.11)
|
||||
|
||||
```lua
|
||||
{
|
||||
[version string] = protocol version at time of release
|
||||
-- every major and minor version has an entry
|
||||
-- patch versions only for the first release whose protocol version is not already present in the table
|
||||
}
|
||||
```
|
||||
|
||||
* `core.get_player_window_information(player_name)`:
|
||||
|
||||
```lua
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue