Fix muzzle flare
This commit is contained in:
+43
-41
@@ -1,7 +1,5 @@
|
||||
module Dodge.HeldUse where
|
||||
|
||||
import Dodge.Wall.Move
|
||||
import Dodge.Wall.ForceField
|
||||
import Color
|
||||
import Data.Maybe
|
||||
import Data.Traversable
|
||||
@@ -18,6 +16,8 @@ import Dodge.Item.Weapon.TriggerType
|
||||
import Dodge.Projectile.Create
|
||||
import Dodge.SoundLogic
|
||||
import Dodge.Tesla.Arc
|
||||
import Dodge.Wall.ForceField
|
||||
import Dodge.Wall.Move
|
||||
import Dodge.WorldEvent.Flash
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
@@ -52,8 +52,8 @@ useMod hm = case hm of
|
||||
]
|
||||
FlameThrowerMod ->
|
||||
[ withSidePushAfterI 20
|
||||
--, withTempLight 1 100 (V3 1 0 0)
|
||||
, withSidePushI 5
|
||||
, --, withTempLight 1 100 (V3 1 0 0)
|
||||
withSidePushI 5
|
||||
, useAmmoAmount 1
|
||||
, ammoCheckI
|
||||
]
|
||||
@@ -81,9 +81,12 @@ useMod hm = case hm of
|
||||
]
|
||||
LasWideMod n ->
|
||||
[ useAmmoAmount 1
|
||||
, withItem $ \it -> duplicateNumBarrels (min
|
||||
(it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
(it ^?! itParams . lasCycle `div` lasWideRate))
|
||||
, withItem $ \it ->
|
||||
duplicateNumBarrels
|
||||
( min
|
||||
(it ^?! itUse . heldConsumption . laSource . _InternalSource . iaLoaded)
|
||||
(it ^?! itParams . lasCycle `div` lasWideRate)
|
||||
)
|
||||
, withItem $ \it -> withCrPos $ flareCircleAt (_lasColor $ _itParams it) 0.8
|
||||
, withItem $ \it -> withTempLight 1 100 (xyzV4 (_lasColor $ _itParams it))
|
||||
, withSoundForI tone440sawtoothquietS 2
|
||||
@@ -114,13 +117,13 @@ useMod hm = case hm of
|
||||
]
|
||||
ShatterMod ->
|
||||
[ useAmmoAmount 1
|
||||
-- , withSoundStart tap3S
|
||||
, useTimeCheck
|
||||
, -- , withSoundStart tap3S
|
||||
useTimeCheck
|
||||
, ammoCheckI
|
||||
, blCheck
|
||||
]
|
||||
AmmoCheckMod -> [ammoCheckI]
|
||||
AmmoUseCheckMod -> [useAmmoAmount 1,useTimeCheck, ammoCheckI]
|
||||
AmmoUseCheckMod -> [useAmmoAmount 1, useTimeCheck, ammoCheckI]
|
||||
AmmoHammerTimeUseOneMod ->
|
||||
[ useAmmoAmount 1
|
||||
, useTimeCheck
|
||||
@@ -128,7 +131,7 @@ useMod hm = case hm of
|
||||
, blCheck
|
||||
]
|
||||
BangCaneMod ->
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withSmoke 1 black 20 200 5
|
||||
, withRecoil
|
||||
, duplicateLoadedBarrels
|
||||
@@ -141,7 +144,7 @@ useMod hm = case hm of
|
||||
]
|
||||
VolleyGunMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
, useAllAmmo
|
||||
@@ -152,7 +155,7 @@ useMod hm = case hm of
|
||||
]
|
||||
AutoRifleMod ->
|
||||
-- note this is the same as BangCanemMod with the first changed
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withSmoke 1 black 20 200 5
|
||||
, withRecoil
|
||||
, duplicateLoadedBarrels
|
||||
@@ -164,7 +167,7 @@ useMod hm = case hm of
|
||||
]
|
||||
BangRodMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, withThickSmokeI
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
@@ -176,7 +179,7 @@ useMod hm = case hm of
|
||||
]
|
||||
ElephantGunMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, withThickSmokeI
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
@@ -188,7 +191,7 @@ useMod hm = case hm of
|
||||
]
|
||||
AutoAmrMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, withThickSmokeI
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
@@ -198,7 +201,7 @@ useMod hm = case hm of
|
||||
, ammoCheckI -- cf ElephantGun
|
||||
]
|
||||
MachineGunMod ->
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withThinSmokeI
|
||||
, withSoundStart bangEchoS
|
||||
, rateIncAB (torqueBeforeAtLeast 0.1 0.1) withTorqueAfter
|
||||
@@ -212,7 +215,7 @@ useMod hm = case hm of
|
||||
, withSoundItemChoiceStart bangStickSoundChoice
|
||||
, duplicateLoadedBarrels
|
||||
, withTorqueAfter
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, useTimeCheck
|
||||
, ammoCheckI
|
||||
, blCheck
|
||||
@@ -220,7 +223,7 @@ useMod hm = case hm of
|
||||
PistolMod ->
|
||||
[ withSidePushI 50
|
||||
, withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, withTorqueAfter
|
||||
, duplicateLoadedBarrels
|
||||
, withSoundStart tap3S
|
||||
@@ -230,7 +233,7 @@ useMod hm = case hm of
|
||||
, blCheck
|
||||
]
|
||||
AutoPistolMod ->
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withSidePushI 50
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
@@ -241,7 +244,7 @@ useMod hm = case hm of
|
||||
, ammoCheckI
|
||||
]
|
||||
MachinePistolMod ->
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withRecoil
|
||||
, withSidePushI 50
|
||||
, withTorqueAfter
|
||||
@@ -253,7 +256,7 @@ useMod hm = case hm of
|
||||
]
|
||||
BurstRifleMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, duplicateLoadedBarrels
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
@@ -266,7 +269,7 @@ useMod hm = case hm of
|
||||
]
|
||||
BurstRifleRepeatMod ->
|
||||
[ withRecoil
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, duplicateLoadedBarrels
|
||||
, useAmmoAmount 1
|
||||
, withSoundStart tap3S
|
||||
@@ -274,23 +277,23 @@ useMod hm = case hm of
|
||||
, ammoCheckI
|
||||
]
|
||||
MiniGunMod i ->
|
||||
reverse [ trigDoAlso' (moddelay x) (modcrpos x) useAmmoParams
|
||||
| x <- map ((/ fromIntegral i) . fromIntegral) [1 .. i -1]
|
||||
]
|
||||
<>
|
||||
[ afterRecoil (fromIntegral i * 5)
|
||||
[ duplicateNumBarrels 1
|
||||
, repeatTransformed
|
||||
[ (moddelay x, modcrpos x)
|
||||
| x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
|
||||
]
|
||||
, afterRecoil (fromIntegral i * 5)
|
||||
, torqueBefore (fromIntegral i * 0.05)
|
||||
, withSidePushI (fromIntegral i * 50)
|
||||
, withSidePushI (fromIntegral i * 25)
|
||||
, withMuzFlare
|
||||
, withSmoke 1 black 20 200 5
|
||||
, useAmmoAmount i
|
||||
, withMuzFlareI
|
||||
, withSmoke 1 black 20 200 5
|
||||
--, withThinSmokeI
|
||||
, withSoundForI mini1S 2
|
||||
, withWarmUp crankSlowS
|
||||
, ammoCheckI
|
||||
]
|
||||
SmgMod ->
|
||||
[ withMuzFlareI
|
||||
[ withFlare
|
||||
, withSidePushI 30
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
@@ -303,26 +306,25 @@ useMod hm = case hm of
|
||||
RevolverXMod ->
|
||||
[ withRecoil
|
||||
, withTorqueAfter
|
||||
-- , spreadLoaded
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, duplicateLoadedBarrels
|
||||
, useAmmoUpTo 1
|
||||
, withSoundStart tap3S
|
||||
, repeatOnFrames [2, 4, 6, 8, 10] RevolverXRepeatMod
|
||||
, lockInvFor 10
|
||||
-- rather than locking the inventory, a better solution may be to check
|
||||
, lockInvFor 10
|
||||
, -- rather than locking the inventory, a better solution may be to check
|
||||
-- that the weapon is still in your hands in the repeated frames
|
||||
, useTimeCheck
|
||||
useTimeCheck
|
||||
, ammoCheckI
|
||||
, blCheck
|
||||
]
|
||||
RevolverXRepeatMod ->
|
||||
[ withRecoil
|
||||
, withTorqueAfter
|
||||
, withMuzFlareI
|
||||
, withFlare
|
||||
, duplicateLoadedBarrels
|
||||
, useAmmoUpTo 1
|
||||
, withSoundStart tap3S
|
||||
, withSoundStart tap3S
|
||||
, ammoCheckI
|
||||
]
|
||||
BangConeMod ->
|
||||
@@ -331,7 +333,7 @@ useMod hm = case hm of
|
||||
, withRandomOffset
|
||||
, duplicateLoadedBarrels
|
||||
, duplicateLoaded
|
||||
, withMuzFlareI
|
||||
, withMuzFlare
|
||||
, withRecoil
|
||||
, withTorqueAfter
|
||||
, useAllAmmo
|
||||
|
||||
@@ -110,16 +110,11 @@ miniGunX i =
|
||||
autoRifle
|
||||
& itUse .~ miniGunUse i
|
||||
& itUse . heldAim . aimTurnSpeed .~ 0.5
|
||||
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 15 0) 0 0.05)
|
||||
& itParams
|
||||
.~ BulletShooter
|
||||
{ _muzVel = 1
|
||||
, _rifling = 0.9
|
||||
, _bore = 2
|
||||
, _recoil = 10
|
||||
, _torqueAfter = 0
|
||||
, _randomOffset = 10
|
||||
}
|
||||
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05)
|
||||
-- & itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 50 0) 0 0.05)
|
||||
& itParams . recoil .~ 10
|
||||
& itParams . torqueAfter .~ 0.01
|
||||
& itParams . randomOffset .~ 10
|
||||
& itInvSize .~ fromIntegral i + 1
|
||||
& itDimension . dimRad .~ 20
|
||||
& itDimension . dimCenter .~ V3 5 0 0
|
||||
|
||||
@@ -8,12 +8,12 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
useAllAmmo,
|
||||
useAmmoUpTo,
|
||||
lockInvFor,
|
||||
withMuzFlareI,
|
||||
withFlare,
|
||||
withMuzFlare,
|
||||
withCrPos,
|
||||
withCrPosShift,
|
||||
withOldDir,
|
||||
trigDoAlso,
|
||||
trigDoAlso',
|
||||
withTempLight,
|
||||
withItem,
|
||||
withItemUpdate,
|
||||
@@ -57,6 +57,7 @@ module Dodge.Item.Weapon.TriggerType (
|
||||
ammoCheckI,
|
||||
modClock,
|
||||
blCheck,
|
||||
repeatTransformed,
|
||||
) where
|
||||
|
||||
import Dodge.Item.Location
|
||||
@@ -90,18 +91,25 @@ lockInvFor i f it cr =
|
||||
f it cr . (cWorld . lWorld . delayedEvents .:~ (i, UnlockInv (_crID cr)))
|
||||
. lockInv (_crID cr)
|
||||
|
||||
trigDoAlso' ::
|
||||
repeatTransformed ::
|
||||
[(Item -> Item,Creature -> Creature)] ->
|
||||
ChainEffect
|
||||
repeatTransformed xs f itm cr w = foldr g w xs
|
||||
where
|
||||
g (fit,fcr) = f (fit itm) (fcr cr)
|
||||
|
||||
trigDoAlso ::
|
||||
(Item -> Item) ->
|
||||
(Creature -> Creature) ->
|
||||
(Item -> Creature -> World -> World) ->
|
||||
ChainEffect
|
||||
trigDoAlso' fit fcr f g itm cr = g itm cr . f (fit itm) (fcr cr)
|
||||
trigDoAlso fit fcr f g itm cr = g itm cr . f (fit itm) (fcr cr)
|
||||
|
||||
-- Note that this uses the "base" creature and item values
|
||||
trigDoAlso ::
|
||||
(Item -> Creature -> World -> World) ->
|
||||
ChainEffect
|
||||
trigDoAlso afterEff eff item cr = afterEff item cr . eff item cr
|
||||
--trigDoAlso ::
|
||||
-- (Item -> Creature -> World -> World) ->
|
||||
-- ChainEffect
|
||||
--trigDoAlso afterEff eff item cr = afterEff item cr . eff item cr
|
||||
|
||||
withSmoke :: Int -> Point4 -> Float -> Int -> Float -> ChainEffect
|
||||
withSmoke num col rad t alt eff item cr w =
|
||||
@@ -453,8 +461,8 @@ modClock n chainEff eff it cr w
|
||||
| (w ^. cWorld . lWorld . lClock) `mod` n == 0 = chainEff eff it cr w
|
||||
| otherwise = eff it cr w
|
||||
|
||||
withMuzFlareI :: ChainEffect
|
||||
withMuzFlareI f it cr =
|
||||
withFlare :: ChainEffect
|
||||
withFlare f it cr =
|
||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||
-- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
@@ -465,6 +473,19 @@ withMuzFlareI f it cr =
|
||||
cdir = _crDir cr
|
||||
cpos = _crPos cr
|
||||
|
||||
withMuzFlare :: ChainEffect
|
||||
withMuzFlare f itm cr =
|
||||
makeTlsTimeRadColPos 2 100 (V3 1 1 0.5) (cpos `v2z` 20)
|
||||
-- . muzFlareAt (V4 5 5 0 2) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. muzFlareAt (V4 10 10 1 3) (cpos `v2z` 20) cdir
|
||||
. f itm cr
|
||||
where
|
||||
cdir = _crDir cr
|
||||
cpos = _crPos cr + rotateV (_crDir cr) (_mzPos brl + aimingWeaponZeroPos cr itm)
|
||||
brl = itm ^?! itUse . heldAim . aimMuzzles . ix 0
|
||||
|
||||
--muzzleOffset :: Creature -> Item -> Point3
|
||||
--muzzleOffset cr it = V3 (holdOffset + 5 + _aimMuzPos dimPort - _aimHandlePos dimPort) 0 0
|
||||
-- where
|
||||
|
||||
Reference in New Issue
Block a user