Add movement on chaseCrit vocalization

This commit is contained in:
2026-04-01 16:45:35 +01:00
parent c1bddbae20
commit 97134e2652
5 changed files with 8 additions and 2 deletions
+1 -1
View File
@@ -34,4 +34,4 @@ chaseCrit =
& crStance . strideLength .~ 30
chaseCritVocalization :: Vocalization
chaseCritVocalization = Vocalization (50, 200) 0
chaseCritVocalization = Vocalization (50, 200) 0 20
+4 -1
View File
@@ -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
+1
View File
@@ -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
+1
View File
@@ -20,6 +20,7 @@ data Vocalization
| Vocalization
{ _vcMaxCoolDown :: (Int, Int)
, _vcCoolDown :: Int
, _vcTimer :: Int
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+1
View File
@@ -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 ->