Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose client version information in non-debug builds #15708

Merged
merged 17 commits into from
Feb 9, 2025
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 10 additions & 6 deletions doc/lua_api.md
Original file line number Diff line number Diff line change
Expand Up @@ -5716,14 +5716,18 @@ 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. Only use if other information isn't enough.
Zughy marked this conversation as resolved.
Show resolved Hide resolved
major = 0, -- major version number
minor = 4, -- minor version number
patch = 10, -- patch version number
rollerozxa marked this conversation as resolved.
Show resolved Hide resolved
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
serialization_version = 26, -- serialization version used by client
state = "Active" -- current client state
}
```

Expand Down
10 changes: 5 additions & 5 deletions src/script/lua_api/l_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,6 @@ int ModApiServer::l_get_player_information(lua_State *L)
lua_pushstring(L, info.lang_code.c_str());
lua_settable(L, table);

#ifndef NDEBUG
lua_pushstring(L,"serialization_version");
lua_pushnumber(L, info.ser_vers);
lua_settable(L, table);

lua_pushstring(L,"major");
lua_pushnumber(L, info.major);
lua_settable(L, table);
Expand All @@ -260,6 +255,11 @@ int ModApiServer::l_get_player_information(lua_State *L)
lua_pushstring(L, info.vers_string.c_str());
lua_settable(L, table);

#ifndef NDEBUG
lua_pushstring(L,"serialization_version");
lua_pushnumber(L, info.ser_vers);
lua_settable(L, table);

lua_pushstring(L,"state");
lua_pushstring(L, ClientInterface::state2Name(info.state).c_str());
lua_settable(L, table);
Expand Down
Loading