Clippy fixes

This commit is contained in:
jiminycrick 2020-11-08 23:50:19 -08:00
parent d47e0bbb73
commit ea1bc2941b
5 changed files with 6 additions and 21 deletions

View File

@ -52,7 +52,6 @@ impl RectVolSize for TerrainChunkSize {
pub struct TerrainChunkMeta {
name: Option<String>,
biome: BiomeKind,
chaos: f32,
alt: f32,
//basement: f32,
@ -61,7 +60,7 @@ pub struct TerrainChunkMeta {
//flux: f32,
temp: f32,
humidity: f32,
rockiness: f32,
//rockiness: f32,
//is_cliffs: bool,
//near_cliffs: bool,
tree_density: f32,
@ -69,7 +68,7 @@ pub struct TerrainChunkMeta {
//spawn_rate: f32,
//river: RiverData,
//warp_factor: f32,
surface_veg: f32,
//surface_veg: f32,
cave_alt: f32,
contains_river: bool,
/*place: Option<Id<Place>>, */
@ -86,9 +85,7 @@ impl TerrainChunkMeta {
alt: f32,
temp: f32,
humidity: f32,
rockiness: f32,
tree_density: f32,
surface_veg: f32,
cave_alt: f32,
contains_river: bool,
) -> Self {
@ -99,9 +96,7 @@ impl TerrainChunkMeta {
alt,
temp,
humidity,
rockiness,
tree_density,
surface_veg,
cave_alt,
contains_river,
}
@ -115,9 +110,7 @@ impl TerrainChunkMeta {
alt: 0.0,
temp: 0.0,
humidity: 0.0,
rockiness: 0.0,
tree_density: 0.0,
surface_veg: 0.0,
cave_alt: 0.0,
contains_river: false,
}
@ -135,12 +128,8 @@ impl TerrainChunkMeta {
pub fn humidity(&self) -> f32 { self.humidity }
pub fn rockiness(&self) -> f32 { self.rockiness }
pub fn tree_density(&self) -> f32 { self.tree_density }
pub fn surface_veg(&self) -> f32 { self.surface_veg }
pub fn cave_alt(&self) -> f32 { self.cave_alt }
pub fn contains_river(&self) -> bool { self.contains_river }

View File

@ -145,10 +145,8 @@ impl EventMapper for BlockEventMapper {
// Iterate through each kind of block of interest
for sounds in sounds.iter() {
// If the timing condition is false, continue
if !(sounds.cond)(state) {
continue;
// If the player is far enough underground, continue
} else if player_pos.0.z < (terrain_alt - 30.0) {
// or if the player is far enough underground, continue
if !(sounds.cond)(state) || player_pos.0.z < (terrain_alt - 30.0) {
continue;
// Hack to reduce the number of birdcalls (too many leaf blocks)
} else if (sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl)

View File

@ -223,7 +223,7 @@ impl MovementEventMapper {
underfoot_block_kind: BlockKind,
) -> SfxEvent {
if physics_state.in_liquid.is_some() && vel.magnitude() > 0.1 {
return SfxEvent::Swim;
SfxEvent::Swim
} else if physics_state.on_ground && vel.magnitude() > 0.1 {
match underfoot_block_kind {
BlockKind::Snow => SfxEvent::SnowRun,

View File

@ -99,7 +99,7 @@ impl WindMgr {
.unwrap_or(BlockKind::Air)
== BlockKind::Water
{
volume_multiplier = volume_multiplier * 0.1;
volume_multiplier *= volume_multiplier;
}
if cam_pos.z < Self::get_current_terrain_alt(client) - 20.0 {
volume_multiplier = 0.0;

View File

@ -162,9 +162,7 @@ impl World {
sim_chunk.alt,
sim_chunk.temp,
sim_chunk.humidity,
sim_chunk.rockiness,
sim_chunk.tree_density,
sim_chunk.surface_veg,
sim_chunk.cave.1.alt,
sim_chunk.river.is_river(),
);