diff --git a/res/preload.json b/res/preload.json index 5efe0162..fb202291 100644 --- a/res/preload.json +++ b/res/preload.json @@ -31,5 +31,8 @@ "blocks", "items", "particles" + ], + "models": [ + "block" ] } diff --git a/res/scripts/stdlib.lua b/res/scripts/stdlib.lua index 1b0a8a42..f2e52621 100644 --- a/res/scripts/stdlib.lua +++ b/res/scripts/stdlib.lua @@ -22,7 +22,7 @@ function tb_frame_tostring(frame) return s end -if app then +local function complete_app_lib(app) app.sleep = sleep app.script = __VC_SCRIPT_NAME app.new_world = core.new_world @@ -37,6 +37,7 @@ if app then app.tick = coroutine.yield app.get_version = core.get_version app.get_setting_info = core.get_setting_info + app.load_content = core.load_content function app.config_packs(packs_list) -- Check if packs are valid and add dependencies to the configuration @@ -82,6 +83,12 @@ if app then end end +if app then + complete_app_lib(app) +elseif __vc_app then + complete_app_lib(__vc_app) +end + ------------------------------------------------ ------------------- Events --------------------- ------------------------------------------------ diff --git a/src/logic/scripting/lua/libs/libcore.cpp b/src/logic/scripting/lua/libs/libcore.cpp index ebf363ab..842747c4 100644 --- a/src/logic/scripting/lua/libs/libcore.cpp +++ b/src/logic/scripting/lua/libs/libcore.cpp @@ -30,6 +30,11 @@ static int l_get_version(lua::State* L) { ); } +static int l_load_content(lua::State* L) { + engine->loadContent(); + return 0; +} + /// @brief Creating new world /// @param name Name world /// @param seed Seed world @@ -243,6 +248,7 @@ static int l_blank(lua::State*) { const luaL_Reg corelib[] = { {"blank", lua::wrap}, {"get_version", lua::wrap}, + {"load_content", lua::wrap}, {"new_world", lua::wrap}, {"open_world", lua::wrap}, {"reopen_world", lua::wrap},