Clippy fixes

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

View File

@ -52,7 +52,6 @@ impl RectVolSize for TerrainChunkSize {
pub struct TerrainChunkMeta { pub struct TerrainChunkMeta {
name: Option<String>, name: Option<String>,
biome: BiomeKind, biome: BiomeKind,
chaos: f32, chaos: f32,
alt: f32, alt: f32,
//basement: f32, //basement: f32,
@ -61,7 +60,7 @@ pub struct TerrainChunkMeta {
//flux: f32, //flux: f32,
temp: f32, temp: f32,
humidity: f32, humidity: f32,
rockiness: f32, //rockiness: f32,
//is_cliffs: bool, //is_cliffs: bool,
//near_cliffs: bool, //near_cliffs: bool,
tree_density: f32, tree_density: f32,
@ -69,7 +68,7 @@ pub struct TerrainChunkMeta {
//spawn_rate: f32, //spawn_rate: f32,
//river: RiverData, //river: RiverData,
//warp_factor: f32, //warp_factor: f32,
surface_veg: f32, //surface_veg: f32,
cave_alt: f32, cave_alt: f32,
contains_river: bool, contains_river: bool,
/*place: Option<Id<Place>>, */ /*place: Option<Id<Place>>, */
@ -86,9 +85,7 @@ impl TerrainChunkMeta {
alt: f32, alt: f32,
temp: f32, temp: f32,
humidity: f32, humidity: f32,
rockiness: f32,
tree_density: f32, tree_density: f32,
surface_veg: f32,
cave_alt: f32, cave_alt: f32,
contains_river: bool, contains_river: bool,
) -> Self { ) -> Self {
@ -99,9 +96,7 @@ impl TerrainChunkMeta {
alt, alt,
temp, temp,
humidity, humidity,
rockiness,
tree_density, tree_density,
surface_veg,
cave_alt, cave_alt,
contains_river, contains_river,
} }
@ -115,9 +110,7 @@ impl TerrainChunkMeta {
alt: 0.0, alt: 0.0,
temp: 0.0, temp: 0.0,
humidity: 0.0, humidity: 0.0,
rockiness: 0.0,
tree_density: 0.0, tree_density: 0.0,
surface_veg: 0.0,
cave_alt: 0.0, cave_alt: 0.0,
contains_river: false, contains_river: false,
} }
@ -135,12 +128,8 @@ impl TerrainChunkMeta {
pub fn humidity(&self) -> f32 { self.humidity } 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 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 cave_alt(&self) -> f32 { self.cave_alt }
pub fn contains_river(&self) -> bool { self.contains_river } 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 // Iterate through each kind of block of interest
for sounds in sounds.iter() { for sounds in sounds.iter() {
// If the timing condition is false, continue // If the timing condition is false, continue
if !(sounds.cond)(state) { // or if the player is far enough underground, continue
continue; if !(sounds.cond)(state) || player_pos.0.z < (terrain_alt - 30.0) {
// If the player is far enough underground, continue
} else if player_pos.0.z < (terrain_alt - 30.0) {
continue; continue;
// Hack to reduce the number of birdcalls (too many leaf blocks) // Hack to reduce the number of birdcalls (too many leaf blocks)
} else if (sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl) } else if (sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl)

View File

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

View File

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

View File

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