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/Data.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/Data.hs')
-rw-r--r-- | src/Xanthous/Data.hs | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/src/Xanthous/Data.hs b/src/Xanthous/Data.hs index 704b3c6e74c4..afba273005f8 100644 --- a/src/Xanthous/Data.hs +++ b/src/Xanthous/Data.hs @@ -135,6 +135,7 @@ data Direction where UpRight :: Direction DownLeft :: Direction DownRight :: Direction + Here :: Direction deriving stock (Show, Eq, Generic) instance Arbitrary Direction where @@ -150,6 +151,7 @@ opposite UpLeft = DownRight opposite UpRight = DownLeft opposite DownLeft = UpRight opposite DownRight = UpLeft +opposite Here = Here move :: Direction -> Position -> Position move Up = y -~ 1 @@ -160,6 +162,7 @@ move UpLeft = move Up . move Left move UpRight = move Up . move Right move DownLeft = move Down . move Left move DownRight = move Down . move Right +move Here = id asPosition :: Direction -> Position asPosition dir = move dir mempty |