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,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,

View File

@ -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);
},
_ => {},