Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
MihailRis committed Jan 11, 2025
1 parent 0e83ee0 commit fe21070
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions src/logic/scripting/lua/libs/libworld.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -206,16 +206,18 @@ static int l_set_chunk_data(lua::State* L) {
chunk->decode(buffer->data().data());
}

chunk->setModifiedAndUnsaved();
chunk->updateHeights();

auto chunksController = controller->getChunksController();
if (chunksController->lighting == nullptr) {
return lua::pushboolean(L, true);
}

Lighting& lighting = *chunksController->lighting;
chunk->updateHeights();
chunk->flags.loadedLights = false;
chunk->flags.lighted = false;
chunk->setModifiedAndUnsaved();

Lighting::prebuildSkyLight(*chunk, *indices);
lighting.onChunkLoaded(x, y, true);

Expand All @@ -226,7 +228,7 @@ static int l_set_chunk_data(lua::State* L) {
}
chunk = level->chunks->getChunk(x + lx, y + lz);
if (chunk != nullptr) {
chunk->setModifiedAndUnsaved();
chunk->flags.modified = true;
lighting.onChunkLoaded(x - 1, y, true);
}
}
Expand Down

0 comments on commit fe21070

Please sign in to comment.