From 97134e265276357a05c2c4c3eb29e98169c2801c Mon Sep 17 00:00:00 2001 From: justin Date: Wed, 1 Apr 2026 16:45:35 +0100 Subject: [PATCH] Add movement on chaseCrit vocalization --- src/Dodge/Creature/ChaseCrit.hs | 2 +- src/Dodge/Creature/Picture.hs | 5 ++++- src/Dodge/Creature/Vocalization.hs | 1 + src/Dodge/Data/Creature/Misc.hs | 1 + src/Dodge/Humanoid.hs | 1 + 5 files changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Dodge/Creature/ChaseCrit.hs b/src/Dodge/Creature/ChaseCrit.hs index 2748eded0..5a56e8739 100644 --- a/src/Dodge/Creature/ChaseCrit.hs +++ b/src/Dodge/Creature/ChaseCrit.hs @@ -34,4 +34,4 @@ chaseCrit = & crStance . strideLength .~ 30 chaseCritVocalization :: Vocalization -chaseCritVocalization = Vocalization (50, 200) 0 +chaseCritVocalization = Vocalization (50, 200) 0 20 diff --git a/src/Dodge/Creature/Picture.hs b/src/Dodge/Creature/Picture.hs index 4d01d6ba7..8bd06f45c 100644 --- a/src/Dodge/Creature/Picture.hs +++ b/src/Dodge/Creature/Picture.hs @@ -74,7 +74,10 @@ chaseUpperBody cr = colorSH (_skinUpper cskin) torsoq = (V3 0 0 (10 + tz + tbob),Q.qid) mcool = 1 - min 10 (fromIntegral . _meleeCooldown $ _crType cr) / 10 neckq = torsoq `Q.comp` (V3 6 0 0,Q.axisAngle (V3 0 1 0) (-1.8*mcool)) - headq = neckq `Q.comp` (V3 16 0 0, Q.axisAngle (V3 0 1 0) (2*mcool)) + headq = neckq `Q.comp` (V3 16 0 0, Q.axisAngle (V3 0 1 0) (2*mcool+vocaltilt)) + vocaltilt = case cr ^? crVocalization . vcTimer of + Just x | x < 20 -> -pi * 0.05 * (10 - abs (fromIntegral x - 10)) + _ -> 0 sLen = _strideLength $ _crStance cr tbob = 5 * (1 - oneSmooth (abs llegpos)) llegpos = case cr ^? crStance . carriage of diff --git a/src/Dodge/Creature/Vocalization.hs b/src/Dodge/Creature/Vocalization.hs index a73ce72a6..6906fa258 100644 --- a/src/Dodge/Creature/Vocalization.hs +++ b/src/Dodge/Creature/Vocalization.hs @@ -64,6 +64,7 @@ vocalizationTest cr = case cr ^? crVocalization . vcCoolDown of 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 diff --git a/src/Dodge/Data/Creature/Misc.hs b/src/Dodge/Data/Creature/Misc.hs index 0ba63f91f..3f375eb72 100644 --- a/src/Dodge/Data/Creature/Misc.hs +++ b/src/Dodge/Data/Creature/Misc.hs @@ -20,6 +20,7 @@ data Vocalization | Vocalization { _vcMaxCoolDown :: (Int, Int) , _vcCoolDown :: Int + , _vcTimer :: Int } deriving (Eq, Ord, Show, Read) --Generic, Flat) diff --git a/src/Dodge/Humanoid.hs b/src/Dodge/Humanoid.hs index a2db5155e..49718e0d4 100644 --- a/src/Dodge/Humanoid.hs +++ b/src/Dodge/Humanoid.hs @@ -20,6 +20,7 @@ chaseCritInternal w cr = , const searchIfDamaged , const (crType . meleeCooldown %~ max 0 . subtract 1) , const (crVocalization . vcCoolDown %~ max 0 . subtract 1) + , const (crVocalization . vcTimer +~ 1) ] -- SpreadGunAI ->