about summary refs log tree commit diff
path: root/src/Xanthous/Entities
diff options
context:
space:
mode:
authorGriffin Smith <root@gws.fyi>2020-05-16T22·57-0400
committerGriffin Smith <root@gws.fyi>2020-05-16T22·57-0400
commit15b4f0e6a73987f9afbc46f46862b5120029e715 (patch)
tree780f05b979e2d01f473ea6a75cb7fc9242cc0b68 /src/Xanthous/Entities
parent34cabba896507f2b6523d6aec344ec1c88e453be (diff)
Stop auto-moving if there's an enemy nearby
If at any point during an auto-move there's an enemy in the character's
line of sight, cancel the autocommand and send a message
Diffstat (limited to 'src/Xanthous/Entities')
-rw-r--r--src/Xanthous/Entities/RawTypes.hs5
1 files changed, 4 insertions, 1 deletions
diff --git a/src/Xanthous/Entities/RawTypes.hs b/src/Xanthous/Entities/RawTypes.hs
index 4b31524ad7f1..30039662f071 100644
--- a/src/Xanthous/Entities/RawTypes.hs
+++ b/src/Xanthous/Entities/RawTypes.hs
@@ -9,6 +9,7 @@ module Xanthous.Entities.RawTypes
 
     -- * Creatures
   , CreatureType(..)
+  , hostile
 
     -- * Items
   , ItemType(..)
@@ -63,6 +64,9 @@ data CreatureType = CreatureType
                        CreatureType
 makeFieldsNoPrefix ''CreatureType
 
+hostile :: Lens' CreatureType Bool
+hostile = friendly . involuted not
+
 --------------------------------------------------------------------------------
 
 data EdibleItem = EdibleItem
@@ -127,4 +131,3 @@ data EntityRaw
        via WithOptions '[ SumEnc ObjWithSingleField ]
                        EntityRaw
 makePrisms ''EntityRaw
-