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