From 9974129e7db3b0b1c6aa6b8f6830a52eff0817df Mon Sep 17 00:00:00 2001 From: Lerg Date: Fri, 26 Feb 2021 21:26:13 +0300 Subject: [PATCH] Issue #836 - Declutter the scrolling combat text --- voxygen/src/ecs/sys/floater.rs | 20 +++++++++++++++----- 1 file changed, 15 insertions(+), 5 deletions(-) diff --git a/voxygen/src/ecs/sys/floater.rs b/voxygen/src/ecs/sys/floater.rs index f1378b02e1..b19acf22e8 100644 --- a/voxygen/src/ecs/sys/floater.rs +++ b/voxygen/src/ecs/sys/floater.rs @@ -12,6 +12,7 @@ use specs::{Entities, Join, Read, ReadExpect, ReadStorage, System, WriteStorage} // How long floaters last (in seconds) pub const HP_SHOWTIME: f32 = 3.0; pub const MY_HP_SHOWTIME: f32 = 2.5; +pub const HP_ACCUMULATETIME: f32 = 1.0; pub struct Sys; impl<'a> System<'a> for Sys { @@ -84,11 +85,20 @@ impl<'a> System<'a> for Sys { HealthSource::Item => true, _ => false, } { - hp_floater_list.floaters.push(HpFloater { - timer: 0.0, - hp_change: health.last_change.1.amount, - rand: rand::random(), - }); + let last_floater = hp_floater_list.floaters.last_mut(); + match last_floater { + Some(f) if f.timer < HP_ACCUMULATETIME => { + //TODO: Add "jumping" animation on floater when it changes its value + f.hp_change += health.last_change.1.amount; + }, + _ => { + hp_floater_list.floaters.push(HpFloater { + timer: 0.0, + hp_change: health.last_change.1.amount, + rand: rand::random(), + }); + }, + } } } }