Cleanup muzzle flare
This commit is contained in:
@@ -28,7 +28,7 @@ bulHitCr' bt p cr w =
|
||||
addDamageArmoured = over (creatures . ix cid . crState . crDamage)
|
||||
(\dams -> mvDams ++ dams)
|
||||
hitSound = soundMultiFrom [CrHitSound 0] 15 10 0
|
||||
flashEff = over worldEvents ((.) $ flareAt red p)
|
||||
flashEff = over worldEvents ((.) $ flareAt' red 0.02 0.05 p)
|
||||
bulVel = _btVel' bt
|
||||
ck cid = (+.+) (crKnockBack cid *.* bulVel)
|
||||
crKnockBack cid = (/) 1 $ (+) 2 $ _crMass $ _creatures w IM.! cid
|
||||
|
||||
@@ -95,7 +95,7 @@ shoot f cid w | fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> am
|
||||
|
||||
withMuzFlare :: (Int -> World -> World) -> Int -> World -> World
|
||||
withMuzFlare f cid w = over tempLightSources (tLightAt 3 pos :)
|
||||
. lowLightAt pos2 $ f cid w
|
||||
. muzFlareAt pos2 $ f cid w
|
||||
where cr = _creatures w IM.! cid
|
||||
dir = _crDir cr
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
@@ -157,32 +157,29 @@ torqueAfter torque feff cid w
|
||||
rotateScope w = w & creatures . ix 0 . crInv . ix (_crInvSel (_creatures w IM.! 0))
|
||||
. itAttachment . _Just . scopePos %~ rotateV rot
|
||||
|
||||
spreadNumVelWthHiteff' :: Float -> Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
spreadNumVelWthHiteff' spread num vel wth eff cid w
|
||||
spreadNumVelWthHiteff :: Float -> Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
spreadNumVelWthHiteff spread num vel wth eff cid w
|
||||
= over particles' (newbuls ++)
|
||||
$ flip (foldr muzFlareAt) poss
|
||||
w
|
||||
where cr = _creatures w IM.! cid
|
||||
newbuls = zipWith3 (\pos d colid -> aGenBulAt' (Just cid) (numColor colid)
|
||||
pos (rotateV d vel) eff wth
|
||||
) poss dirs colids
|
||||
pos' = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
|
||||
poss = map ((+.+) $ _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr))
|
||||
$ evalState ((sequence . take num . repeat . randInCirc) 5) $ _randGen w
|
||||
dirs = map ((+) (_crDir cr))
|
||||
$ zipWith (+) [-spread,-spread+(2*spread/(fromIntegral num))..]
|
||||
$ randomRs (0,spread/5) (_randGen w)
|
||||
-- $ randomRs (0,spreadGunSpread/5) (_randGen w)
|
||||
colids = take num $ randomRs (0,11) (_randGen w)
|
||||
|
||||
numVelWthHitEff' :: Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
numVelWthHitEff' num vel wth eff cid w
|
||||
numVelWthHitEff :: Int -> Point2 -> Float -> HitEffect -> Int -> World -> World
|
||||
numVelWthHitEff num vel wth eff cid w
|
||||
= over particles' (newbuls ++)
|
||||
$ flip (foldr muzFlareAt) (take num poss)
|
||||
w
|
||||
where cr = _creatures w IM.! cid
|
||||
newbuls = zipWith (\pos colid -> aGenBulAt' (Just cid) (numColor colid)
|
||||
pos (rotateV d vel) eff wth)
|
||||
pos (rotateV d vel) eff wth
|
||||
)
|
||||
poss colids
|
||||
d = _crDir cr
|
||||
poss = map (\o -> o +.+ pos) offsets
|
||||
@@ -190,4 +187,3 @@ numVelWthHitEff' num vel wth eff cid w
|
||||
offsets = map (\y -> rotateV d (0,y)) [-maxOffset,5-maxOffset..]
|
||||
colids = take num $ randomRs (0,11) (_randGen w)
|
||||
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle d
|
||||
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
|
||||
|
||||
Reference in New Issue
Block a user