add rules & add 'show-content-access' rule
This commit is contained in:
@@ -22,21 +22,21 @@ namespace scripting {
|
||||
}
|
||||
using namespace scripting;
|
||||
|
||||
static int l_hud_open_inventory(lua::State*) {
|
||||
static int l_open_inventory(lua::State*) {
|
||||
if (!hud->isInventoryOpen()) {
|
||||
hud->openInventory();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_close_inventory(lua::State*) {
|
||||
static int l_close_inventory(lua::State*) {
|
||||
if (hud->isInventoryOpen()) {
|
||||
hud->closeInventory();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_open_block(lua::State* L) {
|
||||
static int l_open_block(lua::State* L) {
|
||||
auto x = lua::tointeger(L, 1);
|
||||
auto y = lua::tointeger(L, 2);
|
||||
auto z = lua::tointeger(L, 3);
|
||||
@@ -69,7 +69,7 @@ static int l_hud_open_block(lua::State* L) {
|
||||
return 2;
|
||||
}
|
||||
|
||||
static int l_hud_show_overlay(lua::State* L) {
|
||||
static int l_show_overlay(lua::State* L) {
|
||||
auto name = lua::require_string(L, 1);
|
||||
bool playerInventory = lua::toboolean(L, 2);
|
||||
|
||||
@@ -93,29 +93,29 @@ static UiDocument* require_layout(const char* name) {
|
||||
return layout;
|
||||
}
|
||||
|
||||
static int l_hud_open_permanent(lua::State* L) {
|
||||
static int l_open_permanent(lua::State* L) {
|
||||
auto layout = require_layout(lua::require_string(L, 1));
|
||||
hud->openPermanent(layout);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_close(lua::State* L) {
|
||||
static int l_close(lua::State* L) {
|
||||
auto layout = require_layout(lua::require_string(L, 1));
|
||||
hud->remove(layout->getRoot());
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_pause(lua::State*) {
|
||||
static int l_pause(lua::State*) {
|
||||
hud->setPause(true);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_resume(lua::State*) {
|
||||
static int l_resume(lua::State*) {
|
||||
hud->setPause(false);
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_hud_get_block_inventory(lua::State* L) {
|
||||
static int l_get_block_inventory(lua::State* L) {
|
||||
auto inventory = hud->getBlockInventory();
|
||||
if (inventory == nullptr) {
|
||||
return lua::pushinteger(L, 0);
|
||||
@@ -124,30 +124,41 @@ static int l_hud_get_block_inventory(lua::State* L) {
|
||||
}
|
||||
}
|
||||
|
||||
static int l_hud_get_player(lua::State* L) {
|
||||
static int l_get_player(lua::State* L) {
|
||||
auto player = hud->getPlayer();
|
||||
return lua::pushinteger(L, player->getId());
|
||||
}
|
||||
|
||||
static int l_hud_is_paused(lua::State* L) {
|
||||
static int l_is_paused(lua::State* L) {
|
||||
return lua::pushboolean(L, hud->isPause());
|
||||
}
|
||||
|
||||
static int l_hud_is_inventory_open(lua::State* L) {
|
||||
static int l_is_inventory_open(lua::State* L) {
|
||||
return lua::pushboolean(L, hud->isInventoryOpen());
|
||||
}
|
||||
|
||||
static int l_is_content_access(lua::State* L) {
|
||||
return lua::pushboolean(L, hud->isContentAccess());
|
||||
}
|
||||
|
||||
static int l_set_content_access(lua::State* L) {
|
||||
hud->setContentAccess(lua::toboolean(L, 1));
|
||||
return 0;
|
||||
}
|
||||
|
||||
const luaL_Reg hudlib[] = {
|
||||
{"open_inventory", lua::wrap<l_hud_open_inventory>},
|
||||
{"close_inventory", lua::wrap<l_hud_close_inventory>},
|
||||
{"open_block", lua::wrap<l_hud_open_block>},
|
||||
{"open_permanent", lua::wrap<l_hud_open_permanent>},
|
||||
{"show_overlay", lua::wrap<l_hud_show_overlay>},
|
||||
{"get_block_inventory", lua::wrap<l_hud_get_block_inventory>},
|
||||
{"close", lua::wrap<l_hud_close>},
|
||||
{"pause", lua::wrap<l_hud_pause>},
|
||||
{"resume", lua::wrap<l_hud_resume>},
|
||||
{"is_paused", lua::wrap<l_hud_is_paused>},
|
||||
{"is_inventory_open", lua::wrap<l_hud_is_inventory_open>},
|
||||
{"get_player", lua::wrap<l_hud_get_player>},
|
||||
{"open_inventory", lua::wrap<l_open_inventory>},
|
||||
{"close_inventory", lua::wrap<l_close_inventory>},
|
||||
{"open_block", lua::wrap<l_open_block>},
|
||||
{"open_permanent", lua::wrap<l_open_permanent>},
|
||||
{"show_overlay", lua::wrap<l_show_overlay>},
|
||||
{"get_block_inventory", lua::wrap<l_get_block_inventory>},
|
||||
{"close", lua::wrap<l_close>},
|
||||
{"pause", lua::wrap<l_pause>},
|
||||
{"resume", lua::wrap<l_resume>},
|
||||
{"is_paused", lua::wrap<l_is_paused>},
|
||||
{"is_inventory_open", lua::wrap<l_is_inventory_open>},
|
||||
{"get_player", lua::wrap<l_get_player>},
|
||||
{"_is_content_access", lua::wrap<l_is_content_access>},
|
||||
{"_set_content_access", lua::wrap<l_set_content_access>},
|
||||
{NULL, NULL}};
|
||||
|
||||
Reference in New Issue
Block a user