mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
Event queue
This commit is contained in:
parent
f8e02e1b3b
commit
fcb420c4c7
7 changed files with 131 additions and 80 deletions
|
|
@ -22,20 +22,20 @@ void scripting::on_frontend_init(Hud* hud) {
|
|||
scripting::state->openlib("hud", hudlib, 0);
|
||||
|
||||
for (auto& pack : scripting::engine->getContentPacks()) {
|
||||
if (state->getglobal(pack.id+".hudopen")) {
|
||||
emit_event(pack.id + ".hudopen", [&] (lua::LuaState* state) {
|
||||
state->pushinteger(hud->getPlayer()->getId());
|
||||
state->callNoThrow(1);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::on_frontend_close() {
|
||||
scripting::hud = nullptr;
|
||||
for (auto& pack : scripting::engine->getContentPacks()) {
|
||||
if (state->getglobal(pack.id+".hudclose")) {
|
||||
emit_event(pack.id + ".hudclose", [&] (lua::LuaState* state) {
|
||||
state->pushinteger(hud->getPlayer()->getId());
|
||||
state->callNoThrow(1);
|
||||
}
|
||||
return 1;
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue