mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-05 19:11:50 +00:00
add player.is_infinite_items, .set_infinite_items
This commit is contained in:
parent
f4f479d389
commit
14b596140d
6 changed files with 54 additions and 4 deletions
|
|
@ -128,6 +128,20 @@ static int l_set_noclip(lua::State* L) {
|
|||
return 0;
|
||||
}
|
||||
|
||||
static int l_is_infinite_items(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
return lua::pushboolean(L, player->isInfiniteItems());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_set_infinite_items(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
player->setInfiniteItems(lua::toboolean(L, 2));
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
static int l_get_selected_block(lua::State* L) {
|
||||
if (auto player = get_player(L, 1)) {
|
||||
if (player->selection.vox.id == BLOCK_VOID) {
|
||||
|
|
@ -220,6 +234,8 @@ const luaL_Reg playerlib[] = {
|
|||
{"set_flight", lua::wrap<l_set_flight>},
|
||||
{"is_noclip", lua::wrap<l_is_noclip>},
|
||||
{"set_noclip", lua::wrap<l_set_noclip>},
|
||||
{"is_infinite_items", lua::wrap<l_is_infinite_items>},
|
||||
{"set_infinite_items", lua::wrap<l_set_infinite_items>},
|
||||
{"get_selected_block", lua::wrap<l_get_selected_block>},
|
||||
{"get_selected_entity", lua::wrap<l_get_selected_entity>},
|
||||
{"set_spawnpoint", lua::wrap<l_set_spawnpoint>},
|
||||
|
|
@ -228,4 +244,5 @@ const luaL_Reg playerlib[] = {
|
|||
{"set_entity", lua::wrap<l_set_entity>},
|
||||
{"get_camera", lua::wrap<l_get_camera>},
|
||||
{"set_camera", lua::wrap<l_set_camera>},
|
||||
{NULL, NULL}};
|
||||
{NULL, NULL}
|
||||
};
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue