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
|
becomesCognizant = any isCognizant $ IM.unionWith cogRaised oldAwareness newAwareness
|
||||||
randBool = takeOne [False,True] & evalState $ _randGen w
|
randBool = takeOne [False,True] & evalState $ _randGen w
|
||||||
maybeBark
|
maybeBark
|
||||||
| becomesCognizant && randBool =
|
| becomesCognizant && randBool = case vocalizationTest cr of
|
||||||
crActionPlan . crStrategy .~ StrategyActions WarningCry
|
Just soundid -> crActionPlan . crStrategy .~ StrategyActions WarningCry
|
||||||
[DoImpulses [Bark $ fromJust $ vocalizationTest cr]
|
[DoImpulses [Bark soundid]
|
||||||
`DoActionThen` 20
|
`DoActionThen` 20
|
||||||
`WaitThen` DoImpulses [ChangeStrategy $ CloseToMelee 0]
|
`WaitThen` DoImpulses [ChangeStrategy $ CloseToMelee 0]
|
||||||
, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
, AimAt 0 (_crPos $ _creatures w IM.! 0)
|
||||||
]
|
]
|
||||||
|
Nothing -> id
|
||||||
| otherwise = id
|
| otherwise = id
|
||||||
|
|
||||||
cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
|
cogRaised :: AwarenessLevel -> AwarenessLevel -> AwarenessLevel
|
||||||
|
|||||||
Reference in New Issue
Block a user