Fix muzzle flare

This commit is contained in:
2023-05-29 16:52:29 +01:00
parent 9283ae187f
commit 02c34f99f1
3 changed files with 79 additions and 61 deletions
+5 -10
View File
@@ -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
+31 -10
View File
@@ -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