Fix bullet randomness (from eg bangCone)
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (617 modules, at 23:34:46)
|
All good (617 modules, at 09:15:30)
|
||||||
|
|||||||
+9
-7
@@ -64,7 +64,9 @@ shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected t
|
|||||||
leftitms <- itm ^? ldtLeft
|
leftitms <- itm ^? ldtLeft
|
||||||
mag <- lookup (AmmoInLink 0 atype) leftitms
|
mag <- lookup (AmmoInLink 0 atype) leftitms
|
||||||
thebullet <- mag ^? ldtValue . itUse . amagParams . ampBullet
|
thebullet <- mag ^? ldtValue . itUse . amagParams . ampBullet
|
||||||
return $ w & cWorld . lWorld . instantBullets
|
return $ w
|
||||||
|
& randGen .~ g'
|
||||||
|
& cWorld . lWorld . instantBullets
|
||||||
.:~ ( thebullet
|
.:~ ( thebullet
|
||||||
& buPos .~ _crPos cr
|
& buPos .~ _crPos cr
|
||||||
& buTrajectory %~ settrajectory
|
& buTrajectory %~ settrajectory
|
||||||
@@ -75,12 +77,12 @@ shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected t
|
|||||||
it = itm ^. ldtValue
|
it = itm ^. ldtValue
|
||||||
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
|
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
|
||||||
dir = _crDir cr
|
dir = _crDir cr
|
||||||
drag = case _rifling (_heldParams $ _itUse it) of
|
(drag,g) = case _rifling (_heldParams $ _itUse it) of
|
||||||
ConstFloat x -> x
|
ConstFloat x -> (x, _randGen w)
|
||||||
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
|
UniRandFloat x y -> randomR (x,y) $ _randGen w
|
||||||
muzvel = case _muzVel $ _heldParams $ _itUse it of
|
(muzvel,g') = case _muzVel $ _heldParams $ _itUse it of
|
||||||
ConstFloat x -> x
|
ConstFloat x -> (x,g)
|
||||||
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
|
UniRandFloat x y -> randomR (x,y) $ _randGen w
|
||||||
muzlength = aimingMuzzlePos cr it
|
muzlength = aimingMuzzlePos cr it
|
||||||
settrajectory traj = case traj of
|
settrajectory traj = case traj of
|
||||||
BasicBulletTrajectory -> BasicBulletTrajectory
|
BasicBulletTrajectory -> BasicBulletTrajectory
|
||||||
|
|||||||
@@ -478,14 +478,14 @@ makeBullet thebullet itm cr mz w =
|
|||||||
)
|
)
|
||||||
where
|
where
|
||||||
bulpos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm + V2 0 offset)
|
bulpos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm + V2 0 offset)
|
||||||
(a,g) = randomR (-inacc,inacc) $ _randGen w
|
(a,g'') = randomR (-inacc,inacc) $ _randGen w
|
||||||
inacc = _mzInaccuracy mz
|
inacc = _mzInaccuracy mz
|
||||||
drag = case _rifling (_heldParams $ _itUse itm) of
|
(drag,g') = case _rifling (_heldParams $ _itUse itm) of
|
||||||
ConstFloat x -> x
|
ConstFloat x -> (x,g'')
|
||||||
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
|
UniRandFloat x y -> randomR (x,y) g''
|
||||||
muzvel = case _muzVel $ _heldParams $ _itUse itm of
|
(muzvel,g) = case _muzVel $ _heldParams $ _itUse itm of
|
||||||
ConstFloat x -> x
|
ConstFloat x -> (x,g')
|
||||||
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
|
UniRandFloat x y -> randomR (x,y) g'
|
||||||
dir = _crDir cr + _mzRot mz + a
|
dir = _crDir cr + _mzRot mz + a
|
||||||
offset = case itm ^? itUse . heldParams . randomOffset of
|
offset = case itm ^? itUse . heldParams . randomOffset of
|
||||||
Just x | x /= 0 -> fst . randomR (-x,x) $ _randGen w
|
Just x | x /= 0 -> fst . randomR (-x,x) $ _randGen w
|
||||||
|
|||||||
Reference in New Issue
Block a user