diff --git a/common/benches/chonk_benchmark.rs b/common/benches/chonk_benchmark.rs index d6fd95e695..9dfa67628b 100644 --- a/common/benches/chonk_benchmark.rs +++ b/common/benches/chonk_benchmark.rs @@ -16,7 +16,7 @@ fn criterion_benchmark(c: &mut Criterion) { // Setup: Create chunk and fill it (dense) for z in [140, 220). let mut chunk = TerrainChunk::new( MIN_Z, - Block::new(BlockKind::Dense, Default::default()), + Block::new(BlockKind::Rock, Default::default()), Block::empty(), TerrainChunkMeta::void(), ); @@ -29,7 +29,7 @@ fn criterion_benchmark(c: &mut Criterion) { ), ) { chunk - .set(pos, Block::new(BlockKind::Dense, Default::default())) + .set(pos, Block::new(BlockKind::Rock, Default::default())) .unwrap(); } @@ -118,7 +118,7 @@ fn criterion_benchmark(c: &mut Criterion) { MAX_Z, ), ) { - let _ = chunk.set(pos, Block::new(BlockKind::Dense, Default::default())); + let _ = chunk.set(pos, Block::new(BlockKind::Rock, Default::default())); } }) }); diff --git a/common/src/terrain/block.rs b/common/src/terrain/block.rs index 3046aab360..bf2318b6e1 100644 --- a/common/src/terrain/block.rs +++ b/common/src/terrain/block.rs @@ -50,21 +50,11 @@ make_case_elim!( ); impl BlockKind { - pub const fn is_air(&self) -> bool { - match self { - BlockKind::Air => true, - _ => false, - } - } + pub const fn is_air(&self) -> bool { matches!(self, BlockKind::Air) } pub const fn is_fluid(&self) -> bool { *self as u8 & 0xF0 == 0x00 } - pub const fn is_liquid(&self) -> bool { - match self { - BlockKind::Water => true, - _ => false, - } - } + pub const fn is_liquid(&self) -> bool { self.is_fluid() && !self.is_air() } pub const fn is_filled(&self) -> bool { !self.is_fluid() } } @@ -199,7 +189,7 @@ impl Block { self } - /// If this block can have orientation, replace its sprite. + /// If this block can have orientation, give it a new orientation. pub fn with_ori(mut self, ori: u8) -> Self { if self.get_sprite().map(|s| s.has_ori()).unwrap_or(false) { self.attr[1] = (self.attr[1] & !0b111) | (ori & 0b111); @@ -208,7 +198,7 @@ impl Block { } /// Remove the terrain sprite or solid aspects of a block - pub fn into_vacant(mut self) -> Self { + pub fn into_vacant(self) -> Self { if self.is_fluid() { Block::new(self.kind(), Rgb::zero()) } else { diff --git a/common/src/terrain/sprite.rs b/common/src/terrain/sprite.rs index 95c96eb777..cae21755e4 100644 --- a/common/src/terrain/sprite.rs +++ b/common/src/terrain/sprite.rs @@ -170,39 +170,39 @@ impl SpriteKind { } pub fn has_ori(&self) -> bool { - match self { + matches!( + self, SpriteKind::Window1 - | SpriteKind::Window2 - | SpriteKind::Window3 - | SpriteKind::Window4 - | SpriteKind::Bed - | SpriteKind::Bench - | SpriteKind::ChairSingle - | SpriteKind::ChairDouble - | SpriteKind::CoatRack - | SpriteKind::Crate - | SpriteKind::DrawerLarge - | SpriteKind::DrawerMedium - | SpriteKind::DrawerSmall - | SpriteKind::DungeonWallDecor - | SpriteKind::HangingBasket - | SpriteKind::HangingSign - | SpriteKind::WallLamp - | SpriteKind::Planter - | SpriteKind::Shelf - | SpriteKind::TableSide - | SpriteKind::TableDining - | SpriteKind::TableDouble - | SpriteKind::WardrobeSingle - | SpriteKind::WardrobeDouble - | SpriteKind::Pot - | SpriteKind::Chest - | SpriteKind::DropGate - | SpriteKind::DropGateBottom - | SpriteKind::Door - | SpriteKind::Beehive => true, - _ => false, - } + | SpriteKind::Window2 + | SpriteKind::Window3 + | SpriteKind::Window4 + | SpriteKind::Bed + | SpriteKind::Bench + | SpriteKind::ChairSingle + | SpriteKind::ChairDouble + | SpriteKind::CoatRack + | SpriteKind::Crate + | SpriteKind::DrawerLarge + | SpriteKind::DrawerMedium + | SpriteKind::DrawerSmall + | SpriteKind::DungeonWallDecor + | SpriteKind::HangingBasket + | SpriteKind::HangingSign + | SpriteKind::WallLamp + | SpriteKind::Planter + | SpriteKind::Shelf + | SpriteKind::TableSide + | SpriteKind::TableDining + | SpriteKind::TableDouble + | SpriteKind::WardrobeSingle + | SpriteKind::WardrobeDouble + | SpriteKind::Pot + | SpriteKind::Chest + | SpriteKind::DropGate + | SpriteKind::DropGateBottom + | SpriteKind::Door + | SpriteKind::Beehive + ) } } diff --git a/server/src/events/inventory_manip.rs b/server/src/events/inventory_manip.rs index 86fc9c73ed..0ee5a4430e 100644 --- a/server/src/events/inventory_manip.rs +++ b/server/src/events/inventory_manip.rs @@ -8,8 +8,7 @@ use common::{ msg::ServerMsg, recipe::default_recipe_book, sync::{Uid, WorldSyncExt}, - terrain::block::Block, - vol::{ReadVol, Vox}, + vol::ReadVol, }; use comp::LightEmitter; use rand::Rng; diff --git a/world/src/layer/scatter.rs b/world/src/layer/scatter.rs index f93380ac70..2a3746a114 100644 --- a/world/src/layer/scatter.rs +++ b/world/src/layer/scatter.rs @@ -283,7 +283,7 @@ pub fn apply_scatter_to<'a>( ) }), // Underwater chests - (Chest, true, |c, col| (MUSH_FACT * 0.25, None)), + (Chest, true, |_, _| (MUSH_FACT * 0.1, None)), ]; for y in 0..vol.size_xy().y as i32 {