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
-11
View File
@@ -9,7 +9,6 @@ import Control.Lens
import Dodge.Data.Creature
import Dodge.Default
import Dodge.Item.Equipment
import Dodge.SoundLogic
import Picture
smallChaseCrit :: Creature
@@ -42,15 +41,5 @@ chaseCrit =
chaseCritVocalization :: Vocalization
chaseCritVocalization =
Vocalization
seagullChatterS
[ seagullBarkS
, seagullChatterS
, seagullChatter1S
, seagullWhistleS
, seagullWhistle1S
, seagullCryS
, seagullCry1S
, seagullCry2S
]
(50, 200)
0
+1 -1
View File
@@ -85,7 +85,7 @@ chaseCritAwarenessUpdate w cr = case _cpAttention $ _crPerception cr of
maybeBark
| becomesCognizant -- && randBool
&& cr ^? crVocalization . vcCoolDown == Just 0 =
let soundid = evalState (takeOne (_vcWarnings (_crVocalization cr))) (_randGen w)
let soundid = evalState (takeOne (crWarningSounds cr)) (_randGen w)
numjits = fst $ randomR (15, 25) (_randGen w)
in crActionPlan . apStrategy
.~ StrategyActions
+2 -1
View File
@@ -13,6 +13,7 @@ module Dodge.Creature.ReaderUpdate (
setViewPos,
) where
import Dodge.Creature.Vocalization
import Dodge.Creature.Radius
import RandomHelp
import Dodge.Creature.Perception
@@ -123,7 +124,7 @@ chaseCritMv w cr = case _apStrategy (_crActionPlan cr) of
& crActionPlan . apStrategy .~ WarningCry
where
thejitter = RandImpulseCircMove 3
soundid = evalState (takeOne (_vcWarnings (_crVocalization cr))) (_randGen w)
soundid = evalState (takeOne (crWarningSounds cr)) (_randGen w)
numjits = fst $ randomR (15, 25) (_randGen w)
_ -> case cr ^? crIntention . mvToPoint . _Just of
Just p
+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
-2
View File
@@ -43,13 +43,11 @@ data Creature = Creature
, _crHP :: Int
, _crInv :: IM.IntMap Item
, _crManipulation :: Manipulation
-- , _crInvLock :: Bool
, _crEquipment :: M.Map EquipSite Int
, _crState :: CreatureState
, _crPastDamage :: Int
, _crStance :: Stance
, _crActionPlan :: ActionPlan
-- , _crMeleeCooldown :: Int
, _crPerception :: Perception
, _crMemory :: Memory
, _crVocalization :: Vocalization
+3 -4
View File
@@ -16,7 +16,6 @@ import Data.Aeson.TH
import Dodge.Data.CamouflageStatus
import Dodge.Data.FloatFunction
import Geometry.Data
import Sound.Data
data CreatureStatistics = CreatureStatistics
{ _strength :: Int
@@ -28,9 +27,9 @@ data CreatureStatistics = CreatureStatistics
data Vocalization
= Mute
| Vocalization
{ _vcSound :: SoundID
, _vcWarnings :: [SoundID]
, _vcMaxCoolDown :: (Int, Int)
-- { _vcSound :: SoundID
-- , _vcWarnings :: [SoundID]
{ _vcMaxCoolDown :: (Int, Int)
, _vcCoolDown :: Int
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)