From 93d3ce18b44bb88776eb8a3d647ca6060f77b411 Mon Sep 17 00:00:00 2001 From: socksonme Date: Fri, 21 Jan 2022 09:39:31 +0200 Subject: [PATCH] Remove dbgs and temporary? 0.0 damage fix --- common/src/combat.rs | 22 +++++++++++----------- voxygen/src/hud/mod.rs | 13 ------------- 2 files changed, 11 insertions(+), 24 deletions(-) diff --git a/common/src/combat.rs b/common/src/combat.rs index 1fdaa96d64..0abaa947e8 100644 --- a/common/src/combat.rs +++ b/common/src/combat.rs @@ -238,17 +238,17 @@ impl Attack { ); let applied_damage = -change.amount; accumulated_damage += applied_damage; - // TODO: Check this out later - // if applied_damage > 0.0 { - // - // } - emit_outcome(Outcome::Damage { - pos: target.pos, - target: target.uid, - by: attacker.map(|a| a.uid), - amount: applied_damage, - crit: is_crit, - }); + + // Could also check this when handling outcomes and display 0.0 damage differently? + if applied_damage != 0.0 { + emit_outcome(Outcome::Damage { + pos: target.pos, + target: target.uid, + by: attacker.map(|a| a.uid), + amount: applied_damage, + crit: is_crit, + }); + } if change.amount.abs() > Health::HEALTH_EPSILON { emit(ServerEvent::HealthChange { entity: target.entity, diff --git a/voxygen/src/hud/mod.rs b/voxygen/src/hud/mod.rs index 5555a9318c..5cdb44d6ae 100644 --- a/voxygen/src/hud/mod.rs +++ b/voxygen/src/hud/mod.rs @@ -1425,13 +1425,10 @@ impl Hud { // Calculate total change // Ignores healing let hp_damage: f32 = floaters.iter().map(|f| f.hp_change.min(0.0)).sum(); - dbg!(hp_damage); // .fold(0.0, |acc, f| f.hp_change.min(0.0) + acc); let hp_dmg_rounded_abs = hp_damage.round().abs() as u32; - dbg!(hp_dmg_rounded_abs); let max_hp_frac = hp_damage.abs() as f32 / health.maximum() as f32; - dbg!(max_hp_frac); let timer = floaters .last() .expect("There must be at least one floater") @@ -1489,7 +1486,6 @@ impl Hud { &mut ui_widgets.widget_id_generator(), ); let max_hp_frac = floater.hp_change.abs() as f32 / health.maximum() as f32; - dbg!(max_hp_frac); // Increase font size based on fraction of maximum health // "flashes" by having a larger size in the first 100ms let font_size = 30 @@ -4522,19 +4518,10 @@ impl Hud { }); }, } - } else { - dbg!("not by player/hit player"); } - } else { - dbg!("no floater list"); } - } else { - dbg!("no entity from target uid"); } - dbg!(target); - dbg!(crit); - dbg!(amount); }, _ => {},