add player.is_loading_chunks, .set_loading_chunks

This commit is contained in:
MihailRis
2024-12-24 10:35:09 +03:00
parent 0940e899cf
commit e153e1fbd7
6 changed files with 54 additions and 2 deletions
@@ -164,6 +164,20 @@ static int l_set_instant_destruction(lua::State* L) {
return 0;
}
static int l_is_loading_chunks(lua::State* L) {
if (auto player = get_player(L, 1)) {
return lua::pushboolean(L, player->isLoadingChunks());
}
return 0;
}
static int l_set_loading_chunks(lua::State* L) {
if (auto player = get_player(L, 1)) {
player->setLoadingChunks(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) {
@@ -282,6 +296,8 @@ const luaL_Reg playerlib[] = {
{"set_infinite_items", lua::wrap<l_set_infinite_items>},
{"is_instant_destruction", lua::wrap<l_is_instant_destruction>},
{"set_instant_destruction", lua::wrap<l_set_instant_destruction>},
{"is_loading_chunks", lua::wrap<l_is_loading_chunks>},
{"set_loading_chunks", lua::wrap<l_set_loading_chunks>},
{"set_selected_slot", lua::wrap<l_set_selected_slot>},
{"get_selected_block", lua::wrap<l_get_selected_block>},
{"get_selected_entity", lua::wrap<l_get_selected_entity>},