chunk model refresh fix
This commit is contained in:
@@ -434,13 +434,14 @@ int l_set_block_rotation(lua_State* L) {
|
|||||||
lua::luaint y = lua_tointeger(L, 2);
|
lua::luaint y = lua_tointeger(L, 2);
|
||||||
lua::luaint z = lua_tointeger(L, 3);
|
lua::luaint z = lua_tointeger(L, 3);
|
||||||
|
|
||||||
lua::luaint value = lua_tointeger(L, 4) & BLOCK_ROT_MASK;
|
lua::luaint value = lua_tointeger(L, 4);
|
||||||
|
|
||||||
voxel* vox = scripting::level->chunks->get(x, y, z);
|
voxel* vox = scripting::level->chunks->get(x, y, z);
|
||||||
if (vox == nullptr) {
|
if (vox == nullptr) {
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
vox->states = (vox->states & (~BLOCK_ROT_MASK)) | value;
|
vox->setRotation(value);
|
||||||
|
scripting::level->chunks->getChunkByVoxel(x, y, z)->setModified(true);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -22,6 +22,10 @@ struct voxel {
|
|||||||
inline uint8_t rotation() const {
|
inline uint8_t rotation() const {
|
||||||
return states & BLOCK_ROT_MASK;
|
return states & BLOCK_ROT_MASK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline void setRotation(uint8_t rotation) {
|
||||||
|
states = (states & (~BLOCK_ROT_MASK)) | rotation & BLOCK_ROT_MASK;
|
||||||
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif /* VOXELS_VOXEL_H_ */
|
#endif /* VOXELS_VOXEL_H_ */
|
||||||
|
|||||||
Reference in New Issue
Block a user