get_block_rotation, set_block_rotation
This commit is contained in:
parent
43db8ebba1
commit
8341485aef
@ -116,6 +116,8 @@ void lua::LuaState::createFuncs() {
|
|||||||
addfunc("get_block_Z", lua_wrap_errors<l_get_block_z>);
|
addfunc("get_block_Z", lua_wrap_errors<l_get_block_z>);
|
||||||
addfunc("get_block_states", lua_wrap_errors<l_get_block_states>);
|
addfunc("get_block_states", lua_wrap_errors<l_get_block_states>);
|
||||||
addfunc("set_block_states", lua_wrap_errors<l_set_block_states>);
|
addfunc("set_block_states", lua_wrap_errors<l_set_block_states>);
|
||||||
|
addfunc("get_block_rotation", lua_wrap_errors<l_get_block_rotation>);
|
||||||
|
addfunc("set_block_rotation", lua_wrap_errors<l_set_block_rotation>);
|
||||||
addfunc("get_block_user_bits", lua_wrap_errors<l_get_block_user_bits>);
|
addfunc("get_block_user_bits", lua_wrap_errors<l_get_block_user_bits>);
|
||||||
addfunc("set_block_user_bits", lua_wrap_errors<l_set_block_user_bits>);
|
addfunc("set_block_user_bits", lua_wrap_errors<l_set_block_user_bits>);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -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) {
|
int l_get_block_states(lua_State* L) {
|
||||||
lua::luaint x = lua_tointeger(L, 1);
|
lua::luaint x = lua_tointeger(L, 1);
|
||||||
lua::luaint y = lua_tointeger(L, 2);
|
lua::luaint y = lua_tointeger(L, 2);
|
||||||
|
|||||||
@ -133,6 +133,8 @@ extern int l_get_block_y(lua_State* L);
|
|||||||
extern int l_get_block_z(lua_State* L);
|
extern int l_get_block_z(lua_State* L);
|
||||||
extern int l_get_block_states(lua_State* L);
|
extern int l_get_block_states(lua_State* L);
|
||||||
extern int l_set_block_states(lua_State* L);
|
extern int l_set_block_states(lua_State* L);
|
||||||
|
extern int l_get_block_rotation(lua_State* L);
|
||||||
|
extern int l_set_block_rotation(lua_State* L);
|
||||||
extern int l_get_block_user_bits(lua_State* L);
|
extern int l_get_block_user_bits(lua_State* L);
|
||||||
extern int l_set_block_user_bits(lua_State* L);
|
extern int l_set_block_user_bits(lua_State* L);
|
||||||
extern int l_is_replaceable_at(lua_State* L);
|
extern int l_is_replaceable_at(lua_State* L);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user