add player.is_instant_destruction, .set_instant_destruction

This commit is contained in:
MihailRis
2024-11-21 05:02:45 +03:00
parent 005bcfb436
commit 2ba90625ce
5 changed files with 44 additions and 0 deletions
@@ -142,6 +142,20 @@ static int l_set_infinite_items(lua::State* L) {
return 0;
}
static int l_is_instant_destruction(lua::State* L) {
if (auto player = get_player(L, 1)) {
return lua::pushboolean(L, player->isInstantDestruction());
}
return 0;
}
static int l_set_instant_destruction(lua::State* L) {
if (auto player = get_player(L, 1)) {
player->setInstantDestruction(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) {
@@ -236,6 +250,8 @@ const luaL_Reg playerlib[] = {
{"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>},
{"is_instant_destruction", lua::wrap<l_is_instant_destruction>},
{"set_instant_destruction", lua::wrap<l_set_instant_destruction>},
{"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>},