Prevent projectiles from hitting their owners

This commit is contained in:
Piotr Korgól 2020-04-06 20:35:29 +02:00
parent 32db0df208
commit 84b1abdfcb
2 changed files with 8 additions and 3 deletions

View File

@ -57,6 +57,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Overhauled icon art - Overhauled icon art
- Asset cleanup to lower client-size - Asset cleanup to lower client-size
- Rewrote the humanoid skeleton to be more ideal for attack animations - Rewrote the humanoid skeleton to be more ideal for attack animations
- Arrows can no longer hurt their owners
### Removed ### Removed

View File

@ -100,7 +100,9 @@ impl<'a> System<'a> for Sys {
for effect in projectile.hit_entity.drain(..) { for effect in projectile.hit_entity.drain(..) {
match effect { match effect {
projectile::Effect::Damage(change) => { 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) => { projectile::Effect::Knockback(knockback) => {
if let Some(entity) = if let Some(entity) =
@ -134,8 +136,10 @@ impl<'a> System<'a> for Sys {
cause: HealthSource::World, cause: HealthSource::World,
}), }),
projectile::Effect::Possess => { projectile::Effect::Possess => {
if let Some(owner) = projectile.owner { if other != projectile.owner.unwrap() {
server_emitter.emit(ServerEvent::Possess(owner.into(), other)); if let Some(owner) = projectile.owner {
server_emitter.emit(ServerEvent::Possess(owner.into(), other));
}
} }
}, },
_ => {}, _ => {},