aboutsummaryrefslogtreecommitdiffstats
path: root/src/server.rs
diff options
context:
space:
mode:
authorLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 14:56:30 +0100
committerLibravatar Alexander Foremny <aforemny@posteo.de>2024-03-19 15:12:22 +0100
commit7b6d9242e4217c8229cb546de495cd2670b97f2d (patch)
treef65be0458aa9c56501b6028444836459292bed49 /src/server.rs
parent2d21d709901c96b05d7f0169dd9d1207436c658c (diff)
feat: render buffs in client
Diffstat (limited to 'src/server.rs')
-rw-r--r--src/server.rs34
1 files changed, 17 insertions, 17 deletions
diff --git a/src/server.rs b/src/server.rs
index 4593cfa..aa3e3dc 100644
--- a/src/server.rs
+++ b/src/server.rs
@@ -549,42 +549,42 @@ fn effective_stats(
}
fn buffs_tick(mut buffses: Query<&mut Buffs>, time: Res<Time>) {
- let dt = time.delta();
+ let dt = time.delta().as_secs_f32();
for mut buffs in buffses.iter_mut() {
- if let Some(ref mut timer) = &mut buffs.haste {
- timer.tick(dt);
+ if let Some(ref mut duration) = &mut buffs.haste {
+ *duration = (*duration - dt).max(0.);
}
- if let Some(ref mut timer) = &mut buffs.shield {
- timer.tick(dt);
+ if let Some(ref mut duration) = &mut buffs.shield {
+ *duration = (*duration - dt).max(0.);
}
- if let Some(ref mut timer) = &mut buffs.slow {
- timer.tick(dt);
+ if let Some(ref mut duration) = &mut buffs.slow {
+ *duration = (*duration - dt).max(0.);
}
- if let Some(ref mut timer) = &mut buffs.speed {
- timer.tick(dt);
+ if let Some(ref mut duration) = &mut buffs.speed {
+ *duration = (*duration - dt).max(0.);
}
}
}
fn buffs_despawn(mut buffses: Query<&mut Buffs>) {
for mut buffs in buffses.iter_mut() {
- if let Some(timer) = &buffs.haste {
- if timer.finished() {
+ if let Some(duration) = &buffs.haste {
+ if *duration <= 0. {
buffs.haste = None;
}
}
- if let Some(timer) = &buffs.shield {
- if timer.finished() {
+ if let Some(duration) = &buffs.shield {
+ if *duration <= 0. {
buffs.shield = None;
}
}
- if let Some(timer) = &buffs.slow {
- if timer.finished() {
+ if let Some(duration) = &buffs.slow {
+ if *duration <= 0. {
buffs.slow = None;
}
}
- if let Some(timer) = &buffs.speed {
- if timer.finished() {
+ if let Some(duration) = &buffs.speed {
+ if *duration <= 0. {
buffs.speed = None;
}
}