mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Even more clippy fixes
This commit is contained in:
parent
bc1059610b
commit
ddd970b986
@ -188,7 +188,7 @@ impl MusicMgr {
|
||||
})
|
||||
.filter(|track| {
|
||||
let mut result = false;
|
||||
if track.biomes.len() > 0 {
|
||||
if !track.biomes.is_empty() {
|
||||
for biome in track.biomes.iter() {
|
||||
if biome.0 == current_biome {
|
||||
result = true;
|
||||
@ -205,7 +205,7 @@ impl MusicMgr {
|
||||
// on the biome
|
||||
let new_maybe_track = maybe_tracks.choose_weighted(&mut rng, |track| {
|
||||
let mut chance = 0;
|
||||
if track.biomes.len() > 0 {
|
||||
if !track.biomes.is_empty() {
|
||||
for biome in track.biomes.iter() {
|
||||
if biome.0 == current_biome {
|
||||
chance = biome.1;
|
||||
|
@ -146,11 +146,10 @@ impl EventMapper for BlockEventMapper {
|
||||
for sounds in sounds.iter() {
|
||||
// If the timing condition is false, continue
|
||||
// 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)
|
||||
&& thread_rng().gen_bool(0.995)
|
||||
if !(sounds.cond)(state)
|
||||
|| player_pos.0.z < (terrain_alt - 30.0)
|
||||
|| ((sounds.sfx == SfxEvent::Birdcall || sounds.sfx == SfxEvent::Owl)
|
||||
&& thread_rng().gen_bool(0.995))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
@ -61,28 +61,25 @@ impl EventMapper for CampfireEventMapper {
|
||||
.join()
|
||||
.filter(|(_, _, e_pos)| (e_pos.0.distance_squared(cam_pos)) < SFX_DIST_LIMIT_SQR)
|
||||
{
|
||||
match body {
|
||||
Body::Object(object::Body::CampfireLit) => {
|
||||
let state = self.event_history.entry(entity).or_default();
|
||||
if let Body::Object(object::Body::CampfireLit) = body {
|
||||
let state = self.event_history.entry(entity).or_default();
|
||||
|
||||
let mapped_event = SfxEvent::Campfire;
|
||||
let mapped_event = SfxEvent::Campfire;
|
||||
|
||||
// Check for SFX config entry for this movement
|
||||
if Self::should_emit(state, triggers.get_key_value(&mapped_event)) {
|
||||
sfx_emitter.emit(SfxEventItem::new(
|
||||
mapped_event.clone(),
|
||||
Some(pos.0),
|
||||
Some(0.25),
|
||||
));
|
||||
// Check for SFX config entry for this movement
|
||||
if Self::should_emit(state, triggers.get_key_value(&mapped_event)) {
|
||||
sfx_emitter.emit(SfxEventItem::new(
|
||||
mapped_event.clone(),
|
||||
Some(pos.0),
|
||||
Some(0.25),
|
||||
));
|
||||
|
||||
state.time = Instant::now();
|
||||
}
|
||||
state.time = Instant::now();
|
||||
}
|
||||
|
||||
// update state to determine the next event. We only record the time (above) if
|
||||
// it was dispatched
|
||||
state.event = mapped_event;
|
||||
},
|
||||
_ => {},
|
||||
// update state to determine the next event. We only record the time (above) if
|
||||
// it was dispatched
|
||||
state.event = mapped_event;
|
||||
}
|
||||
}
|
||||
self.cleanup(player_entity);
|
||||
|
Loading…
Reference in New Issue
Block a user