mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-06 03:21:49 +00:00
moved interact from world to hud
This commit is contained in:
parent
55f30caa35
commit
3d301f13d7
3 changed files with 17 additions and 19 deletions
|
|
@ -93,6 +93,22 @@ void scripting::on_frontend_close() {
|
|||
scripting::post_processing = nullptr;
|
||||
}
|
||||
|
||||
void scripting::on_inventory_interact(int invid, int slot, int action) {
|
||||
auto L = lua::get_main_state();
|
||||
for (auto& pack : content_control->getAllContentPacks()) {
|
||||
lua::emit_event(
|
||||
L,
|
||||
pack.id + ":.hudinventoryinteract",
|
||||
[&](lua::State* L) {
|
||||
lua::pushinteger(L, invid);
|
||||
lua::pushinteger(L, slot);
|
||||
lua::pushinteger(L, action);
|
||||
return 3;
|
||||
}
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
void scripting::load_hud_script(
|
||||
const scriptenv& senv,
|
||||
const std::string& packid,
|
||||
|
|
@ -109,6 +125,7 @@ void scripting::load_hud_script(
|
|||
register_event(env, "on_hud_open", packid + ":.hudopen");
|
||||
register_event(env, "on_hud_render", packid + ":.hudrender");
|
||||
register_event(env, "on_hud_close", packid + ":.hudclose");
|
||||
register_event(env, "on_hud_inventory_interact", packid + ":.hudinventoryinteract");
|
||||
}
|
||||
|
||||
gui::PageLoaderFunc scripting::create_page_loader() {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue