From 308c7eb4f6cd1e7bb333e438bb4e6c904d9c20ee Mon Sep 17 00:00:00 2001 From: Griffin Smith Date: Sat, 25 Jan 2020 11:38:37 -0500 Subject: Add a close command Add a close command, to close doors, that works basically the same as the open command. --- src/Xanthous/Entities/Environment.hs | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'src/Xanthous/Entities/Environment.hs') 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 -- cgit 1.4.1