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:
@ -25,6 +25,7 @@ pub enum HealthSource {
|
|||||||
Command,
|
Command,
|
||||||
LevelUp,
|
LevelUp,
|
||||||
Item,
|
Item,
|
||||||
|
Healing { by: Uid },
|
||||||
Unknown,
|
Unknown,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -129,7 +129,7 @@ impl<'a> System<'a> for Sys {
|
|||||||
damage.modify_damage(block, loadout);
|
damage.modify_damage(block, loadout);
|
||||||
}
|
}
|
||||||
|
|
||||||
if damage.healthchange != 0.0 {
|
if damage.healthchange < 0.0 {
|
||||||
server_emitter.emit(ServerEvent::Damage {
|
server_emitter.emit(ServerEvent::Damage {
|
||||||
uid: *uid_b,
|
uid: *uid_b,
|
||||||
change: HealthChange {
|
change: HealthChange {
|
||||||
@ -137,7 +137,16 @@ impl<'a> System<'a> for Sys {
|
|||||||
cause: HealthSource::Attack { by: *uid },
|
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 {
|
if attack.knockback != 0.0 {
|
||||||
local_emitter.emit(LocalEvent::ApplyForce {
|
local_emitter.emit(LocalEvent::ApplyForce {
|
||||||
entity: b,
|
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(_player) = state.ecs().read_storage::<Player>().get(entity) {
|
||||||
if let Some(uid) = state.ecs().read_storage::<Uid>().get(entity) {
|
if let Some(uid) = state.ecs().read_storage::<Uid>().get(entity) {
|
||||||
let kill_source = match cause {
|
let kill_source = match cause {
|
||||||
HealthSource::Attack { by } => {
|
HealthSource::Attack { by } | HealthSource::Healing { by } => {
|
||||||
// Get attacker entity
|
// Get attacker entity
|
||||||
if let Some(char_entity) = state.ecs().entity_from_uid(by.into()) {
|
if let Some(char_entity) = state.ecs().entity_from_uid(by.into()) {
|
||||||
// Check if attacker is another player or entity with stats (npc)
|
// Check if attacker is another player or entity with stats (npc)
|
||||||
|
Reference in New Issue
Block a user