From a061b97e5c541b2dc6c46184f78d5a18b35d9254 Mon Sep 17 00:00:00 2001 From: Alexander Foremny Date: Sat, 23 Mar 2024 13:59:20 +0100 Subject: fix: only players regen health --- src/server.rs | 2 +- src/shared/player.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/server.rs b/src/server.rs index f426b38..413c7fd 100644 --- a/src/server.rs +++ b/src/server.rs @@ -591,7 +591,7 @@ const HEALTH_REGEN: f32 = 5.; fn health_regen( health_regen_timer: Res, mut connection_manager: ResMut, - mut healths: Query<(&PlayerId, &mut Health, &EffectiveStats)>, + mut healths: Query<(&PlayerId, &mut Health, &EffectiveStats), With>, ) { if health_regen_timer.0.just_finished() { for (target_player, mut health, effective_stats) in healths.iter_mut() { diff --git a/src/shared/player.rs b/src/shared/player.rs index 6b21bac..d166a7d 100644 --- a/src/shared/player.rs +++ b/src/shared/player.rs @@ -1,6 +1,6 @@ -use crate::shared::faction::*; use crate::shared::activation::*; use crate::shared::buffs::*; +use crate::shared::faction::*; use crate::shared::shape::*; use crate::shared::stats::*; use crate::shared::*; @@ -19,6 +19,7 @@ pub struct PlayerBundle { activation: Activation, shape: Shape, faction: Faction, + player: Player, replicate: Replicate, } @@ -51,6 +52,7 @@ impl PlayerBundle { activation: Activation::default(), shape: Shape::player(), faction: Faction::default(), + player: Player::default(), replicate, } } @@ -64,3 +66,6 @@ pub struct PlayerPosition(pub Vec2); #[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq)] pub struct PlayerColor(pub Color); + +#[derive(Component, Message, Serialize, Deserialize, Clone, Debug, PartialEq, Default)] +pub struct Player; -- cgit v1.2.3