diff options
Diffstat (limited to 'src/script/lua_api/l_object.cpp')
-rw-r--r-- | src/script/lua_api/l_object.cpp | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/script/lua_api/l_object.cpp b/src/script/lua_api/l_object.cpp index 0a3e05907..fc2c1254b 100644 --- a/src/script/lua_api/l_object.cpp +++ b/src/script/lua_api/l_object.cpp @@ -2297,8 +2297,20 @@ int ObjectRef::l_set_lighting(lua_State *L) getfloatfield(L, -1, "intensity", lighting.shadow_intensity); } lua_pop(L, 1); // shadows + getfloatfield(L, -1, "saturation", lighting.saturation); + lua_getfield(L, 2, "exposure"); + if (lua_istable(L, -1)) { + lighting.exposure.luminance_min = getfloatfield_default(L, -1, "luminance_min", lighting.exposure.luminance_min); + lighting.exposure.luminance_max = getfloatfield_default(L, -1, "luminance_max", lighting.exposure.luminance_max); + lighting.exposure.exposure_correction = getfloatfield_default(L, -1, "exposure_correction", lighting.exposure.exposure_correction); + lighting.exposure.speed_dark_bright = getfloatfield_default(L, -1, "speed_dark_bright", lighting.exposure.speed_dark_bright); + lighting.exposure.speed_bright_dark = getfloatfield_default(L, -1, "speed_bright_dark", lighting.exposure.speed_bright_dark); + lighting.exposure.center_weight_power = getfloatfield_default(L, -1, "center_weight_power", lighting.exposure.center_weight_power); + } + lua_pop(L, 1); // exposure + getServer(L)->setLighting(player, lighting); return 0; } @@ -2321,6 +2333,20 @@ int ObjectRef::l_get_lighting(lua_State *L) lua_setfield(L, -2, "shadows"); lua_pushnumber(L, lighting.saturation); lua_setfield(L, -2, "saturation"); + lua_newtable(L); // "exposure" + lua_pushnumber(L, lighting.exposure.luminance_min); + lua_setfield(L, -2, "luminance_min"); + lua_pushnumber(L, lighting.exposure.luminance_max); + lua_setfield(L, -2, "luminance_max"); + lua_pushnumber(L, lighting.exposure.exposure_correction); + lua_setfield(L, -2, "exposure_correction"); + lua_pushnumber(L, lighting.exposure.speed_dark_bright); + lua_setfield(L, -2, "speed_dark_bright"); + lua_pushnumber(L, lighting.exposure.speed_bright_dark); + lua_setfield(L, -2, "speed_bright_dark"); + lua_pushnumber(L, lighting.exposure.center_weight_power); + lua_setfield(L, -2, "center_weight_power"); + lua_setfield(L, -2, "exposure"); return 1; } |