mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Explosions no longer change block colours within the radius of a safe zone. Doubled the radius of the safe zone in the /home town.
This commit is contained in:
parent
ef21c433dc
commit
9e35f5ec33
@ -31,6 +31,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Can now tilt glider while only wielding it
|
- Can now tilt glider while only wielding it
|
||||||
- Experimental terrain persistence (see server documentation)
|
- Experimental terrain persistence (see server documentation)
|
||||||
- Add GPU filtering using WGPU_ADAPTER environment variable
|
- Add GPU filtering using WGPU_ADAPTER environment variable
|
||||||
|
- Explosions no longer change block colours within safe zones
|
||||||
|
|
||||||
### Changed
|
### Changed
|
||||||
|
|
||||||
@ -53,6 +54,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|||||||
- Glider dimensions now depend on character height
|
- Glider dimensions now depend on character height
|
||||||
- Glider dimensions somewhat increased overall
|
- Glider dimensions somewhat increased overall
|
||||||
- Dungeon difficulty level starts at 1 instead of 0
|
- Dungeon difficulty level starts at 1 instead of 0
|
||||||
|
- The radius of the safe zone around the starting town has been doubled
|
||||||
|
|
||||||
### Removed
|
### Removed
|
||||||
|
|
||||||
|
@ -4,9 +4,10 @@ use crate::{
|
|||||||
agent::{Agent, AgentEvent, Sound, SoundKind},
|
agent::{Agent, AgentEvent, Sound, SoundKind},
|
||||||
biped_large, bird_large, quadruped_low, quadruped_medium, quadruped_small,
|
biped_large, bird_large, quadruped_low, quadruped_medium, quadruped_small,
|
||||||
skills::SkillGroupKind,
|
skills::SkillGroupKind,
|
||||||
theropod, PhysicsState,
|
theropod, BuffKind, BuffSource, PhysicsState,
|
||||||
},
|
},
|
||||||
rtsim::RtSim,
|
rtsim::RtSim,
|
||||||
|
sys::terrain::SAFE_ZONE_RADIUS,
|
||||||
Server, SpawnPoint, StateExt,
|
Server, SpawnPoint, StateExt,
|
||||||
};
|
};
|
||||||
use common::{
|
use common::{
|
||||||
@ -16,8 +17,9 @@ use common::{
|
|||||||
self, aura, buff,
|
self, aura, buff,
|
||||||
chat::{KillSource, KillType},
|
chat::{KillSource, KillType},
|
||||||
inventory::item::MaterialStatManifest,
|
inventory::item::MaterialStatManifest,
|
||||||
object, Alignment, Body, CharacterState, Energy, EnergyChange, Group, Health, HealthChange,
|
object, Alignment, Auras, Body, CharacterState, Energy, EnergyChange, Group, Health,
|
||||||
HealthSource, Inventory, Player, Poise, PoiseChange, PoiseSource, Pos, SkillSet, Stats,
|
HealthChange, HealthSource, Inventory, Player, Poise, PoiseChange, PoiseSource, Pos,
|
||||||
|
SkillSet, Stats,
|
||||||
},
|
},
|
||||||
event::{EventBus, ServerEvent},
|
event::{EventBus, ServerEvent},
|
||||||
lottery::{LootSpec, Lottery},
|
lottery::{LootSpec, Lottery},
|
||||||
@ -741,11 +743,46 @@ pub fn handle_explosion(server: &Server, pos: Vec3<f32>, explosion: Explosion, o
|
|||||||
|
|
||||||
// TODO: Faster RNG?
|
// TODO: Faster RNG?
|
||||||
let mut rng = rand::thread_rng();
|
let mut rng = rand::thread_rng();
|
||||||
for effect in explosion.effects {
|
'effects: for effect in explosion.effects {
|
||||||
match effect {
|
match effect {
|
||||||
RadiusEffect::TerrainDestruction(power) => {
|
RadiusEffect::TerrainDestruction(power) => {
|
||||||
const RAYS: usize = 500;
|
const RAYS: usize = 500;
|
||||||
|
|
||||||
|
let spatial_grid = ecs.read_resource::<common::CachedSpatialGrid>();
|
||||||
|
let auras = ecs.read_storage::<Auras>();
|
||||||
|
let positions = ecs.read_storage::<Pos>();
|
||||||
|
|
||||||
|
// Prevent block colour changes within the radius of a safe zone aura
|
||||||
|
if spatial_grid
|
||||||
|
.0
|
||||||
|
.in_circle_aabr(pos.xy(), SAFE_ZONE_RADIUS)
|
||||||
|
.filter_map(|entity| {
|
||||||
|
auras
|
||||||
|
.get(entity)
|
||||||
|
.and_then(|entity_auras| {
|
||||||
|
positions.get(entity).map(|pos| (entity_auras, pos))
|
||||||
|
})
|
||||||
|
.and_then(|(entity_auras, pos)| {
|
||||||
|
entity_auras
|
||||||
|
.auras
|
||||||
|
.iter()
|
||||||
|
.find(|(_, aura)| {
|
||||||
|
matches!(aura.aura_kind, aura::AuraKind::Buff {
|
||||||
|
kind: BuffKind::Invulnerability,
|
||||||
|
source: BuffSource::World,
|
||||||
|
..
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.map(|(_, aura)| (*pos, aura.radius))
|
||||||
|
})
|
||||||
|
})
|
||||||
|
.any(|(aura_pos, aura_radius)| {
|
||||||
|
pos.distance_squared(aura_pos.0) < aura_radius.powi(2)
|
||||||
|
})
|
||||||
|
{
|
||||||
|
continue 'effects;
|
||||||
|
}
|
||||||
|
|
||||||
// Color terrain
|
// Color terrain
|
||||||
let mut touched_blocks = Vec::new();
|
let mut touched_blocks = Vec::new();
|
||||||
let color_range = power * 2.7;
|
let color_range = power * 2.7;
|
||||||
|
@ -36,6 +36,8 @@ pub(crate) struct LazyTerrainMessage {
|
|||||||
lazy_msg_hi: Option<crate::client::PreparedMsg>,
|
lazy_msg_hi: Option<crate::client::PreparedMsg>,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pub const SAFE_ZONE_RADIUS: f32 = 200.0;
|
||||||
|
|
||||||
impl LazyTerrainMessage {
|
impl LazyTerrainMessage {
|
||||||
#[allow(clippy::new_without_default)]
|
#[allow(clippy::new_without_default)]
|
||||||
pub(crate) fn new() -> Self {
|
pub(crate) fn new() -> Self {
|
||||||
@ -241,7 +243,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
// Insert a safezone if chunk contains the spawn position
|
// Insert a safezone if chunk contains the spawn position
|
||||||
if server_settings.safe_spawn && is_spawn_chunk(key, *spawn_point, &terrain) {
|
if server_settings.safe_spawn && is_spawn_chunk(key, *spawn_point, &terrain) {
|
||||||
server_emitter.emit(ServerEvent::CreateSafezone {
|
server_emitter.emit(ServerEvent::CreateSafezone {
|
||||||
range: Some(100.0),
|
range: Some(SAFE_ZONE_RADIUS),
|
||||||
pos: Pos(spawn_point.0),
|
pos: Pos(spawn_point.0),
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user