add shotgun and fix up collision layers

This commit is contained in:
Jim 2025-08-31 20:30:31 -04:00
parent ad4a2cf393
commit 87fcc35a49
Signed by: jim
GPG key ID: 3D7D94BA53088BF4
8 changed files with 92 additions and 31 deletions

View file

@ -8,6 +8,7 @@ use std::time::Duration;
use avian3d::prelude::*;
use bevy::prelude::*;
use physics::PhysicsLayers;
use resources::{Drops, Resources};
use state::GameSystemSet;
@ -26,24 +27,24 @@ impl Plugin for CombatPlugin {
}
}
#[derive(PhysicsLayer, Default, Component, Clone, Copy, Debug, PartialEq, Eq, Reflect)]
#[derive(Default, Component, Clone, Copy, Debug, PartialEq, Eq, Reflect)]
pub enum Team {
#[default]
Core,
Inhabitant,
Core = 1,
Inhabitant = 2,
}
impl Team {
pub fn collision_layers(&self) -> CollisionLayers {
match self {
Team::Core => CollisionLayers::new(Team::Core, LayerMask::ALL),
Team::Inhabitant => CollisionLayers::new(Team::Inhabitant, LayerMask::ALL),
Team::Core => CollisionLayers::new(PhysicsLayers::Core, LayerMask::ALL),
Team::Inhabitant => CollisionLayers::new(PhysicsLayers::Inhabitant, LayerMask::ALL),
}
}
pub fn enemy_layers(&self) -> LayerMask {
match self {
Team::Core => Team::Inhabitant.into(),
Team::Inhabitant => Team::Core.into(),
Team::Core => PhysicsLayers::Inhabitant.into(),
Team::Inhabitant => PhysicsLayers::Core.into(),
}
}
}