diff options
author | Griffin Smith <root@gws.fyi> | 2019-09-20T17·14-0400 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-09-20T23·38-0400 |
commit | 4db3a68efec079bdb8723f377929bfa05860bdc2 (patch) | |
tree | 2ed2ef7c8b20f285703a9fb0c1e639faf70a075d /src/Xanthous/Game.hs | |
parent | 7770ed05484a8a7aae4d5d680a069a0886a145dd (diff) |
Add doors and an open command
Add a Door entity and an Open command, which necessitated supporting the direction prompt. Currently nothing actually puts doors on the map, which puts a slight damper on actually testing this out.
Diffstat (limited to 'src/Xanthous/Game.hs')
-rw-r--r-- | src/Xanthous/Game.hs | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/src/Xanthous/Game.hs b/src/Xanthous/Game.hs index 59e436edc942..68bd9e0438cc 100644 --- a/src/Xanthous/Game.hs +++ b/src/Xanthous/Game.hs @@ -46,10 +46,12 @@ import Xanthous.Data.EntityMap (EntityMap, EntityID) import qualified Xanthous.Data.EntityMap as EntityMap import Xanthous.Data.EntityMap.Graphics import Xanthous.Data (Positioned, Position(..), positioned, position) -import Xanthous.Entities (SomeEntity(..), downcastEntity, entityIs) +import Xanthous.Entities + (SomeEntity(..), downcastEntity, entityIs, _SomeEntity) import Xanthous.Entities.Character import Xanthous.Entities.Creature import Xanthous.Entities.Item +import Xanthous.Entities.Environment import Xanthous.Entities.Arbitrary () import Xanthous.Orphans () import Xanthous.Game.Prompt @@ -198,6 +200,8 @@ collisionAt pos = do if | null ents -> Nothing | any (entityIs @Creature) ents -> pure Combat | all (entityIs @Item) ents -> Nothing + | doors@(_ : _) <- ents ^.. folded . _SomeEntity @Door + , all (view open) doors -> Nothing | otherwise -> pure Stop -------------------------------------------------------------------------------- |