mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 02:51:49 +00:00
hud.open_permanent semantics update
This commit is contained in:
parent
d9dc974685
commit
33d14be71c
2 changed files with 16 additions and 7 deletions
|
|
@ -23,12 +23,16 @@ namespace scripting {
|
|||
}
|
||||
|
||||
int l_hud_open_inventory(lua_State* L) {
|
||||
scripting::hud->openInventory();
|
||||
if (!scripting::hud->isInventoryOpen()) {
|
||||
scripting::hud->openInventory();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l_hud_close_inventory(lua_State* L) {
|
||||
scripting::hud->closeInventory();
|
||||
if (scripting::hud->isInventoryOpen()) {
|
||||
scripting::hud->closeInventory();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
|
@ -77,10 +81,6 @@ UiDocument* require_layout(lua_State* L, const char* name) {
|
|||
|
||||
int l_hud_open_permanent(lua_State* L) {
|
||||
auto layout = require_layout(L, lua_tostring(L, 1));
|
||||
auto invview = std::dynamic_pointer_cast<InventoryView>(layout->getRoot());
|
||||
if (invview) {
|
||||
luaL_error(L, "layout must not contain 'inventory' element");
|
||||
}
|
||||
scripting::hud->openPermanent(layout);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue