mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-11-20 17:39:46 +00:00
Merge pull request #1051 from MihailRis/add-on-assets-loading-event
add on_assets_loading event
This commit is contained in:
commit
818398345d
3 changed files with 19 additions and 1 deletions
|
|
@ -245,6 +245,12 @@ function on_content_loaded()
|
|||
|
||||
Called after the content pack has been fully loaded
|
||||
|
||||
```lua
|
||||
function on_assets_loading()
|
||||
```
|
||||
|
||||
Called on assets loading start
|
||||
|
||||
## HUD events
|
||||
|
||||
Callbacks specified in *hud.lua* script.
|
||||
|
|
|
|||
|
|
@ -256,6 +256,12 @@ function on_content_loaded()
|
|||
|
||||
Вызывается после того, как контент-пак был полностью загружен
|
||||
|
||||
```lua
|
||||
function on_assets_loading()
|
||||
```
|
||||
|
||||
Вызывается в начале загрузки ассетов
|
||||
|
||||
## События HUD
|
||||
|
||||
События связанные с игровым интерфейсом прописываются в файле `scripts/hud.lua`
|
||||
|
|
|
|||
|
|
@ -261,7 +261,12 @@ static int push_properties_tables(
|
|||
}
|
||||
|
||||
void scripting::on_assets_loading() {
|
||||
lua::call_internal(lua::get_main_state(), "backup_and_clear_animation");
|
||||
auto L = lua::get_main_state();
|
||||
lua::call_internal(L, "backup_and_clear_animation");
|
||||
|
||||
for (auto& pack : content_control->getAllContentPacks()) {
|
||||
lua::emit_event(L, pack.id + ":.onassetsloading");
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::revert_assets_loading() {
|
||||
|
|
@ -842,6 +847,7 @@ void scripting::load_content_script(
|
|||
|
||||
register_event(env, "on_scripts_loading", prefix + ":.onscriptsloading");
|
||||
register_event(env, "on_content_loaded", prefix + ":.oncontentloaded");
|
||||
register_event(env, "on_assets_loading", prefix + ":.onassetsloading");
|
||||
}
|
||||
|
||||
void scripting::load_layout_script(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue