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
Binary file not shown.
+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
@@ -1,4 +1,4 @@
-- generated at 2026-04-02 23:18:41.468999125 UTC
-- generated at 2026-04-03 15:24:55.064035871 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
@@ -160,18 +160,19 @@ soundToVol v = case _getSoundID v of
154 -> 50
155 -> 500
156 -> 2000
157 -> 2000
158 -> 40
159 -> 100
157 -> 200
158 -> 2000
159 -> 40
160 -> 100
161 -> 500
162 -> 100
163 -> 1000
164 -> 100
165 -> 500
166 -> 8000
167 -> 200
168 -> 300
161 -> 100
162 -> 500
163 -> 100
164 -> 1000
165 -> 100
166 -> 500
167 -> 8000
168 -> 200
169 -> 300
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
@@ -332,18 +333,19 @@ soundToOnomato v = case _getSoundID v of
154 -> "HSSS"
155 -> "TRINKL"
156 -> "BANG"
157 -> "CHUGUGUG"
158 -> "TAPP"
159 -> "KKSQWL"
160 -> "SKWLL"
161 -> "DUDURAH"
162 -> "SKWLL"
163 -> "TRNKL"
164 -> "SLP"
165 -> "WHUAWUH"
166 -> "RINGGG"
167 -> "QWLPH"
168 -> "WRRR"
157 -> "ZMM"
158 -> "CHUGUGUG"
159 -> "TAPP"
160 -> "KKSQWL"
161 -> "SKWLL"
162 -> "DUDURAH"
163 -> "SKWLL"
164 -> "TRNKL"
165 -> "SLP"
166 -> "WHUAWUH"
167 -> "RINGGG"
168 -> "QWLPH"
169 -> "WRRR"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
@@ -504,6 +506,7 @@ soundPathList =
, "foamSprayLoop.HSSS.50.wav"
, "smallGlass1.TRINKL.500.wav"
, "bang.BANG.2000.wav"
, "buzz1.ZMM.200.wav"
, "seagullChatter.CHUGUGUG.2000.wav"
, "foot3.TAPP.40.wav"
, "bloodShort3.KKSQWL.100.wav"
@@ -831,27 +834,29 @@ smallGlass1S :: SoundID
smallGlass1S = SoundID 155
bangS :: SoundID
bangS = SoundID 156
buzz1S :: SoundID
buzz1S = SoundID 157
seagullChatterS :: SoundID
seagullChatterS = SoundID 157
seagullChatterS = SoundID 158
foot3S :: SoundID
foot3S = SoundID 158
foot3S = SoundID 159
bloodShort3S :: SoundID
bloodShort3S = SoundID 159
bloodShort3S = SoundID 160
blood4S :: SoundID
blood4S = SoundID 160
blood4S = SoundID 161
ejectS :: SoundID
ejectS = SoundID 161
ejectS = SoundID 162
bloodShort4S :: SoundID
bloodShort4S = SoundID 162
bloodShort4S = SoundID 163
metal1S :: SoundID
metal1S = SoundID 163
metal1S = SoundID 164
slapClean5S :: SoundID
slapClean5S = SoundID 164
slapClean5S = SoundID 165
warp1S :: SoundID
warp1S = SoundID 165
warp1S = SoundID 166
tinitusS :: SoundID
tinitusS = SoundID 166
tinitusS = SoundID 167
gut1S :: SoundID
gut1S = SoundID 167
gut1S = SoundID 168
fireFadeS :: SoundID
fireFadeS = SoundID 168
fireFadeS = SoundID 169