mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Changed Damage Outcome to store more data
This commit is contained in:
parent
10bbea89e2
commit
bf6c6fb33d
@ -238,7 +238,12 @@ impl Attack {
|
||||
);
|
||||
let applied_damage = -change.amount;
|
||||
accumulated_damage += applied_damage;
|
||||
emit_outcome(Outcome::Damage { pos: target.pos });
|
||||
emit_outcome(Outcome::Damage {
|
||||
pos: target.pos,
|
||||
uid: target.uid,
|
||||
amount: applied_damage,
|
||||
crit: is_crit,
|
||||
});
|
||||
if change.amount.abs() > Health::HEALTH_EPSILON {
|
||||
emit(ServerEvent::HealthChange {
|
||||
entity: target.entity,
|
||||
|
@ -60,6 +60,11 @@ pub enum Outcome {
|
||||
},
|
||||
Damage {
|
||||
pos: Vec3<f32>,
|
||||
/// The exact amount of damage delt,
|
||||
/// excluding any sources of healing
|
||||
amount: f32,
|
||||
uid: Uid,
|
||||
crit: bool,
|
||||
},
|
||||
Death {
|
||||
pos: Vec3<f32>,
|
||||
|
@ -1416,6 +1416,8 @@ impl Hud {
|
||||
&mut self.ids.player_scts,
|
||||
&mut ui_widgets.widget_id_generator(),
|
||||
);
|
||||
// TODO: Change to use Outcome
|
||||
|
||||
// Calculate total change
|
||||
// Ignores healing
|
||||
let hp_damage: f32 = floaters.iter().map(|f| f.hp_change.min(0.0)).sum();
|
||||
@ -4470,6 +4472,14 @@ impl Hud {
|
||||
timer: 1.0,
|
||||
})
|
||||
},
|
||||
Outcome::Damage {
|
||||
uid, crit, amount, ..
|
||||
} => {
|
||||
dbg!(uid);
|
||||
dbg!(crit);
|
||||
dbg!(amount);
|
||||
},
|
||||
|
||||
_ => {},
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user