mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Fixed bombs panicing the server.
This commit is contained in:
parent
5bb1e4a808
commit
d13302f256
@ -734,20 +734,20 @@ pub fn handle_explosion(
|
|||||||
}
|
}
|
||||||
},
|
},
|
||||||
RadiusEffect::Entity(mut effect) => {
|
RadiusEffect::Entity(mut effect) => {
|
||||||
for (entity_b, pos_b, _health_b) in (
|
for (entity_b, pos_b) in (&ecs.entities(), &ecs.read_storage::<comp::Pos>()).join()
|
||||||
&ecs.entities(),
|
|
||||||
&ecs.read_storage::<comp::Pos>(),
|
|
||||||
&ecs.read_storage::<comp::Health>(),
|
|
||||||
)
|
|
||||||
.join()
|
|
||||||
.filter(|(_, _, h)| !h.is_dead)
|
|
||||||
{
|
{
|
||||||
let distance_squared = pos.distance_squared(pos_b.0);
|
let distance_squared = pos.distance_squared(pos_b.0);
|
||||||
let strength = 1.0 - distance_squared / explosion.radius.powi(2);
|
let strength = 1.0 - distance_squared / explosion.radius.powi(2);
|
||||||
|
|
||||||
if strength > 0.0 {
|
if strength > 0.0 {
|
||||||
effect.modify_strength(strength);
|
let is_alive = ecs
|
||||||
server.state().apply_effect(entity_b, effect.clone(), owner);
|
.read_storage::<comp::Health>()
|
||||||
|
.get(entity_b)
|
||||||
|
.map_or(true, |h| !h.is_dead);
|
||||||
|
if is_alive {
|
||||||
|
effect.modify_strength(strength);
|
||||||
|
server.state().apply_effect(entity_b, effect.clone(), owner);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
Loading…
x
Reference in New Issue
Block a user