From e2bc16891441b1a504d68c6f36907a0baf785f07 Mon Sep 17 00:00:00 2001 From: MihailRis Date: Mon, 6 Jan 2025 20:10:24 +0300 Subject: [PATCH] add app.reset_content() --- res/scripts/stdlib.lua | 1 + src/logic/scripting/lua/libs/libcore.cpp | 6 ++++++ 2 files changed, 7 insertions(+) diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index f2e52621f..1b19b330c 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -38,6 +38,7 @@ local function complete_app_lib(app) app.get_version = core.get_version app.get_setting_info = core.get_setting_info app.load_content = core.load_content + app.reset_content = core.reset_content function app.config_packs(packs_list) -- Check if packs are valid and add dependencies to the configuration diff --git a/src/logic/scripting/lua/libs/libcore.cpp b/src/logic/scripting/lua/libs/libcore.cpp index 842747c45..d291a77fa 100644 --- a/src/logic/scripting/lua/libs/libcore.cpp +++ b/src/logic/scripting/lua/libs/libcore.cpp @@ -35,6 +35,11 @@ static int l_load_content(lua::State* L) { return 0; } +static int l_reset_content(lua::State* L) { + engine->resetContent(); + return 0; +} + /// @brief Creating new world /// @param name Name world /// @param seed Seed world @@ -249,6 +254,7 @@ const luaL_Reg corelib[] = { {"blank", lua::wrap}, {"get_version", lua::wrap}, {"load_content", lua::wrap}, + {"reset_content", lua::wrap}, {"new_world", lua::wrap}, {"open_world", lua::wrap}, {"reopen_world", lua::wrap},