diff options
author | Griffin Smith <root@gws.fyi> | 2020-02-08T18·42-0500 |
---|---|---|
committer | Griffin Smith <root@gws.fyi> | 2020-02-08T18·42-0500 |
commit | 782d3880c8da35b48276a874d396d24ca6dc7004 (patch) | |
tree | 600fdc2d397db39170ee8057951156928684f2e2 /src/Xanthous/Game/State.hs | |
parent | 308c7eb4f6cd1e7bb333e438bb4e6c904d9c20ee (diff) |
Block doors being closed on gormlaks
Prevent closing doors when there's a gormlak or other entity with the blocksObject attribute set to true on the same tile. There's a message sent here which is grammatically incorrect - it says "The a gormlak blocks the door" - should fix that later.
Diffstat (limited to 'src/Xanthous/Game/State.hs')
-rw-r--r-- | src/Xanthous/Game/State.hs | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/src/Xanthous/Game/State.hs b/src/Xanthous/Game/State.hs index e5ee66deac45..5c9130de386a 100644 --- a/src/Xanthous/Game/State.hs +++ b/src/Xanthous/Game/State.hs @@ -295,6 +295,7 @@ instance class Brain a where step :: Ticks -> Positioned a -> AppM (Positioned a) + -- | Does this entity ever move on its own? entityCanMove :: a -> Bool entityCanMove = const False @@ -326,6 +327,12 @@ class ( Show a, Eq a, Ord a, NFData a , Draw a, Brain a ) => Entity a where blocksVision :: a -> Bool + + -- | Does this entity block a large object from being put in the same tile as + -- it - eg a a door being closed on it + blocksObject :: a -> Bool + blocksObject = const False + description :: a -> Text entityChar :: a -> EntityChar entityCollision :: a -> Maybe Collision @@ -368,6 +375,7 @@ instance Draw SomeEntity where instance Brain SomeEntity where step ticks (Positioned p (SomeEntity ent)) = fmap SomeEntity <$> step ticks (Positioned p ent) + entityCanMove (SomeEntity ent) = entityCanMove ent downcastEntity :: forall (a :: Type). (Typeable a) => SomeEntity -> Maybe a downcastEntity (SomeEntity e) = cast e |