Merge branch 'main' into warnings

This commit is contained in:
MihailRis 2024-11-01 16:58:31 +03:00
commit 66836ba9da
5 changed files with 13 additions and 12 deletions

View File

@ -213,12 +213,6 @@ void AssetsLoader::addDefaults(AssetsLoader& loader, const Content* content) {
loader.tryAddSound(material.breakSound);
}
addLayouts(
0,
"core",
loader.getPaths()->getMainRoot() / fs::path("layouts"),
loader
);
for (auto& entry : content->getPacks()) {
auto pack = entry.second.get();
auto& info = pack->getInfo();

View File

@ -305,6 +305,8 @@ static void load_configs(const fs::path& root) {
}
void Engine::loadContent() {
scripting::cleanup();
auto resdir = paths->getResourcesFolder();
std::vector<std::string> names;
@ -350,6 +352,7 @@ void Engine::loadContent() {
}
void Engine::resetContent() {
scripting::cleanup();
auto resdir = paths->getResourcesFolder();
std::vector<PathsRoot> resRoots;
{

View File

@ -224,7 +224,7 @@ void Hud::processInput(bool visible) {
setPause(true);
}
}
if (!pause && Events::active(BIND_DEVTOOLS_CONSOLE)) {
if (!pause && Events::jactive(BIND_DEVTOOLS_CONSOLE)) {
showOverlay(assets->get<UiDocument>("core:console"), false);
}
if (!Window::isFocused() && !pause && !isInventoryOpen()) {

View File

@ -187,7 +187,15 @@ void scripting::on_world_quit() {
for (auto& pack : scripting::engine->getContentPacks()) {
lua::emit_event(L, pack.id + ":.worldquit");
}
scripting::level = nullptr;
scripting::content = nullptr;
scripting::indices = nullptr;
scripting::blocks = nullptr;
scripting::controller = nullptr;
}
void scripting::cleanup() {
auto L = lua::get_main_state();
lua::getglobal(L, "pack");
for (auto& pack : scripting::engine->getAllContentPacks()) {
lua::getfield(L, "unload");
@ -199,11 +207,6 @@ void scripting::on_world_quit() {
if (lua::getglobal(L, "__scripts_cleanup")) {
lua::call_nothrow(L, 0);
}
scripting::level = nullptr;
scripting::content = nullptr;
scripting::indices = nullptr;
scripting::blocks = nullptr;
scripting::controller = nullptr;
}
void scripting::on_blocks_tick(const Block& block, int tps) {

View File

@ -62,6 +62,7 @@ namespace scripting {
void on_world_tick();
void on_world_save();
void on_world_quit();
void cleanup();
void on_blocks_tick(const Block& block, int tps);
void update_block(const Block& block, int x, int y, int z);
void random_update_block(const Block& block, int x, int y, int z);