diff options
author | Alexander Foremny <aforemny@posteo.de> | 2024-03-23 13:59:20 +0100 |
---|---|---|
committer | Alexander Foremny <aforemny@posteo.de> | 2024-03-23 13:59:20 +0100 |
commit | a061b97e5c541b2dc6c46184f78d5a18b35d9254 (patch) | |
tree | 321b870eb62eed7943a89334c05306e92858177b | |
parent | 12a6419eaa087f34bdde49b3f9227b3cb5575341 (diff) |
fix: only players regen health
-rw-r--r-- | src/server.rs | 2 | ||||
-rw-r--r-- | 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<HealthRegenTimer>, mut connection_manager: ResMut<ServerConnectionManager>, - mut healths: Query<(&PlayerId, &mut Health, &EffectiveStats)>, + mut healths: Query<(&PlayerId, &mut Health, &EffectiveStats), With<Player>>, ) { 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; |