Add whirdown for machine pistol

This commit is contained in:
2025-06-26 02:09:22 +01:00
parent 7830b0e2c1
commit 193bc481d2
7 changed files with 277 additions and 240 deletions
Binary file not shown.
+11
View File
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
doDamage,
) where
import Dodge.Item.UseDelay
import Control.Applicative
import Control.Monad
import qualified Data.Map.Strict as M
@@ -163,9 +164,19 @@ invItemLocUpdate cr loc w = doAnyEquipmentEffect loc cr $ case itm ^. itType of
w & pointerToItem itm . itParams . wTime
%~ (max 0 . subtract 1)
HELD MACHINEPISTOL{}
| fromMaybe 0 (itm ^? itParams . wTime) >= _coolEnd (useDelay itm) ->
w & pointerToItem itm . itParams . wTime
.~ 0
| fromMaybe 0 (itm ^? itParams . wTime) >= _coolStart (useDelay itm) ->
w
& pointerToItem itm . itParams . wTime +~ 1
& soundContinue (CrWeaponSound (_crID cr) (fromIntegral $ _itID itm)) (_crPos cr) whirdownS (Just 1)
| itm ^? itParams . isWarming == Just True ->
w
& pointerToItem itm . itParams . isWarming .~ False
| fromMaybe 0 (itm ^? itParams . wTime) >= _warmStart (useDelay itm) ->
w & pointerToItem itm . itParams . wTime
.~ _coolStart (useDelay itm)
| otherwise ->
w & pointerToItem itm . itParams . wTime
.~ 0
+5 -1
View File
@@ -14,7 +14,11 @@ data ItemUseDelay -- should just be Delay
}
| WarmUpNoDelay
{ _warmMax :: Int
-- , _warmSound :: SoundID
}
| WarmUpCoolDown
{ _warmStart :: Int
, _coolStart :: Int
, _coolEnd :: Int
}
deriving (Eq, Ord, Show, Read) --Generic, Flat)
+10 -1
View File
@@ -111,6 +111,15 @@ useTimeCheck f item cr w = case useDelay $ item ^. ldtValue of
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ item ^. ldtValue . itType) (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
WarmUpNoDelay {} -> f item cr w & setwarming
WarmUpCoolDown ws _ _
| _wTime (_itParams $ _ldtValue item) < ws ->
w & setwarming
& soundContinue (CrWeaponSound cid 0) (_crPos cr) (warmupSound $ item ^. ldtValue . itType) (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
WarmUpCoolDown _ cs _
| _wTime (_itParams $ _ldtValue item) < cs -> f item cr w & setwarming
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itParams . wTime +~ 1
WarmUpCoolDown {} -> w & setwarming
NoDelay -> f item cr w
where
lastused = item ^. ldtValue . itTimeLastUsed
@@ -165,7 +174,7 @@ heldItemMuzzles = \case
& ix (i `div` 2) . mzFlareType .~ BasicFlare
& ix (i -1) . mzFlareType .~ NoLightFlare
PISTOL -> [Muzzle (V2 10 0) 0 0.05 0 BasicFlare MuzzleShootBullet (UseExactly 1)]
MACHINEPISTOL -> [Muzzle (V2 10 0) 0 0.15 0 MiniGunFlare MuzzleShootBullet (UseExactly 1)]
MACHINEPISTOL -> [Muzzle (V2 10 0) 0 0.3 0 MiniGunFlare MuzzleShootBullet (UseExactly 1)]
AUTOPISTOL -> [Muzzle (V2 10 0) 0 0 0 BasicFlare MuzzleShootBullet (UseExactly 1)]
SMG -> [Muzzle (V2 20 0) 0 0.05 0 BasicFlare MuzzleShootBullet (UseExactly 1)]
RIFLE -> dbwMuzzles & ix 0 . mzPos .~ V2 25 0
+1 -1
View File
@@ -24,7 +24,7 @@ heldUseDelay = \case
PISTOL -> FixedRate 6
AUTOPISTOL -> FixedRate 8
SMG -> FixedRate 8
MACHINEPISTOL -> WarmUpNoDelay 50
MACHINEPISTOL -> WarmUpCoolDown 50 100 200
BURSTRIFLE -> FixedRate 8 -- time last used gets updated after the last burst fire
BANGCONE -> FixedRate 20
BLUNDERBUSS -> FixedRate 20
@@ -1,4 +1,4 @@
-- generated at 2025-06-26 00:05:44.195128752 UTC
-- generated at 2025-06-26 00:25:02.708688263 UTC
module Dodge.SoundLogic.ExternallyGeneratedSounds where
import Sound.Data
soundToVol :: SoundID -> Float
@@ -130,9 +130,10 @@ soundToVol v = case _getSoundID v of
124 -> 1000
125 -> 2000
126 -> 2000
127 -> 200
128 -> 100
129 -> 200
127 -> 250
128 -> 200
129 -> 100
130 -> 200
_ -> 50
soundToOnomato :: SoundID -> String
soundToOnomato v = case _getSoundID v of
@@ -263,9 +264,10 @@ soundToOnomato v = case _getSoundID v of
124 -> "BWMP"
125 -> "BRPBRPBRP"
126 -> "WE-OH"
127 -> "THCK"
128 -> "FHP"
129 -> "QWLPH"
127 -> "WHRHH"
128 -> "THCK"
129 -> "FHP"
130 -> "QWLPH"
_ -> error "unitialised sound"
soundPathList :: [String]
soundPathList =
@@ -396,6 +398,7 @@ soundPathList =
, "sawtoothFail.BWMP.1000.wav"
, "mini.BRPBRPBRP.2000.wav"
, "seagullWhistle.WE-OH.2000.wav"
, "whirdown.WHRHH.250.wav"
, "connectItem.THCK.200.wav"
, "whiteNoiseFadeIn.FHP.100.wav"
, "gut1.QWLPH.200.wav"
@@ -654,9 +657,11 @@ miniS :: SoundID
miniS = SoundID 125
seagullWhistleS :: SoundID
seagullWhistleS = SoundID 126
whirdownS :: SoundID
whirdownS = SoundID 127
connectItemS :: SoundID
connectItemS = SoundID 127
connectItemS = SoundID 128
whiteNoiseFadeInS :: SoundID
whiteNoiseFadeInS = SoundID 128
whiteNoiseFadeInS = SoundID 129
gut1S :: SoundID
gut1S = SoundID 129
gut1S = SoundID 130
+235 -227
View File
File diff suppressed because it is too large Load Diff