Fix bullet randomness (from eg bangCone)

This commit is contained in:
2024-09-17 09:20:37 +01:00
parent e8c4c8eba4
commit ecc63a70cc
3 changed files with 17 additions and 15 deletions
+9 -7
View File
@@ -64,7 +64,9 @@ shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected t
leftitms <- itm ^? ldtLeft
mag <- lookup (AmmoInLink 0 atype) leftitms
thebullet <- mag ^? ldtValue . itUse . amagParams . ampBullet
return $ w & cWorld . lWorld . instantBullets
return $ w
& randGen .~ g'
& cWorld . lWorld . instantBullets
.:~ ( thebullet
& buPos .~ _crPos cr
& buTrajectory %~ settrajectory
@@ -75,12 +77,12 @@ shootBullet itm cr w = fromMaybe (error "cannot find bullet ammo when expected t
it = itm ^. ldtValue
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
dir = _crDir cr
drag = case _rifling (_heldParams $ _itUse it) of
ConstFloat x -> x
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
muzvel = case _muzVel $ _heldParams $ _itUse it of
ConstFloat x -> x
UniRandFloat x y -> fst . randomR (x,y) $ _randGen w
(drag,g) = case _rifling (_heldParams $ _itUse it) of
ConstFloat x -> (x, _randGen w)
UniRandFloat x y -> randomR (x,y) $ _randGen w
(muzvel,g') = case _muzVel $ _heldParams $ _itUse it of
ConstFloat x -> (x,g)
UniRandFloat x y -> randomR (x,y) $ _randGen w
muzlength = aimingMuzzlePos cr it
settrajectory traj = case traj of
BasicBulletTrajectory -> BasicBulletTrajectory