add app.is_content_loaded()
This commit is contained in:
parent
7bbd8bab34
commit
653d1d20d4
@ -5,6 +5,7 @@ app.reconfig_packs({"base"}, {})
|
||||
app.new_world("demo", "2019", "core:default")
|
||||
assert(world.is_open())
|
||||
assert(world.get_generator() == "core:default")
|
||||
assert(app.is_content_loaded())
|
||||
app.sleep(1)
|
||||
assert(world.get_total_time() > 0.0)
|
||||
print(world.get_total_time())
|
||||
@ -12,6 +13,7 @@ print(world.get_total_time())
|
||||
-- Close
|
||||
app.close_world(true)
|
||||
assert(not world.is_open())
|
||||
assert(not app.is_content_loaded())
|
||||
|
||||
-- Reopen
|
||||
app.open_world("demo")
|
||||
|
||||
@ -69,6 +69,12 @@ app.config_packs(
|
||||
Updates the packs configuration, automatically removing unspecified ones, adding those missing in the previous configuration.
|
||||
Uses app.reconfig_packs.
|
||||
|
||||
```lua
|
||||
app.is_content_loaded() -> bool
|
||||
```
|
||||
|
||||
Checks if content is loaded.
|
||||
|
||||
```lua
|
||||
app.new_world(
|
||||
-- world name
|
||||
|
||||
@ -69,6 +69,12 @@ app.config_packs(
|
||||
Обновляет конфигурацию паков, автоматически удаляя лишние, добавляя отсутствующие в прошлой конфигурации.
|
||||
Использует app.reconfig_packs.
|
||||
|
||||
```lua
|
||||
app.is_content_loaded() -> bool
|
||||
```
|
||||
|
||||
Проверяет, загружен ли контент.
|
||||
|
||||
```lua
|
||||
app.new_world(
|
||||
-- название мира
|
||||
|
||||
@ -39,6 +39,7 @@ local function complete_app_lib(app)
|
||||
app.get_setting_info = core.get_setting_info
|
||||
app.load_content = core.load_content
|
||||
app.reset_content = core.reset_content
|
||||
app.is_content_loaded = core.is_content_loaded
|
||||
|
||||
function app.config_packs(packs_list)
|
||||
-- Check if packs are valid and add dependencies to the configuration
|
||||
|
||||
@ -43,6 +43,10 @@ static int l_reset_content(lua::State* L) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_is_content_loaded(lua::State* L) {
|
||||
return lua::pushboolean(L, content != nullptr);
|
||||
}
|
||||
|
||||
/// @brief Creating new world
|
||||
/// @param name Name world
|
||||
/// @param seed Seed world
|
||||
@ -258,6 +262,7 @@ const luaL_Reg corelib[] = {
|
||||
{"get_version", lua::wrap<l_get_version>},
|
||||
{"load_content", lua::wrap<l_load_content>},
|
||||
{"reset_content", lua::wrap<l_reset_content>},
|
||||
{"is_content_loaded", lua::wrap<l_is_content_loaded>},
|
||||
{"new_world", lua::wrap<l_new_world>},
|
||||
{"open_world", lua::wrap<l_open_world>},
|
||||
{"reopen_world", lua::wrap<l_reopen_world>},
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user