Simplify vocalization
This commit is contained in:
@@ -3,7 +3,7 @@
|
||||
module Dodge.Creature.Vocalization (
|
||||
crWarningSounds,
|
||||
crDeathSounds,
|
||||
vocalizationTest,
|
||||
crVocalizationSound,
|
||||
resetCrVocCoolDown,
|
||||
) where
|
||||
|
||||
@@ -59,15 +59,9 @@ defaultDeathSounds = \case
|
||||
PlainDeath -> mempty
|
||||
GibsDeath -> [gut1S, gut2S, gut3S, gut4S, gut5S, gut6S]
|
||||
|
||||
vocalizationTest :: Creature -> Maybe SoundID
|
||||
vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of
|
||||
Just 0 -> crVocalizationSound cr
|
||||
_ -> Nothing
|
||||
crVocalResetTime :: Creature -> StdGen -> Int
|
||||
crVocalResetTime _ = fst . randomR (50,100)
|
||||
|
||||
-- this should update the randgen as well
|
||||
resetCrVocCoolDown :: World -> Creature -> Creature
|
||||
resetCrVocCoolDown w cr = case cr ^? crVocalization . vcMaxCoolDown of
|
||||
Just (i, j) -> cr & crVocalization . vcCoolDown .~ x
|
||||
& crVocalization . vcTimer .~ 0
|
||||
where
|
||||
x = fst $ randomR (i, j) (_randGen w)
|
||||
Nothing -> cr
|
||||
resetCrVocCoolDown w cr = cr & crVocalization .~ VocTimer 0 (crVocalResetTime cr (w ^. randGen))
|
||||
|
||||
Reference in New Issue
Block a user