fix infinite range hook bug

This commit is contained in:
lustlion
2022-03-09 06:27:13 +01:00
parent a230d3ed06
commit 9ada88f4f5
2 changed files with 5 additions and 5 deletions

View File

@@ -44,6 +44,8 @@ function Entity:checkNearest(type,maxdistance)
local distance_y = entity.pos.y - self.pos.y
local distance = math.sqrt(distance_x ^ 2 + distance_y ^ 2)
if maxdistance == "hook_specific" then maxdistance = entity.hook_distance end
if not maxdistance or distance < maxdistance then
if shortest == -1 or distance < shortest then
shortest = distance