1
0
Fork 0
mirror of https://github.com/luanti-org/luanti.git synced 2025-06-27 16:36:03 +00:00

Allow fog color to be overriden properly (#14296)

This commit is contained in:
sfan5 2024-01-23 22:33:33 +01:00 committed by GitHub
parent a29d3cf074
commit 9e3a11534f
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 96 additions and 84 deletions

View file

@ -1995,15 +1995,21 @@ int ObjectRef::l_set_sky(lua_State *L)
if (!lua_isnil(L, -1))
sky_params.fog_tint_type = luaL_checkstring(L, -1);
lua_pop(L, 1);
// pop "sky_color" table
lua_pop(L, 1);
}
lua_pop(L, 1);
lua_getfield(L, 2, "fog");
if (lua_istable(L, -1)) {
sky_params.fog_distance = getintfield_default(L, -1, "fog_distance", sky_params.fog_distance);
sky_params.fog_start = getfloatfield_default(L, -1, "fog_start", sky_params.fog_start);
sky_params.fog_distance = getintfield_default(L, -1,
"fog_distance", sky_params.fog_distance);
sky_params.fog_start = getfloatfield_default(L, -1,
"fog_start", sky_params.fog_start);
lua_getfield(L, -1, "fog_color");
read_color(L, -1, &sky_params.fog_color);
lua_pop(L, 1);
}
lua_pop(L, 1);
} else {
// Handle old set_sky calls, and log deprecated:
log_deprecated(L, "Deprecated call to set_sky, please check lua_api.md");