Remove dbgs and temporary? 0.0 damage fix

This commit is contained in:
socksonme 2022-01-21 09:39:31 +02:00 committed by Socksonme
parent aee7888a92
commit 93d3ce18b4
2 changed files with 11 additions and 24 deletions

View File

@ -238,10 +238,9 @@ impl Attack {
); );
let applied_damage = -change.amount; let applied_damage = -change.amount;
accumulated_damage += applied_damage; accumulated_damage += applied_damage;
// TODO: Check this out later
// if applied_damage > 0.0 { // Could also check this when handling outcomes and display 0.0 damage differently?
// if applied_damage != 0.0 {
// }
emit_outcome(Outcome::Damage { emit_outcome(Outcome::Damage {
pos: target.pos, pos: target.pos,
target: target.uid, target: target.uid,
@ -249,6 +248,7 @@ impl Attack {
amount: applied_damage, amount: applied_damage,
crit: is_crit, crit: is_crit,
}); });
}
if change.amount.abs() > Health::HEALTH_EPSILON { if change.amount.abs() > Health::HEALTH_EPSILON {
emit(ServerEvent::HealthChange { emit(ServerEvent::HealthChange {
entity: target.entity, entity: target.entity,

View File

@ -1425,13 +1425,10 @@ impl Hud {
// Calculate total change // Calculate total change
// Ignores healing // Ignores healing
let hp_damage: f32 = floaters.iter().map(|f| f.hp_change.min(0.0)).sum(); 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); // .fold(0.0, |acc, f| f.hp_change.min(0.0) + acc);
let hp_dmg_rounded_abs = hp_damage.round().abs() as u32; 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; let max_hp_frac = hp_damage.abs() as f32 / health.maximum() as f32;
dbg!(max_hp_frac);
let timer = floaters let timer = floaters
.last() .last()
.expect("There must be at least one floater") .expect("There must be at least one floater")
@ -1489,7 +1486,6 @@ impl Hud {
&mut ui_widgets.widget_id_generator(), &mut ui_widgets.widget_id_generator(),
); );
let max_hp_frac = floater.hp_change.abs() as f32 / health.maximum() as f32; 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 // Increase font size based on fraction of maximum health
// "flashes" by having a larger size in the first 100ms // "flashes" by having a larger size in the first 100ms
let font_size = 30 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);
}, },
_ => {}, _ => {},