blob: 90fa05315a57a2eab4c2011922947310a09525ed (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
|
module Xanthous.Entities.Environment
( Wall(..)
) where
--------------------------------------------------------------------------------
import Xanthous.Prelude
import Test.QuickCheck
import Brick (str)
import Brick.Widgets.Border.Style (unicode)
--------------------------------------------------------------------------------
import Xanthous.Entities (Draw(..), entityIs, Entity(..))
import Xanthous.Entities.Draw.Util
import Xanthous.Data
--------------------------------------------------------------------------------
data Wall = Wall
deriving stock (Show, Eq, Ord, Generic, Enum)
deriving anyclass (CoArbitrary, Function)
instance Entity Wall where
blocksVision _ = True
instance Arbitrary Wall where
arbitrary = pure Wall
instance Draw Wall where
drawWithNeighbors neighs _wall =
str . pure . borderFromEdges unicode $ wallEdges
where
wallEdges = any (entityIs @Wall) <$> edges neighs
|