Tweak parameters on bezier gun, abstract out random accuracy direction

This commit is contained in:
2021-03-16 13:56:19 +01:00
parent ca5ff88522
commit 875679d25f
6 changed files with 69 additions and 87 deletions
+16 -1
View File
@@ -32,7 +32,6 @@ withWarmUp t f cid w
| t > 0 = set (pointerToItem . wpFire) (withWarmUp (t-1) f)
$ set (pointerToItem . wpFireState) 2
w
-- | otherwise = set (pointerToItem . wpFire) (withWarmUp 0 f)
| otherwise = set (pointerToItem . wpFire) (withWarmUp 1 f)
$ over (pointerToItem . wpLoadedAmmo) (\ammo -> ammo-1)
$ set (pointerToItem . wpFireState) 2
@@ -97,6 +96,22 @@ shoot f cid w | fireCondition = over (pointerToItem . wpLoadedAmmo) (\ammo -> am
&& _wpLoadedAmmo item > 0
reloadCondition = _wpLoadedAmmo item == 0
withMuzFlare :: (Int -> World -> World) -> Int -> World -> World
withMuzFlare f cid w = over tempLightSources (tLightAt 4 pos :)
. lowLightAt pos2 $ f cid w
where cr = _creatures w IM.! cid
dir = _crDir cr
pos = _crPos cr +.+ _crRad cr *.* unitVectorAtAngle (_crDir cr)
pos2 = _crPos cr +.+ (2 * _crRad cr) *.* unitVectorAtAngle (_crDir cr)
withRandomDir :: Float -> (Int -> World -> World) -> Int -> World -> World
withRandomDir acc f cid w = over (creatures . ix cid . crDir) (\d -> d - a)
. f cid
. over (creatures . ix cid . crDir) (+ a)
$ set randGen g
w
where (a, g) = randomR (-acc,acc) $ _randGen w
withAccVelWthHiteff' :: Float -> Point2 -> Float -> HitEffect' -> Int -> World -> World
withAccVelWthHiteff' acc vel width hiteff cid w
= over particles' ((:) newbul)