get_block_rotation, set_block_rotation
This commit is contained in:
@@ -419,6 +419,31 @@ int l_get_block_z(lua_State* L) {
|
||||
}
|
||||
}
|
||||
|
||||
int l_get_block_rotation(lua_State* L) {
|
||||
lua::luaint x = lua_tointeger(L, 1);
|
||||
lua::luaint y = lua_tointeger(L, 2);
|
||||
lua::luaint z = lua_tointeger(L, 3);
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
int rotation = vox == nullptr ? 0 : vox->rotation();
|
||||
lua_pushinteger(L, rotation);
|
||||
return 1;
|
||||
}
|
||||
|
||||
int l_set_block_rotation(lua_State* L) {
|
||||
lua::luaint x = lua_tointeger(L, 1);
|
||||
lua::luaint y = lua_tointeger(L, 2);
|
||||
lua::luaint z = lua_tointeger(L, 3);
|
||||
|
||||
lua::luaint value = lua_tointeger(L, 4) & BLOCK_ROT_MASK;
|
||||
|
||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||
if (vox == nullptr) {
|
||||
return 0;
|
||||
}
|
||||
vox->states = (vox->states & (~BLOCK_ROT_MASK)) | value;
|
||||
return 0;
|
||||
}
|
||||
|
||||
int l_get_block_states(lua_State* L) {
|
||||
lua::luaint x = lua_tointeger(L, 1);
|
||||
lua::luaint y = lua_tointeger(L, 2);
|
||||
|
||||
Reference in New Issue
Block a user