Merge branch 'juliancoffee/not_explodable_sprites' into 'master'

Proof of concept non-explodable sprites

See merge request veloren/veloren!2475
This commit is contained in:
Samuel Keiffer 2021-06-19 01:10:20 +00:00
commit 2abd23ec64
2 changed files with 14 additions and 5 deletions

View File

@ -21,7 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
### Removed
### Fixed
- Crafting Stations aren't exploadable anymore
- Cases where no audio output could be produced before.
- Significantly improved the performance of playing sound effects

View File

@ -225,15 +225,24 @@ impl Block {
/// arbitrary and only important when compared to one-another.
#[inline]
pub fn explode_power(&self) -> Option<f32> {
// Explodable means that the terrain sprite will get removed anyway,
// so all is good for empty fluids.
match self.kind() {
BlockKind::Leaves => Some(0.25),
BlockKind::Grass => Some(0.5),
BlockKind::WeakRock => Some(0.75),
BlockKind::Snow => Some(0.1),
// Explodable means that the terrain sprite will get removed anyway, so all is good for
// empty fluids.
// TODO: Handle the case of terrain sprites we don't want to have explode
_ => self.get_sprite().map(|_| 0.25),
_ => self.get_sprite().and_then(|sprite| match sprite {
SpriteKind::Anvil
| SpriteKind::Cauldron
| SpriteKind::CookingPot
| SpriteKind::CraftingBench
| SpriteKind::Forge
| SpriteKind::Loom
| SpriteKind::SpinningWheel
| SpriteKind::TanningRack => None,
_ => Some(0.25),
}),
}
}