about summary refs log tree commit diff
path: root/src/Xanthous/Entities/Environment.hs
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-01-25T16·38-0500
committerGriffin Smith <root@gws.fyi>2020-01-25T16·38-0500
commit308c7eb4f6cd1e7bb333e438bb4e6c904d9c20ee (patch)
tree299e5788dd029ae9258b1af9101ba42c0e77cdc6 /src/Xanthous/Entities/Environment.hs
parent9256c976edec462af26f33317df6171045e68aa5 (diff)
Add a close command
Add a close command, to close doors, that works basically the same as
the open command.
Diffstat (limited to 'src/Xanthous/Entities/Environment.hs')
-rw-r--r--src/Xanthous/Entities/Environment.hs4
1 files changed, 4 insertions, 0 deletions
diff --git a/src/Xanthous/Entities/Environment.hs b/src/Xanthous/Entities/Environment.hs
index 993714c844c5..430ce1b7a99e 100644
--- a/src/Xanthous/Entities/Environment.hs
+++ b/src/Xanthous/Entities/Environment.hs
@@ -7,6 +7,7 @@ module Xanthous.Entities.Environment
     -- * Doors
   , Door(..)
   , open
+  , closed
   , locked
   , unlockedDoor
 
@@ -99,6 +100,9 @@ instance Entity Door where
   entityCollision door | door ^. open = Nothing
                        | otherwise = Just Stop
 
+closed :: Lens' Door Bool
+closed = open . involuted not
+
 -- | A closed, unlocked door
 unlockedDoor :: Door
 unlockedDoor = Door