Added healing healthsource logic to beam system.

This commit is contained in:
Sam 2020-09-11 13:03:25 -05:00
parent 13d9b814ab
commit 18c2b850d3
2 changed files with 5 additions and 10 deletions

View File

@ -190,13 +190,12 @@ impl<'a> System<'a> for Sys {
}
if damage.healthchange != 0.0 {
let cause = if is_heal { HealthSource::Healing { by: Some(*uid) } } else { HealthSource::Attack { by: *uid } };
server_emitter.emit(ServerEvent::Damage {
uid: *uid_b,
change: HealthChange {
amount: damage.healthchange as i32,
cause: HealthSource::Attack {
by: beam.owner.unwrap_or(*uid),
},
cause,
},
});
if is_damage && beam.lifesteal_eff > 0.0 {

View File

@ -533,15 +533,11 @@ pub fn handle_explosion(
damage.modify_damage(block, loadout);
}
if damage.healthchange < 0.0 {
if damage.healthchange != 0.0 {
let cause = if is_heal { HealthSource::Healing { by: owner } } else { HealthSource::Explosion { owner } };
stats_b.health.change_by(HealthChange {
amount: damage.healthchange as i32,
cause: HealthSource::Explosion { owner },
});
} else if damage.healthchange > 0.0 {
stats_b.health.change_by(HealthChange {
amount: damage.healthchange as i32,
cause: HealthSource::Healing { by: owner },
cause,
});
}
}