feat: added armour passives

This commit is contained in:
TotallyNot 2025-11-04 13:04:56 +01:00
parent cfe2631578
commit 451efd2bb7
Signed by: pyrite
GPG key ID: 7F1BA9170CD35D15
17 changed files with 654 additions and 318 deletions

View file

@ -4,6 +4,7 @@ use bevy_ecs::prelude::*;
use proxisim_models::{
bundle::{
Id, Name,
armour::Armour,
player::{Attacker, Player},
weapon::Weapon,
},
@ -18,6 +19,7 @@ pub struct EntityRegistry(pub HashMap<Entity, EntityInfo>);
fn read_entities(
player_q: Query<(Entity, &Name, &Id, Has<Attacker>), With<Player>>,
weapon_q: Query<(Entity, &ChildOf, &Name, &Id), With<Weapon>>,
armour_q: Query<(Entity, &ChildOf, &Name, &Id), With<Armour>>,
mut registry: ResMut<EntityRegistry>,
) {
for (player, name, id, is_attacker) in player_q.iter() {
@ -42,6 +44,18 @@ fn read_entities(
},
);
}
for (weapon, player, name, id) in armour_q.iter() {
let (_, _, player_id, _) = player_q.get(player.parent()).unwrap();
registry.0.insert(
weapon,
EntityInfo::Armour {
name: name.0.clone(),
owner: player_id.0,
id: id.0,
},
);
}
}
pub(crate) fn configure(stages: &mut Stages) {