aboutsummaryrefslogtreecommitdiff
path: root/src/script/lua_api/l_object.cpp
diff options
context:
space:
mode:
authorsofar <sofar@foo-projects.org>2023-02-25 16:08:33 -0800
committerGitHub <noreply@github.com>2023-02-26 01:08:33 +0100
commit2083252c05ece1e47c1c476fda2b9eda3bf332a0 (patch)
tree3af58a210bad99834110e4aff820ce04ee839b2b /src/script/lua_api/l_object.cpp
parent6e1c70e02b00df94a584bb4247cfa4f4c616c8d5 (diff)
downloadminetest-2083252c05ece1e47c1c476fda2b9eda3bf332a0.tar.xz
Sky: transmit body_orbit_tilt to client. (#13193)
This obsoletes the current client-side setting entirely. The server can transmit the tilt to the client directly and will send 0.0f as default value. Co-authored-by: x2048 <codeforsmile@gmail.com> Co-authored-by: sfan5 <sfan5@live.de>
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r--src/script/lua_api/l_object.cpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp
index fc2c1254b..c75478590 100644
--- a/src/script/lua_api/l_object.cpp
+++ b/src/script/lua_api/l_object.cpp
@@ -1724,6 +1724,12 @@ int ObjectRef::l_set_sky(lua_State *L)
read_color(L, -1, &sky_params.bgcolor);
lua_pop(L, 1);
+ lua_getfield(L, 2, "body_orbit_tilt");
+ if (!lua_isnil(L, -1)) {
+ sky_params.body_orbit_tilt = rangelim(readParam<float>(L, -1), -60.0f, 60.0f);
+ }
+ lua_pop(L, 1);
+
lua_getfield(L, 2, "type");
if (!lua_isnil(L, -1))
sky_params.type = luaL_checkstring(L, -1);
@@ -1913,6 +1919,9 @@ int ObjectRef::l_get_sky(lua_State *L)
lua_pushlstring(L, skybox_params.type.c_str(), skybox_params.type.size());
lua_setfield(L, -2, "type");
+ lua_pushnumber(L, skybox_params.body_orbit_tilt);
+ lua_setfield(L, -2, "body_orbit_tilt");
+
lua_newtable(L);
s16 i = 1;
for (const std::string &texture : skybox_params.textures) {