From 71b8426592c10fbca9ad509a5da1bbdb4995b55b Mon Sep 17 00:00:00 2001
From: Ygor Souza <ygor.souza@protonmail.com>
Date: Sat, 24 Apr 2021 02:35:44 +0200
Subject: [PATCH] Add basic distance check to shockwave hit test

Before checking if the entity hitbox intersects the shockwave shell, we
do a basic check that the entity is close enough to be hit, considering
its radius.

This fixes the unlimited vertical range problem, since the distance is
measured in 3D.
---
 CHANGELOG.md                    | 1 +
 common/systems/src/shockwave.rs | 1 +
 2 files changed, 2 insertions(+)

diff --git a/CHANGELOG.md b/CHANGELOG.md
index 65067d5942..31335a5a0e 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -95,6 +95,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
 - Minimap icons are now displayed in both map modes
 - Server now denies any running trades when a user exits to the character selection screen.
 - Sfx volume changes now also change the ambient sounds volume
+- Staff fire shockwave ability no longer has an unlimited vertical range
 
 ## [0.9.0] - 2021-03-20
 
diff --git a/common/systems/src/shockwave.rs b/common/systems/src/shockwave.rs
index cc1d2fa46e..fe6ab8ed48 100644
--- a/common/systems/src/shockwave.rs
+++ b/common/systems/src/shockwave.rs
@@ -164,6 +164,7 @@ impl<'a> System<'a> for Sys {
                 // Check if it is a hit
                 let hit = entity != target
                     && !health_b.is_dead
+                    && (pos_b.0 - pos.0).magnitude() < frame_end_dist + rad_b
                     // Collision shapes
                     && {
                         // TODO: write code to collide rect with the arc strip so that we can do