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.
This commit is contained in:
parent
7770ed0548
commit
4db3a68efe
13 changed files with 151 additions and 29 deletions
|
|
@ -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
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue