Skip to content

Commit

Permalink
Lua API: Document shader dependencies of set_lighting() (#13079)
Browse files Browse the repository at this point in the history
  • Loading branch information
SmallJoker committed Dec 26, 2022
1 parent 1e7804a commit 03e7101
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 2 additions & 0 deletions doc/lua_api.txt
Original file line number Diff line number Diff line change
Expand Up @@ -7468,8 +7468,10 @@ child will follow movement and rotation of that bone.
* `saturation` sets the saturation (vividness).
values > 1 increase the saturation
values in [0,1) decrease the saturation
* This value has no effect on clients who have the "Tone Mapping" shader disabled.
* `shadows` is a table that controls ambient shadows
* `intensity` sets the intensity of the shadows from 0 (no shadows, default) to 1 (blackness)
* This value has no effect on clients who have the "Dynamic Shadows" shader disabled.
* `get_lighting()`: returns the current state of lighting for the player.
* Result is a table with the same fields as `light_definition` in `set_lighting`.
* `respawn()`: Respawns the player using the same mechanism as the death screen,
Expand Down
6 changes: 3 additions & 3 deletions src/script/lua_api/l_object.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2294,10 +2294,10 @@ int ObjectRef::l_set_lighting(lua_State *L)
Lighting lighting = player->getLighting();
lua_getfield(L, 2, "shadows");
if (lua_istable(L, -1)) {
lighting.shadow_intensity = getfloatfield_default(L, -1, "intensity", lighting.shadow_intensity);
getfloatfield(L, -1, "intensity", lighting.shadow_intensity);
}
lighting.saturation = getfloatfield_default(L, 2, "saturation", lighting.saturation);
lua_pop(L, -1);
lua_pop(L, 1); // shadows
getfloatfield(L, -1, "saturation", lighting.saturation);

getServer(L)->setLighting(player, lighting);
return 0;
Expand Down

0 comments on commit 03e7101

Please sign in to comment.