Files
loop/src/Dodge/Item/Weapon/BulletGun/Stick.hs
T

178 lines
4.9 KiB
Haskell

module Dodge.Item.Weapon.BulletGun.Stick
( bangStick
, pistol
, autoPistol
, machinePistol
, smg
, revolver
, revolverX
) where
import Dodge.Reloading.Action
import Dodge.Data
import Dodge.ChainEffect
import Dodge.Default.Weapon
--import Dodge.Item.Weapon.InventoryDisplay
--import Dodge.Default
--import Dodge.Item.Attachment
--import Dodge.Item.Weapon.ExtraEffect
--import Dodge.Item.Weapon.InventoryDisplay
import Dodge.Item.Weapon.AmmoParams
--import Dodge.Item.Draw
import Dodge.Item.Weapon.TriggerType
import Dodge.SoundLogic.LoadSound
import Geometry
import Sound.Data
import LensHelp
--import Data.Maybe
--import qualified Data.Sequence as Seq
--import Control.Lens
--import Control.Monad.State
--import System.Random
bangStickSoundChoice :: Item -> SoundID
bangStickSoundChoice it
| _laLoaded (_itConsumption it) < 2 = tap3S
| otherwise = shotgunS
bangStick :: Int -> Item
bangStick i = defaultBulletWeapon
{ _itUse = ruseAmmoParams
& useDelay . rateMax .~ 8
& useMods .~
[ ammoHammerCheck
, useTimeCheck
, withSoundItemChoiceStart bangStickSoundChoice
, useAllAmmo
, withMuzFlareI
, withTorqueAfter
, spreadLoaded
-- , applyInaccuracy
, withRecoil
]
, _itParams = BulletShooter
{ _muzVel = 0.8
, _rifling = 0.8
, _bore = 2
, _gunBarrels = MultiBarrel
{_brlNum = i
,_brlSpread = SpreadBarrels baseStickSpread
,_brlInaccuracy = 0.01
}
, _recoil = 25
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0
}
, _itInvSize = fromIntegral i / 3
, _itDimension = ItemDimension
{ _dimRad = 5
, _dimCenter = V3 5 0 0
}
}
& itType . iyBase .~ HELD (BANGSTICK i)
& itUse . useAim . aimHandlePos .~ 5
& itUse . useAim . aimMuzPos .~ 10
& itConsumption . laMax .~ i
& itConsumption . laCycle .~ [loadPartialInsert 10 1]
baseStickSpread :: Float
baseStickSpread = 0.2
revolver :: Item
revolver = pistol
& itConsumption .~
(defaultBulletLoadable
& laMax .~ 6
& laCycle .~ [loadPartialInsert 10 1] )
& itType . iyBase .~ HELD REVOLVER
pistolAfterHamMods :: [ChainEffect]
pistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 50
, withMuzFlareI
]
machinePistolAfterHamMods :: [ChainEffect]
machinePistolAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap1S
, applyInaccuracy
, withTorqueAfter
, withSidePushI 50
, withRecoil
, withMuzFlareI
]
smgAfterHamMods :: [ChainEffect]
smgAfterHamMods =
[ useTimeCheck
, useAmmoAmount 1
, withSoundStart tap3S
, applyInaccuracy
, withTorqueAfter
, withRecoil
, withSidePushI 30
, withMuzFlareI
]
pistol :: Item
pistol = bangStick 1
& itConsumption .~ ( defaultBulletLoadable
& laMax .~ 15
& laCycle .~ [loadEject 5, loadInsert 5 , loadPrime 5] )
& itUse . useDelay . rateMax .~ 6
& itUse . useMods .~ (ammoHammerCheck : pistolAfterHamMods)
& itParams %~
( ( muzVel .~ 0.8 )
. ( rifling .~ 0.8 )
. ( bore .~ 2 )
. ( gunBarrels .~ SingleBarrel 0.05 )
. ( recoil .~ 10 )
. ( torqueAfter .~ 0.2 )
)
& itType . iyBase .~ HELD PISTOL
autoPistol :: Item
autoPistol = pistol
& itUse . useMods .~ (ammoCheckI : pistolAfterHamMods)
& itType . iyBase .~ HELD AUTOPISTOL
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
machinePistol :: Item
machinePistol = autoPistol
& itUse . useDelay . rateMax .~ 2
& itUse . useMods .~ (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
smg :: Item
smg = autoPistol -- & some parameter affecting stability
& itUse . useMods .~ (ammoCheckI : smgAfterHamMods)
& itType . iyBase .~ HELD SMG
& itUse . useAim . aimStance .~ TwoHandTwist
& itUse . useAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05
revolverX :: Int -> Item
revolverX i = revolver
& itUse . useDelay . rateMax .~ 8
& itUse . useMods .~
[ ammoHammerCheck
, useTimeCheck
-- rather than locking the inventory, a better solution may be to check
-- that the weapon is still in your hands in the repeated frames
, lockInvFor 10
, \f it -> repeatOnFrames (take (_laLoaded (_itConsumption it) - 1) [2,4,6,8,10]) f it
, withSoundStart tap3S
, useAmmoUpTo 1
, applyInaccuracy
, withMuzFlareI
-- , spreadLoaded
, withTorqueAfter
, withRecoil
]
& itConsumption . laMax .~ i * 6
& itType . iyBase .~ HELD (REVOLVERX i)