Merge branch 'knightresspaladin/fix-block-discoloration' into 'master'

Added check for exploding lava and glowing blocks

See merge request veloren/veloren!2564
This commit is contained in:
Samuel Keiffer 2021-07-06 03:28:11 +00:00
commit 5cfe701914

View File

@ -24,7 +24,7 @@ use common::{
outcome::Outcome,
resources::Time,
rtsim::RtSimEntity,
terrain::{Block, TerrainGrid},
terrain::{Block, BlockKind, TerrainGrid},
uid::{Uid, UidAllocator},
util::Dir,
vol::ReadVol,
@ -767,6 +767,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
let mut block_change = ecs.write_resource::<BlockChange>();
for block_pos in touched_blocks {
if let Ok(block) = terrain.get(block_pos) {
if !matches!(block.kind(), BlockKind::Lava | BlockKind::GlowingRock) {
let diff2 = block_pos.map(|b| b as f32).distance_squared(pos);
let fade = (1.0 - diff2 / color_range.powi(2)).max(0.0);
if let Some(mut color) = block.get_color() {
@ -784,6 +785,7 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
}
}
}
}
// Destroy terrain
for _ in 0..RAYS {