-
-
Save Jordach/5c6270075a09ef5a83640a967d6bdc7c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (lua_istable(L, 2)) { | |
SkyParams sky_params; | |
// just in case we're not supplied a bgcolor | |
sky_params.bgcolor = video::SColor(255,255,255,255); | |
lua_getfield(L, 2, "sky_color"); | |
if (!lua_isnil(L, -1)) | |
read_color(L, -1, &sky_params.bgcolor); | |
lua_pop(L, 1); | |
lua_getfield(L, 2, "type"); | |
if (!lua_isnil(L, -1)) | |
sky_params.type = luaL_checkstring(L, -1); | |
lua_pop(L, 1); | |
//lua_getfield(L, 2, "textures"); we're a segfaulter | |
if (lua_istable(L, 2)) { | |
lua_pushnil(L); | |
while (lua_next(L, 2) != 0) { | |
// key at index -2 and value at index -1 | |
if (lua_isstring(L, -1)) | |
sky_params.params.emplace_back(readParam<std::string>(L, -1)); | |
else | |
sky_params.params.emplace_back(""); | |
// removes value, keeps key for next iteration | |
lua_pop(L, 1); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
player:set_sky({ | |
sky_color = minetest.rgba(fog.result.red, fog.result.grn, fog.result.blu), | |
type = "skybox", | |
textures = { | |
"texture1.png", | |
"texture2.png", | |
"texture3.png", | |
"texture4.png", | |
"texture5.png", | |
"texture6.png" | |
}, | |
clouds = false, | |
custom_fog = true, | |
sun = { | |
visible = true, | |
yaw = 90, | |
tilt = 0, | |
texture = "cobble.png", | |
sunrise_glow = true, | |
}, | |
moon = { | |
visible = true, | |
yaw = -90, | |
tilt = 0, | |
texture = "default_mese.png", | |
}, | |
stars = { | |
visible = true, | |
yaw = 0, | |
tilt = 0, | |
count = 200, | |
} | |
}) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment