added hud.is_player_inventory_open

This commit is contained in:
Xertis 2026-02-28 22:34:52 +03:00
parent cb1b113181
commit 9ad21460a2
4 changed files with 14 additions and 0 deletions

View file

@ -73,6 +73,9 @@ hud.is_paused() -> boolean
-- Возвращает true если открыт инвентарь или оверлей.
hud.is_inventory_open() -> boolean
-- Возвращает true если открыт инвентарь игрока.
hud.is_player_inventory_open() -> boolean
-- Устанавливает разрешение на паузу. При значении false меню паузы не приостанавливает игру.
hud.set_allow_pause(flag: boolean)

View file

@ -688,6 +688,10 @@ bool Hud::isInventoryOpen() const {
return inventoryOpen;
}
bool Hud::isPlayerInventoryOpen() const {
return inventoryView != nullptr;
}
bool Hud::isPause() const {
return pause;
}

View file

@ -147,6 +147,8 @@ public:
/// @brief Check if inventory mode on
bool isInventoryOpen() const;
bool isPlayerInventoryOpen() const;
/// @brief Check if pause mode on
bool isPause() const;

View file

@ -162,6 +162,10 @@ static int l_is_inventory_open(lua::State* L) {
return lua::pushboolean(L, hud->isInventoryOpen());
}
static int l_is_player_inventory_open(lua::State* L) {
return lua::pushboolean(L, hud->isPlayerInventoryOpen());
}
static int l_is_content_access(lua::State* L) {
return lua::pushboolean(L, hud->isContentAccess());
}
@ -217,6 +221,7 @@ const luaL_Reg hudlib[] = {
{"resume", wrap_hud<l_resume>},
{"is_paused", wrap_hud<l_is_paused>},
{"is_inventory_open", wrap_hud<l_is_inventory_open>},
{"is_player_inventory_open", wrap_hud<l_is_player_inventory_open>},
{"get_player", wrap_hud<l_get_player>},
{"_is_content_access", wrap_hud<l_is_content_access>},
{"_set_content_access", wrap_hud<l_set_content_access>},