From be8a509ef2b2f9b474c6167a0d7643dfa49a4df6 Mon Sep 17 00:00:00 2001 From: Avi Weinstock Date: Fri, 7 May 2021 18:56:18 -0400 Subject: [PATCH] Make projectiles function properly if they hit a wall in the same tick as an entity. --- CHANGELOG.md | 1 + common/systems/src/projectile.rs | 9 +++++---- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index dfa0221af1..a058dcfe10 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -118,6 +118,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Burning Debuff icon is now displayed correctly. - Villagers in safezones no longer spam messages upon seeing an enemy - Wolf AI will no longer circle into walls and will instead use the power of raycasts to stop early +- Squirrels are no longer immune to arrows at some angles. ## [0.9.0] - 2021-03-20 diff --git a/common/systems/src/projectile.rs b/common/systems/src/projectile.rs index 096f0f512d..91feb7a615 100644 --- a/common/systems/src/projectile.rs +++ b/common/systems/src/projectile.rs @@ -111,10 +111,11 @@ impl<'a> System<'a> for Sys { .uid_allocator .retrieve_entity_internal(other.into()) { - if let (Some(pos), Some(dir)) = ( - read_data.positions.get(target), - Dir::from_unnormalized(vel.0), - ) { + if let (Some(pos), Some(ori)) = + (read_data.positions.get(target), orientations.get(entity)) + { + let dir = ori.look_dir(); + let owner_entity = projectile.owner.and_then(|u| { read_data.uid_allocator.retrieve_entity_internal(u.into()) });