Fix empty bark crash
This commit is contained in:
@@ -65,13 +65,14 @@ chaseCritAwarenessUpdate w cr = case _crAttentionDir $ _crPerception cr of
|
||||
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
|
||||
randBool = takeOne [False,True] & evalState $ _randGen w
|
||||
maybeBark
|
||||
| becomesCognizant && randBool =
|
||||
crActionPlan . crStrategy .~ StrategyActions WarningCry
|
||||
[DoImpulses [Bark $ fromJust $ vocalizationTest cr]
|
||||
| becomesCognizant && randBool = case vocalizationTest cr of
|
||||
Just soundid -> crActionPlan . crStrategy .~ StrategyActions WarningCry
|
||||
[DoImpulses [Bark soundid]
|
||||
`DoActionThen` 20
|
||||
`WaitThen` DoImpulses [ChangeStrategy $ CloseToMelee 0]
|
||||
, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
||||
]
|
||||
Nothing -> id
|
||||
| otherwise = id
|
||||
|
||||
cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
|
||||
|
||||
Reference in New Issue
Block a user