From c33a92abd681d6de772377b104124ece3c0f61ec Mon Sep 17 00:00:00 2001 From: MihailRis Date: Sun, 29 Dec 2024 22:41:11 +0300 Subject: [PATCH] fix block.set in headless mode & fix: vctest does not cleanup worlds --- src/logic/scripting/lua/libs/libblock.cpp | 6 ++++-- vctest/main.cpp | 1 + 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/src/logic/scripting/lua/libs/libblock.cpp b/src/logic/scripting/lua/libs/libblock.cpp index d35dd764..f37b4ba3 100644 --- a/src/logic/scripting/lua/libs/libblock.cpp +++ b/src/logic/scripting/lua/libs/libblock.cpp @@ -108,8 +108,10 @@ static int l_set(lua::State* L) { if (chunksController == nullptr) { return 1; } - Lighting& lighting = *chunksController->lighting; - lighting.onBlockSet(x, y, z, id); + if (chunksController->lighting) { + Lighting& lighting = *chunksController->lighting; + lighting.onBlockSet(x, y, z, id); + } if (!noupdate) { blocks->updateSides(x, y, z); } diff --git a/vctest/main.cpp b/vctest/main.cpp index 86e61553..b6dc1347 100644 --- a/vctest/main.cpp +++ b/vctest/main.cpp @@ -210,6 +210,7 @@ int main(int argc, char** argv) { std::cout << "running " << tests.size() << " test(s)" << std::endl; for (const auto& path : tests) { passed += run_test(config, path); + fs::remove_all(config.workingDir / fs::u8path("worlds")); } print_separator(std::cout); cleanup(config.workingDir);