add doc comments

This commit is contained in:
Isse 2023-05-06 12:31:54 +02:00
parent 61ecd2c178
commit a0ed18c3db
5 changed files with 13 additions and 3 deletions

View File

@ -1470,6 +1470,7 @@ impl Client {
}
}
/// Mount a block at a `VolumePos`.
pub fn mount_volume(&mut self, volume_pos: VolumePos) {
self.send_msg(ClientGeneral::ControlEvent(ControlEvent::MountVolume(
volume_pos,

View File

@ -21,7 +21,7 @@ pub type TerrainSegment = Dyna<Block, ()>;
impl From<Segment> for TerrainSegment {
fn from(value: Segment) -> Self {
TerrainSegment::from_fn(value.sz, (), |pos| match value.get(pos) {
Err(_) | Ok(Cell::Empty) => Block::empty(),
Err(_) | Ok(Cell::Empty) => Block::air(SpriteKind::Empty),
Ok(cell) => {
if cell.is_hollow() {
Block::air(SpriteKind::Empty)

View File

@ -191,6 +191,10 @@ impl VolumePos {
}
impl VolumePos {
/// Retrieves the block and matrix transformation for this `VolumeBlock`
///
/// The transform is located in the blocks minimum position relative to the
/// volume.
pub fn get_block_and_transform(
&self,
terrain: &TerrainGrid,
@ -226,6 +230,7 @@ impl VolumePos {
}
}
/// Get the block at this `VolumePos`.
pub fn get_block(
&self,
terrain: &TerrainGrid,

View File

@ -854,6 +854,7 @@ pub fn attempt_swap_equipped_weapons(data: &JoinData<'_>, update: &mut StateUpda
}
}
/// Checks if a block can be reached from a position.
fn can_reach_block(
player_pos: Vec3<f32>,
block_pos: Vec3<i32>,

View File

@ -157,8 +157,11 @@ where
let greedy_size_cross = greedy_size;
let draw_delta = lower_bound;
let get_light = |vol: &mut V, pos: Vec3<i32>| vol.get(pos).map_or(true, |vox| vox.is_fluid()) as i32 as f32;
let get_ao = |vol: &mut V, pos: Vec3<i32>| vol.get(pos).map_or(false, |vox| vox.is_opaque()) as i32 as f32;
let get_light =
|vol: &mut V, pos: Vec3<i32>| vol.get(pos).map_or(true, |vox| vox.is_fluid()) as i32 as f32;
let get_ao = |vol: &mut V, pos: Vec3<i32>| {
vol.get(pos).map_or(false, |vox| vox.is_opaque()) as i32 as f32
};
let get_glow = |vol: &mut V, pos: Vec3<i32>| {
vol.get(pos)
.ok()