diff options
author | Griffin Smith <root@gws.fyi> | 2019-12-01T00·55-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2019-12-01T00·55-0500 |
commit | 71b628c604556bc2d829f12980db99c9a526ec84 (patch) | |
tree | 2bd0b27810139c2fcf19813c0cf3f31100d5008f /src/Xanthous/Game/Lenses.hs | |
parent | 4431d453f61e88383aba40c8db3c4afb3c828b2e (diff) |
Add messages on the ground
Add support for a "GroundMessage" entity type, support for a Read command to read them, and randomly place an initial, tone-setting tutorial message on the ground near the character at the beginning of the game.
Diffstat (limited to 'src/Xanthous/Game/Lenses.hs')
-rw-r--r-- | src/Xanthous/Game/Lenses.hs | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/Xanthous/Game/Lenses.hs b/src/Xanthous/Game/Lenses.hs index 7dbd60290144..13f4b89314f7 100644 --- a/src/Xanthous/Game/Lenses.hs +++ b/src/Xanthous/Game/Lenses.hs @@ -25,7 +25,7 @@ import Xanthous.Data import qualified Xanthous.Data.EntityMap as EntityMap import Xanthous.Data.EntityMap.Graphics (visiblePositions) import Xanthous.Entities.Character (Character, mkCharacter) -import Xanthous.Entities.Environment (Door, open) +import Xanthous.Entities.Environment (Door, open, GroundMessage) import Xanthous.Entities.Item (Item) import Xanthous.Entities.Creature (Creature) import Xanthous.Entities.Entities () @@ -105,8 +105,12 @@ entityCollision -> Maybe Collision entityCollision Empty = Nothing entityCollision ents + -- TODO track entity collision in the Entity class | any (entityIs @Creature) ents = pure Combat - | all (entityIs @Item) ents = Nothing + | all (\e -> + entityIs @Item e + || entityIs @GroundMessage e + ) ents = Nothing | doors@(_ : _) <- ents ^.. folded . _SomeEntity @Door , all (view open) doors = Nothing | otherwise = pure Stop |