From 84b1abdfcb73205d9a84447ec02d5758b5d7e2a2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Piotr=20Korg=C3=B3l?= Date: Mon, 6 Apr 2020 20:35:29 +0200 Subject: [PATCH] Prevent projectiles from hitting their owners --- CHANGELOG.md | 1 + common/src/sys/projectile.rs | 10 +++++++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 3c66b44eac..89cde4526b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Overhauled icon art - Asset cleanup to lower client-size - Rewrote the humanoid skeleton to be more ideal for attack animations +- Arrows can no longer hurt their owners ### Removed diff --git a/common/src/sys/projectile.rs b/common/src/sys/projectile.rs index 0174f4299f..bf39c3ed02 100644 --- a/common/src/sys/projectile.rs +++ b/common/src/sys/projectile.rs @@ -100,7 +100,9 @@ impl<'a> System<'a> for Sys { for effect in projectile.hit_entity.drain(..) { match effect { projectile::Effect::Damage(change) => { - server_emitter.emit(ServerEvent::Damage { uid: other, change }) + if other != projectile.owner.unwrap() { + server_emitter.emit(ServerEvent::Damage { uid: other, change }); + } }, projectile::Effect::Knockback(knockback) => { if let Some(entity) = @@ -134,8 +136,10 @@ impl<'a> System<'a> for Sys { cause: HealthSource::World, }), projectile::Effect::Possess => { - if let Some(owner) = projectile.owner { - server_emitter.emit(ServerEvent::Possess(owner.into(), other)); + if other != projectile.owner.unwrap() { + if let Some(owner) = projectile.owner { + server_emitter.emit(ServerEvent::Possess(owner.into(), other)); + } } }, _ => {},