about summary refs log tree commit diff
path: root/src/Xanthous/Data/EntityMap/Graphics.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Xanthous/Data/EntityMap/Graphics.hs')
-rw-r--r--src/Xanthous/Data/EntityMap/Graphics.hs5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/Xanthous/Data/EntityMap/Graphics.hs b/src/Xanthous/Data/EntityMap/Graphics.hs
index 3124c6a334cc..ace5ae49e804 100644
--- a/src/Xanthous/Data/EntityMap/Graphics.hs
+++ b/src/Xanthous/Data/EntityMap/Graphics.hs
@@ -4,6 +4,7 @@ module Xanthous.Data.EntityMap.Graphics
   ( visiblePositions
   , visibleEntities
   , linesOfSight
+  , canSee
   ) where
 --------------------------------------------------------------------------------
 import Xanthous.Prelude hiding (lines)
@@ -49,3 +50,7 @@ visibleEntities pos visionRadius
   . map (\(p, es) -> over _2 (Positioned p) <$> es)
   . fold
   . linesOfSight pos visionRadius
+
+canSee :: Entity e => (e -> Bool) -> Position -> Word -> EntityMap e -> Bool
+canSee match pos radius = any match . visibleEntities pos radius
+-- ^ this might be optimizable