Continue weapon effect chain work
Start work on using muzzles to determine the effect of the ammo when loaded
This commit is contained in:
@@ -1,8 +1,9 @@
|
||||
module Dodge.Item.Held.BatteryGuns where
|
||||
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Dodge.Default.Item
|
||||
import Dodge.Base
|
||||
import Dodge.Data.Beam
|
||||
import Dodge.Default.Item
|
||||
import Color
|
||||
import Control.Lens
|
||||
import qualified Data.Map.Strict as M
|
||||
@@ -30,13 +31,19 @@ teslaGun =
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimStance .~ TwoHandFlat
|
||||
-- & itUse . heldAim . aimMuzPos .~ 4
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 DefaultFlareType]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 4 0) 0 0 0 DefaultFlareType MuzzleTesla]
|
||||
& itType . iyBase .~ HELD TESLAGUN
|
||||
|
||||
lasGun :: Item
|
||||
lasGun =
|
||||
defaultAutoBatteryGun
|
||||
defaultHeldItem
|
||||
& itType . iyModules .~ batteryModules
|
||||
& itUse . heldMods .~ PistolMod
|
||||
& itUse . heldParams .~ BeamShooterParams (tone440sawtoothquietS,2)
|
||||
& itUse . heldAmmoTypes .~ singleAmmo ElectricalAmmo
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 LasGunFlare MuzzleLaser]
|
||||
& itParams
|
||||
.~ Refracting
|
||||
{ _phaseV = 1
|
||||
@@ -52,14 +59,11 @@ lasGun =
|
||||
& itDimension . dimRad .~ 10
|
||||
& itDimension . dimCenter .~ V3 15 0 0
|
||||
-- & itUse . heldUse .~ HeldLaser --shootLaser
|
||||
& itUse . heldDelay .~ NoDelay
|
||||
& itUse . heldMods .~ LasMod
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
-- & itUse . heldAim . aimMuzPos .~ 30
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType]
|
||||
& itType . iyBase .~ HELD LASGUN
|
||||
|
||||
lasGunTweak :: TweakParam
|
||||
@@ -84,7 +88,7 @@ tractorGun =
|
||||
& itUse . heldMods .~ TractorMod
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleTractor]
|
||||
& itType . iyBase .~ HELD TRACTORGUN
|
||||
|
||||
tractorGunTweak :: TweakParam
|
||||
@@ -102,7 +106,8 @@ lasWide n =
|
||||
& itParams . lasColor .~ yellow
|
||||
& itParams . lasDamage .~ 2
|
||||
& itUse . heldMods .~ LasWideMod n
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType | y <- spreadFromCenter n 1]
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [Muzzle (V2 30 y) 0 0 0 DefaultFlareType MuzzleLaser | y <- spreadFromCenter n 1]
|
||||
|
||||
defaultBatteryGun :: Item
|
||||
defaultBatteryGun =
|
||||
@@ -116,11 +121,6 @@ batteryModules =
|
||||
, (ModTeleport, EMPTYMODULE)
|
||||
]
|
||||
|
||||
defaultAutoBatteryGun :: Item
|
||||
defaultAutoBatteryGun =
|
||||
defaultHeldItem
|
||||
& itType . iyModules .~ batteryModules
|
||||
|
||||
--lasCircle :: Item
|
||||
--lasCircle =
|
||||
-- lasGun
|
||||
@@ -137,7 +137,7 @@ dualBeam :: Item
|
||||
dualBeam =
|
||||
lasGun
|
||||
& itType . iyBase .~ HELD DUALBEAM
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0 0 DefaultFlareType MuzzleLaser]
|
||||
& itParams
|
||||
.~ DualBeam
|
||||
{ _phaseV = 1
|
||||
|
||||
+17
-19
@@ -6,6 +6,7 @@ module Dodge.Item.Held.Cane (
|
||||
miniGunX,
|
||||
) where
|
||||
|
||||
import Dodge.SoundLogic.ExternallyGeneratedSounds
|
||||
import Dodge.Base
|
||||
import Dodge.Data.Item
|
||||
import Dodge.Default
|
||||
@@ -27,7 +28,7 @@ defaultBangCane =
|
||||
-- & itUse . heldMods .~ BangCaneMod
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.01 0 PistolFlare MuzzleShootBullet]
|
||||
|
||||
volleyGun :: Int -> Item
|
||||
volleyGun i =
|
||||
@@ -41,9 +42,10 @@ volleyGun i =
|
||||
(ZipList [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 6]
|
||||
<*> ZipList [0..i-1]
|
||||
<*> pure PistolFlare
|
||||
<*> pure MuzzleShootBullet
|
||||
)
|
||||
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
|
||||
& itUse . heldParams . recoil .~ 10 + 5 * fromIntegral i
|
||||
& itUse . heldParams . recoil .~ 20 + 10 * fromIntegral i
|
||||
& itType . iyBase .~ HELD (VOLLEYGUN i)
|
||||
& itUse . heldAmmoTypes .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
|
||||
|
||||
@@ -55,7 +57,7 @@ rifle =
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 25 0) 0 0.01 0 PistolFlare]
|
||||
& itUse . heldAim . aimMuzzles . ix 0 . mzPos .~ V2 25 0
|
||||
& itType . iyModules . at ModHeldAttach ?~ EMPTYMODULE
|
||||
|
||||
--repeater :: Item
|
||||
@@ -84,27 +86,23 @@ burstRifle =
|
||||
& itUse . heldParams . weaponInvLock .~ 7
|
||||
& itUse . heldParams . weaponRepeat .~ [3,6]
|
||||
|
||||
miniGunUse :: Int -> ItemUse
|
||||
miniGunUse i =
|
||||
defaultHeldUse
|
||||
-- & heldUse .~ HeldUseAmmoParams
|
||||
& heldMods .~ MiniGunMod i
|
||||
& heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100}
|
||||
& heldAim . aimWeight .~ 6
|
||||
& heldAim . aimRange .~ 1
|
||||
& heldAim . aimStance .~ TwoHandUnder
|
||||
& heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& heldAmmoTypes .~ singleAmmo BeltBulletAmmo
|
||||
|
||||
miniGunX :: Int -> Item
|
||||
miniGunX i =
|
||||
autoRifle
|
||||
& itUse .~ miniGunUse i
|
||||
& itUse . heldDelay .~ WarmUpNoDelay{_warmTime = 0, _warmMax = 100, _warmSound = crankSlowS}
|
||||
& itUse . heldAim . aimWeight .~ 6
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldAmmoTypes .~ singleAmmo BeltBulletAmmo
|
||||
& itUse . heldParams . bulGunSound .~ (mini1S,2)
|
||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05 0 DefaultFlareType)
|
||||
& itUse . heldParams . recoil .~ 10
|
||||
& itUse . heldParams . torqueAfter .~ 0.01
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate i (Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet)
|
||||
& itUse . heldParams . recoil .~ 10 * fromIntegral i
|
||||
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
|
||||
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
|
||||
& itUse . heldParams . randomOffset .~ 10
|
||||
& itUse . heldParams . rifling .~ UniRandFloat 0.8 0.9
|
||||
& itInvSize .~ fromIntegral i + 1
|
||||
& itDimension . dimRad .~ 20
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
|
||||
@@ -16,13 +16,14 @@ bangCone =
|
||||
& itUse . heldDelay . rateMax .~ 20
|
||||
& itUse . heldMods .~ PistolMod
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType)
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ replicate 15 (Muzzle (V2 15 0) 0 0.5 0 DefaultFlareType MuzzleShootBullet)
|
||||
& itUse . heldParams . muzVel .~ UniRandFloat 0.5 0.8
|
||||
& itUse . heldParams . rifling .~ UniRandFloat 0.3 0.8
|
||||
& itUse . heldParams . recoil .~ 150
|
||||
& itUse . heldParams . torqueAfter .~ 0.1
|
||||
& itUse . heldParams . randomOffset .~ 12
|
||||
& itUse . heldParams . bulGunSound .~ bangEchoS
|
||||
& itUse . heldParams . bulGunSound .~ (bangEchoS,0)
|
||||
& itType . iyBase .~ HELD BANGCONE
|
||||
|
||||
blunderbuss :: Item
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
module Dodge.Item.Held.Launcher where
|
||||
|
||||
import Control.Applicative
|
||||
import Dodge.Default.Item
|
||||
--import Dodge.Reloading.Action
|
||||
import Control.Lens
|
||||
@@ -31,7 +32,7 @@ launcher =
|
||||
& itUse . heldAim . aimStance .~ TwoHandOver
|
||||
-- & itUse . heldAim . aimHandlePos .~ V2 3 0
|
||||
-- & itUse . heldAim . aimMuzPos .~ 20
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0 0 DefaultFlareType MuzzleLauncher]
|
||||
& itUse . heldAmmoTypes .~ singleAmmo ProjectileAmmo
|
||||
& itType . iyBase .~ HELD LAUNCHER
|
||||
& itType . iyModules . at ModLauncherHoming ?~ EMPTYMODULE
|
||||
@@ -42,7 +43,12 @@ launcherX i =
|
||||
& itType . iyBase .~ HELD (LAUNCHERX i)
|
||||
-- & itUse . heldUse .~ HeldPJCreationX i
|
||||
& itUse . heldMods .~ LauncherXMod i
|
||||
& itUse . heldAim . aimMuzzles .~ ([Muzzle (V2 20 0) a 0 | a <- angles] <*> [0..] <*> [DefaultFlareType])
|
||||
& itUse . heldAim . aimMuzzles .~ getZipList
|
||||
(ZipList [Muzzle (V2 20 0) a 0 | a <- angles]
|
||||
<*> ZipList [0..]
|
||||
<*> pure DefaultFlareType
|
||||
<*> pure MuzzleLauncher
|
||||
)
|
||||
where
|
||||
angles = take i [0,2*pi/ fromIntegral i ..]
|
||||
--angles = take i [1,2 ..]
|
||||
|
||||
@@ -21,7 +21,7 @@ bangRod =
|
||||
& itUse . heldParams . rifling .~ ConstFloat 1
|
||||
& itUse . heldParams . recoil .~ 50
|
||||
& itUse . heldParams . torqueAfter .~ 0.3
|
||||
& itUse . heldParams . bulGunSound .~ bangEchoS
|
||||
& itUse . heldParams . bulGunSound .~ (bangEchoS,0)
|
||||
& itUse . heldDelay . rateMax .~ 12
|
||||
& itDimension . dimRad .~ 12
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
@@ -31,7 +31,7 @@ bangRod =
|
||||
& itUse . heldAim . aimStance .~ OneHand
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
-- & itUse . heldAim . aimHandlePos .~ 5
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 30 0) 0 0.1 0 HeavySmokeFlare MuzzleShootBullet]
|
||||
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
|
||||
|
||||
elephantGun :: Item
|
||||
@@ -63,12 +63,14 @@ machineGun :: Item
|
||||
machineGun =
|
||||
bangRod
|
||||
& itType . iyBase .~ HELD MACHINEGUN
|
||||
& itUse . heldDelay . rateMax .~ 25
|
||||
& itUse . heldMods .~ MachineGunMod
|
||||
-- & itUse . heldMods .~ MachineGunMod
|
||||
& itUse . heldMods .~ PistolMod
|
||||
& itUse . heldAim . aimWeight .~ 8
|
||||
& itUse . heldAim . aimRange .~ 1
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
|
||||
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
& itUse . heldDelay .~ VariableRate
|
||||
{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
|
||||
& itInvSize .~ 3
|
||||
& itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
|
||||
@@ -88,7 +88,7 @@ flameThrower =
|
||||
& itUse . heldAim . aimZoom .~ defaultItZoom{_izMax = 5, _izMin = 1.5}
|
||||
& itUse . heldAim . aimStance .~ TwoHandUnder
|
||||
-- & itUse . heldAim . aimHandlePos .~ 0
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType]
|
||||
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 18 0) 0 0 0 DefaultFlareType MuzzleFlame]
|
||||
& itUse . heldAmmoTypes .~ singleAmmo GasAmmo
|
||||
& itType . iyBase .~ HELD FLAMETHROWER
|
||||
& itUse . heldParams .~ GasSprayParams CreateFlame --aGasCloud
|
||||
|
||||
@@ -27,7 +27,7 @@ bangStick i =
|
||||
-- & itUse . heldMods .~ BangStickMod
|
||||
& itUse . heldMods .~ PistolMod
|
||||
& itUse . heldAim . aimMuzzles
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType | a <- spreadAroundCenter i baseStickSpread]
|
||||
.~ [Muzzle (V2 10 0) a 0.01 0 DefaultFlareType MuzzleShootBullet | a <- spreadAroundCenter i baseStickSpread]
|
||||
|
||||
baseStickSpread :: Float
|
||||
baseStickSpread = 0.2
|
||||
@@ -55,14 +55,15 @@ autoPistol =
|
||||
pistol
|
||||
& itUse . heldMods .~ PistolMod
|
||||
& itUse . heldTriggerType .~ AutoTrigger
|
||||
& itUse . heldParams . bulGunSound .~ tap1S
|
||||
& itUse . heldParams . bulGunSound .~ (tap1S,0)
|
||||
& itType . iyBase .~ HELD AUTOPISTOL
|
||||
& itType . iyModules . at ModAutoMag ?~ EMPTYMODULE
|
||||
|
||||
machinePistol :: Item
|
||||
machinePistol =
|
||||
autoPistol
|
||||
& itUse . heldDelay . rateMax .~ 2
|
||||
& itUse . heldDelay .~ WarmUpNoDelay {_warmTime = 0, _warmMax = 50, _warmSound = crankSlowS}
|
||||
--rateMax .~ 2
|
||||
& itUse . heldMods .~ PistolMod -- (ammoCheckI : machinePistolAfterHamMods)
|
||||
& itType . iyBase .~ HELD MACHINEPISTOL
|
||||
& itType . iyModules . at ModAutoMag .~ Nothing
|
||||
|
||||
@@ -214,7 +214,7 @@ withWarmUp soundID f item cr w
|
||||
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
|
||||
| otherwise =
|
||||
w
|
||||
& pointertoitem . itUse . heldDelay . warmTime .~ maxWarmUp
|
||||
& pointertoitem . itUse . heldDelay . warmTime .~ (maxWarmUp + 1)
|
||||
& f item cr
|
||||
where
|
||||
item' = _ldtValue item
|
||||
@@ -376,8 +376,15 @@ useAmmoAmount amAmount eff item cr = fromMaybe id $ do
|
||||
Applies a world effect after an item use cooldown check.
|
||||
-}
|
||||
useTimeCheck :: ChainEffect
|
||||
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay . rateTime of
|
||||
Just 0 -> f item cr $ setUseTime w
|
||||
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
|
||||
Just (FixedRate _ 0) -> f item cr $ setUseTime w
|
||||
Just (FixedRate _ _) -> w
|
||||
Just (WarmUpNoDelay wt wm ws) | wt < wm -> w
|
||||
& soundContinue (CrWeaponSound cid 0) (_crPos cr) ws (Just 2)
|
||||
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime +~2
|
||||
Just (WarmUpNoDelay _ wm _) -> f item cr w
|
||||
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime .~ (wm+1)
|
||||
Just NoDelay -> f item cr w
|
||||
_ -> w
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
Reference in New Issue
Block a user