mirror of
https://gitlab.com/veloren/veloren.git
synced 2024-08-30 18:12:32 +00:00
Do not make healing items deal damage
This commit is contained in:
parent
b0dc35aa21
commit
a9086b27a0
@ -25,6 +25,7 @@ pub enum HealthSource {
|
||||
Command,
|
||||
LevelUp,
|
||||
Item,
|
||||
Healing { by: Uid },
|
||||
Unknown,
|
||||
}
|
||||
|
||||
|
@ -129,7 +129,7 @@ impl<'a> System<'a> for Sys {
|
||||
damage.modify_damage(block, loadout);
|
||||
}
|
||||
|
||||
if damage.healthchange != 0.0 {
|
||||
if damage.healthchange < 0.0 {
|
||||
server_emitter.emit(ServerEvent::Damage {
|
||||
uid: *uid_b,
|
||||
change: HealthChange {
|
||||
@ -137,7 +137,16 @@ impl<'a> System<'a> for Sys {
|
||||
cause: HealthSource::Attack { by: *uid },
|
||||
},
|
||||
});
|
||||
} else if damage.healthchange > 0.0 {
|
||||
server_emitter.emit(ServerEvent::Damage {
|
||||
uid: *uid_b,
|
||||
change: HealthChange {
|
||||
amount: damage.healthchange as i32,
|
||||
cause: HealthSource::Healing { by: *uid },
|
||||
},
|
||||
});
|
||||
}
|
||||
|
||||
if attack.knockback != 0.0 {
|
||||
local_emitter.emit(LocalEvent::ApplyForce {
|
||||
entity: b,
|
||||
|
@ -60,7 +60,7 @@ pub fn handle_destroy(server: &mut Server, entity: EcsEntity, cause: HealthSourc
|
||||
if let Some(_player) = state.ecs().read_storage::<Player>().get(entity) {
|
||||
if let Some(uid) = state.ecs().read_storage::<Uid>().get(entity) {
|
||||
let kill_source = match cause {
|
||||
HealthSource::Attack { by } => {
|
||||
HealthSource::Attack { by } | HealthSource::Healing { by } => {
|
||||
// Get attacker entity
|
||||
if let Some(char_entity) = state.ecs().entity_from_uid(by.into()) {
|
||||
// Check if attacker is another player or entity with stats (npc)
|
||||
|
Loading…
Reference in New Issue
Block a user