Add whine to hover crit

This commit is contained in:
2026-04-03 16:31:17 +01:00
parent 1d8594dff4
commit 07006ee5b5
4 changed files with 69 additions and 38 deletions
+19 -1
View File
@@ -1,6 +1,8 @@
{-# LANGUAGE LambdaCase #-}
module Dodge.Creature.Update (updateCreature) where
import Dodge.Base.You
import Control.Monad
import Color
import qualified Data.IntMap.Strict as IM
import qualified Data.List as List
@@ -60,11 +62,27 @@ updateLivingCreature cr =
AutoCrit {} -> crUpdate cid
SwarmCrit {} -> crUpdate cid
HoverCrit {} -> \w ->
crUpdate cid . performActions cid $
crUpdate cid . performActions cid . hoverCritHoverSound cr $
over (cWorld . lWorld . creatures . ix cid) (hoverCritInternal w) w
where
cid = cr ^. crID
hoverCritHoverSound :: Creature -> World -> World
hoverCritHoverSound cr w = fromMaybe w $ do
guard $ d < 100
return $
soundContinueVol
(0.5 * (1 - 0.01 * d))
(CrSound cid)
cxy
buzz1S
(Just 2)
w
where
cxy = cr ^. crPos . _xy
d = max 0 (dist (you w ^. crPos . _xy) cxy - 100)
cid = cr ^. crID
{- | this seems to work, but I am not sure about the ordering:
previously, the movement was updated before the ai in order to correctly set the oldpos.
This should be made more sensible: should the movement side effects apply to
+9 -1
View File
@@ -7,6 +7,7 @@ module Dodge.Creature.Vocalization (
resetCrVocCoolDown,
) where
import Dodge.Material.Sound
import Control.Lens
import Dodge.Data.World
import Dodge.SoundLogic.ExternallyGeneratedSounds
@@ -46,7 +47,7 @@ crDeathSounds :: Creature -> DeathType -> [SoundID]
crDeathSounds cr dt = case cr ^. crType of
Avatar{} -> mempty
ChaseCrit{} -> defaultDeathSounds dt
HoverCrit{} -> defaultDeathSounds dt
HoverCrit{} -> metalDeathSounds dt
SwarmCrit -> mempty
AutoCrit -> mempty
BarrelCrit{} -> mempty
@@ -54,6 +55,13 @@ crDeathSounds cr dt = case cr ^. crType of
defaultDeathSounds :: DeathType -> [SoundID]
defaultDeathSounds = \case
CookDeath -> mempty
PoisonDeath -> mempty
PlainDeath -> mempty
GibsDeath -> destroyMatS Electronics
metalDeathSounds :: DeathType -> [SoundID]
metalDeathSounds = \case
CookDeath -> mempty
PoisonDeath -> mempty
PlainDeath -> mempty