Allow for custom reloading sounds

This commit is contained in:
2022-06-21 22:21:18 +01:00
parent 53c8be0679
commit 029b6daf8e
25 changed files with 339 additions and 219 deletions
+4 -3
View File
@@ -17,6 +17,7 @@ module Dodge.Item.Weapon.BatteryGuns
, splitBeamCombine
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Tesla
import Dodge.Beam
import Dodge.Item.Weapon.LaserPath
@@ -74,7 +75,7 @@ teslaGun :: Item
teslaGun = defaultBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [Eject 10, Insert 10 Nothing, Prime 60]
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootTeslaArc NoHammer
[ ammoCheckI
, withTempLight 1 100 (V3 0 0 1)
@@ -253,7 +254,7 @@ lasGun :: Item
lasGun = defaultAutoBatteryGun
{ _itConsumption = defaultLoadable
& laMax .~ 200
& laCycle .~ [Eject 10, Insert 10 Nothing, Prime 60]
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant shootLaser NoHammer
[ ammoCheckI
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
@@ -318,7 +319,7 @@ tractorGun :: Item
tractorGun = lasGun
{ _itConsumption = defaultLoadable
& laMax .~ 10000
& laCycle .~ [Eject 10, Insert 10 Nothing, Prime 60]
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseInstant aTractorBeam NoHammer
[ ammoCheckI
]
+5 -4
View File
@@ -10,6 +10,7 @@ module Dodge.Item.Weapon.BulletGun.Cane
, miniGunX
) where
--import Dodge.Particle.Bullet.HitEffect
import Dodge.Reloading.Action
--import Dodge.WorldEvent.HitEffect
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Data
@@ -73,7 +74,7 @@ bangCane = defaultBulletWeapon
} & itUse . useAim . aimStance .~ OneHand
& itType . iyBase .~ BANGCANE
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [Insert 10 (Just 1)]
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
bangCaneX :: Int -> Item
bangCaneX i = bangCane
{ _itUse = ruseAmmoParamsRate 6 upHammer
@@ -139,7 +140,7 @@ rifle = bangCane
& itUse . useAim . aimStance .~ TwoHandTwist
& itType . iyBase .~ RIFLE
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [Eject 5, Insert 5 Nothing,Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 5 ,loadPrime 5]
& itUse . useAim . aimWeight .~ 6
& itUse . useAim . aimRange .~ 1
-- & itUse . useAim . aimZoom .~ defaultItZoom {_itZoomFac = 1.5}
@@ -148,7 +149,7 @@ repeater :: Item
repeater = rifle
& itType . iyModules . at ModRifleMag ?~ EMPTYMODULE
& itType . iyBase .~ REPEATER
& itConsumption . laCycle .~ [Eject 5, Insert 15 Nothing,Prime 15]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 15 ,loadPrime 15]
& itConsumption . laMax .~ 15
& itDimension . dimSPic .~ (\it -> noPic $ baseRifleShape
<> makeTinClipAt 0 (V3 10 (-2) 0) it
@@ -251,7 +252,7 @@ miniGunX i = defaultAutoGun
{ _laMax = 1500
, _laLoaded = 1500
}
& laCycle .~ [Eject 40, Insert 40 Nothing,Prime 40]
& laCycle .~ [loadEject 40, loadInsert 40 ,loadPrime 40]
, _itUse = miniGunUse i
& useDelay .~ WarmUpNoDelay {_warmTime = 0,_warmMax = 100}
& useAim . aimWeight .~ 6
+3 -2
View File
@@ -7,6 +7,7 @@ module Dodge.Item.Weapon.BulletGun.Rod
, machineGun
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Particle.HitEffect
import Dodge.Particle.Damage
@@ -70,7 +71,7 @@ bangRod = defaultBulletWeapon
}
}
& itConsumption . laMax .~ 1
& itConsumption . laCycle .~ [Eject 5, Insert 10 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 5]
& itType . iyBase .~ BANGROD
& itUse . useAim . aimWeight .~ 8
& itUse . useAim . aimRange .~ 1
@@ -141,6 +142,6 @@ machineGun = bangRod
& useDelay .~ VariableRate {_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
)
& itConsumption . laMax .~ 100
& itConsumption . laCycle .~ [Eject 10, Insert 40 Nothing, Prime 10]
& itConsumption . laCycle .~ [loadEject 10, loadInsert 40 , loadPrime 10]
& itInvSize .~ 3
& itParams. torqueAfter .~ 0.2 -- not sure if this is necessary?
+4 -3
View File
@@ -8,6 +8,7 @@ module Dodge.Item.Weapon.BulletGun.Stick
, revolverX
) where
import Dodge.Item.Weapon.BulletGun.Clip
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default.Weapon
@@ -78,7 +79,7 @@ bangStick i = defaultBulletWeapon
}
& itType . iyBase .~ BANGSTICK i
& itConsumption . laMax .~ i
& itConsumption . laCycle .~ [Insert 10 (Just 1)]
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
baseStickShapeX :: Int -> Shape
baseStickShapeX i = foldMap f [0..i-1]
where
@@ -108,7 +109,7 @@ revolver = pistol
& itConsumption .~
(defaultBulletLoadable
& laMax .~ 6
& laCycle .~ [Insert 10 (Just 1)] )
& laCycle .~ [loadPartialInsert 10 1] )
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> revolverClip it)
& itType . iyBase .~ REVOLVER
@@ -157,7 +158,7 @@ pistol :: Item
pistol = bangStick 1
& itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [Eject 5, Insert 5 Nothing, Prime 5] )
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse .~ ruseAmmoParamsRate 6 upHammer (ammoHammerCheck : pistolAfterHamMods)
& itDimension . dimSPic .~ (\it -> noPic $ baseStickShape <> makeTinClipAt pi (V3 5 2 0) it)
& itParams %~
+7 -6
View File
@@ -13,6 +13,7 @@ module Dodge.Item.Weapon.BulletGuns
, module Dodge.Item.Weapon.BulletGun.Rod
) where
import Dodge.Item.Weapon.BulletGun.Stick
import Dodge.Reloading.Action
import Dodge.Item.Weapon.BulletGun.Cane
import Dodge.Item.Weapon.BulletGun.Rod
--import Dodge.Item.Weapon.BulletGun.Clip
@@ -44,7 +45,7 @@ autoGun = defaultAutoGun
{ _laMax = 30
, _laLoaded = 30
}
& laCycle .~ [Eject 30, Insert 30 Nothing, Prime 10]
& laCycle .~ [loadEject 30, loadInsert 30 , loadPrime 10]
, _itUse = ruseAmmoParamsRate 4 NoHammer
[ ammoCheckI
, charFiringStratI
@@ -131,7 +132,7 @@ bangCone = defaultBulletWeapon
}
& itType . iyBase .~ BANGCONE
& itConsumption . laMax .~ 5
& itConsumption . laCycle .~ [Eject 5, Insert 20 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 20 , loadPrime 5]
coneRandItemUpdate :: State StdGen (Item -> Item)
coneRandItemUpdate = do
wth <- state $ randomR (1,5)
@@ -159,7 +160,7 @@ blunderbuss = bangCone
}
}
& itConsumption . laMax .~ 25
& itConsumption . laCycle .~ [Eject 5, Insert 30 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 30 , loadPrime 5]
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimWeight .~ 6
& itType . iyBase .~ BLUNDERBUSS
@@ -167,7 +168,7 @@ bigBlunderbuss :: Item
bigBlunderbuss = blunderbuss
& itType . iyBase .~ BIGBLUNDERBUSS
& itConsumption . laMax .~ 50
& itConsumption . laCycle .~ [Eject 5, Insert 40 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 40 , loadPrime 5]
& itParams . recoil .~ 200
& itParams . torqueAfter .~ 0.3
& itParams . randomOffset .~ 16
@@ -175,7 +176,7 @@ biggerBlunderbuss :: Item
biggerBlunderbuss = bigBlunderbuss
& itType . iyBase .~ BIGGERBLUNDERBUSS
& itConsumption . laMax .~ 75
& itConsumption . laCycle .~ [Eject 5, Insert 50 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 50 , loadPrime 5]
& itParams . recoil .~ 250
& itParams . torqueAfter .~ 0.5
& itParams . randomOffset .~ 20
@@ -183,7 +184,7 @@ biggestBlunderbuss :: Item
biggestBlunderbuss = biggerBlunderbuss
& itType . iyBase .~ BIGGESTBLUNDERBUSS
& itConsumption . laMax .~ 100
& itConsumption . laCycle .~ [Eject 5, Insert 60 Nothing, Prime 5]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 60 , loadPrime 5]
& itParams . recoil .~ 300
& itParams . torqueAfter .~ 0.7
& itParams . randomOffset .~ 24
+2 -1
View File
@@ -5,6 +5,7 @@ module Dodge.Item.Weapon.Launcher
, fireTrackingShell
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Default
import Dodge.Default.Weapon
import Dodge.Item.Location
@@ -44,7 +45,7 @@ launcher = defaultWeapon
}
& laMax .~ 1
& laLoaded .~ 1
& laCycle .~ [Eject 30, Insert 30 Nothing, Prime 10]
& laCycle .~ [loadEject 30, loadInsert 30, loadPrime 10]
, _itUse = ruseRate 20 usePjCreation upHammer
[ hammerCheckI
, ammoCheckI
+2 -1
View File
@@ -1,5 +1,6 @@
module Dodge.Item.Weapon.SonicGuns where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Creature.HandPos
--import Dodge.Particle.TeslaArc
--import Dodge.SoundLogic.LoadSound
@@ -32,7 +33,7 @@ sonicGun :: Item
sonicGun = defaultAutoGun
{ _itConsumption = defaultLoadable
& laMax .~ 10
& laCycle .~ [Eject 10, Insert 10 Nothing, Prime 60]
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
, _itUse = ruseRate 8 aSonicWave (HasHammer HammerUp)
[ ammoHammerCheck
, useTimeCheck
+3 -2
View File
@@ -7,6 +7,7 @@ module Dodge.Item.Weapon.SprayGuns
, flameWall
) where
import Dodge.Data
import Dodge.Reloading.Action
import Dodge.Particle.Flame
--import Dodge.Data.SoundOrigin
--import Dodge.Base
@@ -68,7 +69,7 @@ flameSpitter :: Item
flameSpitter = flameThrower
& itType . iyBase .~ FLAMESPITTER
& itConsumption . laMax .~ 10
& itConsumption . laCycle .~ [Eject 5, Insert 10 Nothing, Prime 20]
& itConsumption . laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 20]
& itParams . sprayNozzles . ix 0 . nzPressure .~ 4
& itUse . useAim . aimStance .~ OneHand
& itUse . useDelay .~ FixedRate {_rateMax =12,_rateTime = 0}
@@ -122,7 +123,7 @@ flameThrower = defaultAutoGun
{_amString = "FLAME"
,_amCreateGas = aFlame
}
& laCycle .~ [Eject 5, Insert 10 Nothing, Prime 20]
& laCycle .~ [loadEject 5, loadInsert 10 , loadPrime 20]
, _itUse = ruseInstant (overNozzles useGasParams) NoHammer
[ ammoCheckI
, useAmmoAmount 1
+2 -2
View File
@@ -127,7 +127,7 @@ ammoCheckI :: ChainEffect
ammoCheckI eff item cr w
| _laLoaded (_itConsumption item) <= 0 = w -- fromMaybe w (startReloadingWeapon cr w)
-- | _reloadState (_itConsumption item) /= Nothing' = w
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crStopReloading
| otherwise = eff item cr $ w & creatures . ix (_crID cr) %~ crCancelReloading
-- combined ammo and hammer check: want to be able to auto-reload even if the
-- hammer is down?
@@ -136,7 +136,7 @@ ammoHammerCheck eff it cr w
| _laLoaded (_itConsumption it) <= 0 = w -- fromMaybe w (startReloadingWeapon cr w)
& setHammerDown
| otherwise = case it ^? itUse . useHammer . hammerPosition of
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crStopReloading
Just HammerUp -> eff it cr $ setHammerDown w & creatures . ix (_crID cr) %~ crCancelReloading
_ -> setHammerDown w
where
cid = _crID cr