add app.load_content

This commit is contained in:
MihailRis 2025-01-06 16:54:03 +03:00
parent ab24187b49
commit d65da966d2
3 changed files with 17 additions and 1 deletions

View File

@ -31,5 +31,8 @@
"blocks", "blocks",
"items", "items",
"particles" "particles"
],
"models": [
"block"
] ]
} }

View File

@ -22,7 +22,7 @@ function tb_frame_tostring(frame)
return s return s
end end
if app then local function complete_app_lib(app)
app.sleep = sleep app.sleep = sleep
app.script = __VC_SCRIPT_NAME app.script = __VC_SCRIPT_NAME
app.new_world = core.new_world app.new_world = core.new_world
@ -37,6 +37,7 @@ if app then
app.tick = coroutine.yield app.tick = coroutine.yield
app.get_version = core.get_version app.get_version = core.get_version
app.get_setting_info = core.get_setting_info app.get_setting_info = core.get_setting_info
app.load_content = core.load_content
function app.config_packs(packs_list) function app.config_packs(packs_list)
-- Check if packs are valid and add dependencies to the configuration -- Check if packs are valid and add dependencies to the configuration
@ -82,6 +83,12 @@ if app then
end end
end end
if app then
complete_app_lib(app)
elseif __vc_app then
complete_app_lib(__vc_app)
end
------------------------------------------------ ------------------------------------------------
------------------- Events --------------------- ------------------- Events ---------------------
------------------------------------------------ ------------------------------------------------

View File

@ -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 /// @brief Creating new world
/// @param name Name world /// @param name Name world
/// @param seed Seed world /// @param seed Seed world
@ -243,6 +248,7 @@ static int l_blank(lua::State*) {
const luaL_Reg corelib[] = { const luaL_Reg corelib[] = {
{"blank", lua::wrap<l_blank>}, {"blank", lua::wrap<l_blank>},
{"get_version", lua::wrap<l_get_version>}, {"get_version", lua::wrap<l_get_version>},
{"load_content", lua::wrap<l_load_content>},
{"new_world", lua::wrap<l_new_world>}, {"new_world", lua::wrap<l_new_world>},
{"open_world", lua::wrap<l_open_world>}, {"open_world", lua::wrap<l_open_world>},
{"reopen_world", lua::wrap<l_reopen_world>}, {"reopen_world", lua::wrap<l_reopen_world>},