Remove some creature vocalization records

This commit is contained in:
2025-06-06 15:01:20 +01:00
parent 467f241d7a
commit e9b69be7de
7 changed files with 115 additions and 94 deletions
+38 -4
View File
@@ -1,18 +1,52 @@
module Dodge.Creature.Vocalization where
module Dodge.Creature.Vocalization (
crWarningSounds,
vocalizationTest,
resetCrVocCoolDown,
) where
import Control.Lens
import Dodge.Data.World
import Dodge.SoundLogic.ExternallyGeneratedSounds
import Sound.Data
import System.Random
crVocalizationSound :: Creature -> Maybe SoundID
crVocalizationSound cr = case cr ^. crType of
Avatar{} -> Nothing
AvatarDead -> Nothing
ChaseCrit{} -> Just seagullChatterS
SwarmCrit -> Nothing
AutoCrit -> Nothing
BarrelCrit{} -> Nothing
LampCrit{} -> Nothing
crWarningSounds :: Creature -> [SoundID]
crWarningSounds cr = case cr ^. crType of
Avatar{} -> mempty
AvatarDead -> mempty
ChaseCrit{} ->
[ seagullBarkS
, seagullChatterS
, seagullChatter1S
, seagullWhistleS
, seagullWhistle1S
, seagullCryS
, seagullCry1S
, seagullCry2S
]
SwarmCrit -> mempty
AutoCrit -> mempty
BarrelCrit{} -> mempty
LampCrit{} -> mempty
vocalizationTest :: Creature -> Maybe SoundID
vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of
Just 0 -> Just $ _vcSound $ _crVocalization cr
Just 0 -> crVocalizationSound cr
_ -> Nothing
resetCrVocCoolDown :: World -> Creature -> Creature
resetCrVocCoolDown w cr = case cr ^? crVocalization . vcMaxCoolDown of
Just (i,j) -> cr & crVocalization . vcCoolDown .~ x
Just (i, j) -> cr & crVocalization . vcCoolDown .~ x
where
x = fst $ randomR (i,j) (_randGen w)
x = fst $ randomR (i, j) (_randGen w)
Nothing -> cr