Move sidepush out of records
This commit is contained in:
@@ -2,6 +2,7 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Use (
|
||||
module Dodge.Data.Item.Use,
|
||||
module Dodge.Data.Item.Use.Equipment,
|
||||
@@ -75,16 +76,12 @@ data AttachParams
|
||||
data HeldParams
|
||||
= DefaultHeldParams
|
||||
| GasSprayParams
|
||||
{ --_randomOffset :: Float
|
||||
_sidePush :: Float
|
||||
, _weaponInvLock :: Int
|
||||
{ _weaponInvLock :: Int
|
||||
, _weaponRepeat :: [Int]
|
||||
}
|
||||
| BeamShooterParams
|
||||
| BulletShooterParams
|
||||
{ --_randomOffset :: Float
|
||||
_sidePush :: Float
|
||||
, _weaponInvLock :: Int
|
||||
{ _weaponInvLock :: Int
|
||||
, _weaponRepeat :: [Int]
|
||||
}
|
||||
deriving (Eq, Show, Read) --Generic, Flat)
|
||||
@@ -155,6 +152,7 @@ data Muzzle = Muzzle
|
||||
deriving (Eq, Ord, Show, Read) --Generic, Flat)
|
||||
|
||||
makeLenses ''ItemUse
|
||||
|
||||
--makeLenses ''AimParams
|
||||
makeLenses ''Muzzle
|
||||
makeLenses ''HeldParams
|
||||
@@ -175,5 +173,6 @@ deriveJSON defaultOptions ''HeldParams
|
||||
deriveJSON defaultOptions ''AmmoPerShot
|
||||
deriveJSON defaultOptions ''Muzzle
|
||||
deriveJSON defaultOptions ''AttachParams
|
||||
|
||||
--deriveJSON defaultOptions ''AimParams
|
||||
deriveJSON defaultOptions ''ItemUse
|
||||
|
||||
@@ -29,9 +29,7 @@ defaultHeldUse = UseHeld
|
||||
-- , _heldHammer = HammerUp
|
||||
, _heldMuzzles = defaultMuzzles
|
||||
, _heldParams = BulletShooterParams
|
||||
{ _sidePush = 0
|
||||
-- , _bulGunSound = Just (tap3S, 0)
|
||||
, _weaponInvLock = 0
|
||||
{ _weaponInvLock = 0
|
||||
, _weaponRepeat = []
|
||||
}
|
||||
, _heldFrame = 0
|
||||
|
||||
+45
-1
@@ -173,11 +173,55 @@ applyCME itm cr cme
|
||||
. applyRecoil itm cr
|
||||
| otherwise = failsound
|
||||
where
|
||||
spush = fromMaybe 0 $ itm ^? itUse . heldParams . sidePush
|
||||
spush = maybe 0 itemSidePush $ itm ^? itType . ibtHeld
|
||||
failsound w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||
Just 0 -> soundStart (CrWeaponFailSound (_crID cr)) (_crPos cr) click1S Nothing w
|
||||
_ -> soundContinue (CrWeaponFailSound (_crID cr)) (_crPos cr) click1S Nothing w
|
||||
|
||||
itemSidePush :: HeldItemType -> Float
|
||||
itemSidePush = \case
|
||||
BANGSTICK {} -> 0
|
||||
REWINDER -> 0
|
||||
TIMESTOPPER -> 0
|
||||
TIMESCROLLER -> 0
|
||||
PISTOL -> 50
|
||||
MACHINEPISTOL -> 50
|
||||
AUTOPISTOL -> 50
|
||||
SMG -> 30
|
||||
BANGCONE -> 0
|
||||
BLUNDERBUSS -> 0
|
||||
GRAPECANNON {} -> 0
|
||||
MINIGUNX i -> 10 + fromIntegral i
|
||||
VOLLEYGUN{} -> 0
|
||||
RIFLE -> 0
|
||||
ALTERIFLE -> 0
|
||||
AUTORIFLE -> 0
|
||||
BURSTRIFLE -> 0
|
||||
BANGROD -> 0
|
||||
ELEPHANTGUN -> 0
|
||||
AMR -> 0
|
||||
AUTOAMR -> 0
|
||||
SNIPERRIFLE -> 0
|
||||
FLAMESPITTER -> 0
|
||||
FLAMETHROWER -> 25
|
||||
FLAMETORRENT -> 0
|
||||
FLAMEWALL -> 0
|
||||
BLOWTORCH -> 0
|
||||
SPARKGUN -> 0
|
||||
TESLAGUN -> 0
|
||||
LASER -> 0
|
||||
TRACTORGUN -> 0
|
||||
RLAUNCHER -> 0
|
||||
RLAUNCHERX{} -> 0
|
||||
GLAUNCHER -> 0
|
||||
POISONSPRAYER -> 0
|
||||
SHATTERGUN -> 0
|
||||
TORCH -> 0
|
||||
FLATSHIELD -> 0
|
||||
KEYCARD{} -> 0
|
||||
BLINKER -> 0
|
||||
BLINKERUNSAFE -> 0
|
||||
|
||||
applyInvLock :: Item -> Creature -> World -> World
|
||||
applyInvLock itm cr = case itm ^? itUse . heldParams . weaponInvLock of
|
||||
Just i
|
||||
|
||||
@@ -89,7 +89,6 @@ miniGunX i =
|
||||
& itUse . heldMuzzles
|
||||
.~ replicate i
|
||||
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
|
||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||
& itType .~ HELD (MINIGUNX i)
|
||||
& itEffect . ieInv .~ ItemReduceWarmTime
|
||||
& itEffect . ieOnDrop .~ ItemSetWarmTime 0
|
||||
|
||||
@@ -19,7 +19,6 @@ poisonSprayer =
|
||||
flameThrower
|
||||
& itType .~ HELD POISONSPRAYER
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
& itUse . heldParams . sidePush .~ 0
|
||||
|
||||
flameSpitter :: Item
|
||||
flameSpitter =
|
||||
@@ -81,8 +80,6 @@ flameThrower =
|
||||
& itAmmoSlots .~ singleAmmo GasAmmo
|
||||
& itType .~ HELD FLAMETHROWER
|
||||
& itUse . heldParams .~ GasSprayParams
|
||||
{ _sidePush = 25
|
||||
-- , _bulGunSound = Nothing
|
||||
, _weaponInvLock = 0
|
||||
{ _weaponInvLock = 0
|
||||
, _weaponRepeat = mempty
|
||||
}
|
||||
|
||||
@@ -45,9 +45,6 @@ pistol =
|
||||
& itUse . heldMuzzles . ix 0 . mzPos %~ const (V2 10 0)
|
||||
& itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
|
||||
& itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
|
||||
& itUse . heldParams
|
||||
%~ ( (sidePush .~ 50)
|
||||
)
|
||||
& itType .~ HELD PISTOL
|
||||
|
||||
autoPistol :: Item
|
||||
@@ -58,12 +55,10 @@ machinePistol =
|
||||
autoPistol
|
||||
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
||||
& itType .~ HELD MACHINEPISTOL
|
||||
-- & itUse . heldParams . recoil .~ 20
|
||||
|
||||
smg :: Item
|
||||
smg =
|
||||
autoPistol -- & some parameter affecting stability
|
||||
autoPistol
|
||||
& itType .~ HELD SMG
|
||||
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
|
||||
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
|
||||
& itUse . heldParams . sidePush .~ 30
|
||||
|
||||
Reference in New Issue
Block a user