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 #-} {-# LANGUAGE LambdaCase #-}
module Dodge.Creature.Update (updateCreature) where module Dodge.Creature.Update (updateCreature) where
import Dodge.Base.You
import Control.Monad
import Color import Color
import qualified Data.IntMap.Strict as IM import qualified Data.IntMap.Strict as IM
import qualified Data.List as List import qualified Data.List as List
@@ -60,11 +62,27 @@ updateLivingCreature cr =
AutoCrit {} -> crUpdate cid AutoCrit {} -> crUpdate cid
SwarmCrit {} -> crUpdate cid SwarmCrit {} -> crUpdate cid
HoverCrit {} -> \w -> HoverCrit {} -> \w ->
crUpdate cid . performActions cid $ crUpdate cid . performActions cid . hoverCritHoverSound cr $
over (cWorld . lWorld . creatures . ix cid) (hoverCritInternal w) w over (cWorld . lWorld . creatures . ix cid) (hoverCritInternal w) w
where where
cid = cr ^. crID 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: {- | 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. 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 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, resetCrVocCoolDown,
) where ) where
import Dodge.Material.Sound
import Control.Lens import Control.Lens
import Dodge.Data.World import Dodge.Data.World
import Dodge.SoundLogic.ExternallyGeneratedSounds import Dodge.SoundLogic.ExternallyGeneratedSounds
@@ -46,7 +47,7 @@ crDeathSounds :: Creature -> DeathType -> [SoundID]
crDeathSounds cr dt = case cr ^. crType of crDeathSounds cr dt = case cr ^. crType of
Avatar{} -> mempty Avatar{} -> mempty
ChaseCrit{} -> defaultDeathSounds dt ChaseCrit{} -> defaultDeathSounds dt
HoverCrit{} -> defaultDeathSounds dt HoverCrit{} -> metalDeathSounds dt
SwarmCrit -> mempty SwarmCrit -> mempty
AutoCrit -> mempty AutoCrit -> mempty
BarrelCrit{} -> mempty BarrelCrit{} -> mempty
@@ -54,6 +55,13 @@ crDeathSounds cr dt = case cr ^. crType of
defaultDeathSounds :: DeathType -> [SoundID] defaultDeathSounds :: DeathType -> [SoundID]
defaultDeathSounds = \case defaultDeathSounds = \case
CookDeath -> mempty
PoisonDeath -> mempty
PlainDeath -> mempty
GibsDeath -> destroyMatS Electronics
metalDeathSounds :: DeathType -> [SoundID]
metalDeathSounds = \case
CookDeath -> mempty CookDeath -> mempty
PoisonDeath -> mempty PoisonDeath -> mempty
PlainDeath -> 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 module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data import Sound.Data
soundToVol :: SoundID -> Float soundToVol :: SoundID -> Float
@@ -160,18 +160,19 @@ soundToVol v = case _getSoundID v of
154 -> 50 154 -> 50
155 -> 500 155 -> 500
156 -> 2000 156 -> 2000
157 -> 2000 157 -> 200
158 -> 40 158 -> 2000
159 -> 100 159 -> 40
160 -> 100 160 -> 100
161 -> 500 161 -> 100
162 -> 100 162 -> 500
163 -> 1000 163 -> 100
164 -> 100 164 -> 1000
165 -> 500 165 -> 100
166 -> 8000 166 -> 500
167 -> 200 167 -> 8000
168 -> 300 168 -> 200
169 -> 300
_ -> 50 _ -> 50
soundToOnomato :: SoundID -> String soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of soundToOnomato v = case _getSoundID v of
@@ -332,18 +333,19 @@ soundToOnomato v = case _getSoundID v of
154 -> "HSSS" 154 -> "HSSS"
155 -> "TRINKL" 155 -> "TRINKL"
156 -> "BANG" 156 -> "BANG"
157 -> "CHUGUGUG" 157 -> "ZMM"
158 -> "TAPP" 158 -> "CHUGUGUG"
159 -> "KKSQWL" 159 -> "TAPP"
160 -> "SKWLL" 160 -> "KKSQWL"
161 -> "DUDURAH" 161 -> "SKWLL"
162 -> "SKWLL" 162 -> "DUDURAH"
163 -> "TRNKL" 163 -> "SKWLL"
164 -> "SLP" 164 -> "TRNKL"
165 -> "WHUAWUH" 165 -> "SLP"
166 -> "RINGGG" 166 -> "WHUAWUH"
167 -> "QWLPH" 167 -> "RINGGG"
168 -> "WRRR" 168 -> "QWLPH"
169 -> "WRRR"
_ -> error "unitialised sound" _ -> error "unitialised sound"
soundPathList :: [String] soundPathList :: [String]
soundPathList = soundPathList =
@@ -504,6 +506,7 @@ soundPathList =
, "foamSprayLoop.HSSS.50.wav" , "foamSprayLoop.HSSS.50.wav"
, "smallGlass1.TRINKL.500.wav" , "smallGlass1.TRINKL.500.wav"
, "bang.BANG.2000.wav" , "bang.BANG.2000.wav"
, "buzz1.ZMM.200.wav"
, "seagullChatter.CHUGUGUG.2000.wav" , "seagullChatter.CHUGUGUG.2000.wav"
, "foot3.TAPP.40.wav" , "foot3.TAPP.40.wav"
, "bloodShort3.KKSQWL.100.wav" , "bloodShort3.KKSQWL.100.wav"
@@ -831,27 +834,29 @@ smallGlass1S :: SoundID
smallGlass1S = SoundID 155 smallGlass1S = SoundID 155
bangS :: SoundID bangS :: SoundID
bangS = SoundID 156 bangS = SoundID 156
buzz1S :: SoundID
buzz1S = SoundID 157
seagullChatterS :: SoundID seagullChatterS :: SoundID
seagullChatterS = SoundID 157 seagullChatterS = SoundID 158
foot3S :: SoundID foot3S :: SoundID
foot3S = SoundID 158 foot3S = SoundID 159
bloodShort3S :: SoundID bloodShort3S :: SoundID
bloodShort3S = SoundID 159 bloodShort3S = SoundID 160
blood4S :: SoundID blood4S :: SoundID
blood4S = SoundID 160 blood4S = SoundID 161
ejectS :: SoundID ejectS :: SoundID
ejectS = SoundID 161 ejectS = SoundID 162
bloodShort4S :: SoundID bloodShort4S :: SoundID
bloodShort4S = SoundID 162 bloodShort4S = SoundID 163
metal1S :: SoundID metal1S :: SoundID
metal1S = SoundID 163 metal1S = SoundID 164
slapClean5S :: SoundID slapClean5S :: SoundID
slapClean5S = SoundID 164 slapClean5S = SoundID 165
warp1S :: SoundID warp1S :: SoundID
warp1S = SoundID 165 warp1S = SoundID 166
tinitusS :: SoundID tinitusS :: SoundID
tinitusS = SoundID 166 tinitusS = SoundID 167
gut1S :: SoundID gut1S :: SoundID
gut1S = SoundID 167 gut1S = SoundID 168
fireFadeS :: SoundID fireFadeS :: SoundID
fireFadeS = SoundID 168 fireFadeS = SoundID 169