From 76b6525c54d6c035b1e1d8b364de5847ad4bda8c Mon Sep 17 00:00:00 2001
From: Alexander Sedov <alex0player@gmail.com>
Date: Sun, 22 Feb 2015 14:22:01 +0300
Subject: [PATCH] Projectile detection was way too detective!

---
 game/modules/tome/class/Player.lua | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua
index 564350094e..4ae23b5d64 100644
--- a/game/modules/tome/class/Player.lua
+++ b/game/modules/tome/class/Player.lua
@@ -820,7 +820,7 @@ local function spotHostiles(self, actors_only)
 		-- Check for projectiles in line of sight
 		core.fov.calc_circle(self.x, self.y, game.level.map.w, game.level.map.h, self.sight or 10, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
 			local proj = game.level.map(x, y, game.level.map.PROJECTILE)
-			if not proj then return end
+			if not proj or not game.level.map.seens(x, y) then return end
 
 			-- trust ourselves but not our friends
 			if proj.src and self == proj.src then return end
@@ -836,7 +836,7 @@ local function spotHostiles(self, actors_only)
 			if tx and ty then
 				local dist_to_line = math.abs((self.x - sx) * (ty - sy) - (self.y - sy) * (tx - sx)) / core.fov.distance(sx, sy, tx, ty)
 				local our_way = ((self.x - x) * (tx - x) + (self.y - y) * (ty - y)) > 0
-				if our_way and dist_to_line < 1.5 then
+				if our_way and dist_to_line < 1.0 then
 					seen[#seen+1] = {x=x, y=y, projectile=proj, entity=proj, name=(proj.getName and proj:getName()) or proj.name}
 				end
 			end
-- 
GitLab