Faction check is now optional
This commit is contained in:
parent
d5676ab610
commit
fba4745162
1 changed files with 5 additions and 3 deletions
|
|
@ -75,15 +75,17 @@ pub fn observe_collision(
|
|||
collision: On<Collided>,
|
||||
mut commands: Commands,
|
||||
projectile_query: Query<&Projectile>,
|
||||
mut collision_query: Query<(&mut Damagable, &Factions)>,
|
||||
mut damagable_query: Query<(&mut Damagable, Option<&Factions>)>,
|
||||
) {
|
||||
let Ok(projectile) = projectile_query.get(collision.entity) else {
|
||||
return;
|
||||
};
|
||||
let Ok((mut collided, faction)) = collision_query.get_mut(collision.with) else {
|
||||
let Ok((mut collided, faction)) = damagable_query.get_mut(collision.with) else {
|
||||
return;
|
||||
};
|
||||
if projectile.faction.can_damage(faction) == false {
|
||||
if let Some(f) = faction
|
||||
&& projectile.faction.can_damage(f) == false
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue