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

Light update for map blocks

This is not really different from the light update of a voxel
manipulator. This update does not assume that the lighting was correct
before, therefore it is useful for correction.

Also expose this function to the Lua API for light correction, and
allow voxel manipulators not to update the light.
This commit is contained in:
Dániel Juhász 2017-03-11 17:07:04 +01:00 committed by Ekdohibs
parent 6d1e6f8898
commit 57e5aa6628
8 changed files with 209 additions and 3 deletions

View file

@ -110,9 +110,10 @@ int LuaVoxelManip::l_write_to_map(lua_State *L)
MAP_LOCK_REQUIRED;
LuaVoxelManip *o = checkobject(L, 1);
bool update_light = lua_isboolean(L, 2) ? lua_toboolean(L, 2) : true;
GET_ENV_PTR;
ServerMap *map = &(env->getServerMap());
if (o->is_mapgen_vm) {
if (o->is_mapgen_vm || !update_light) {
o->vm->blitBackAll(&(o->modified_blocks));
} else {
voxalgo::blit_back_with_light(map, o->vm,