Fix minigun inter-frame bullet speed
This commit is contained in:
+3
-4
@@ -1,6 +1,6 @@
|
||||
module Dodge.Bullet (
|
||||
updateBullet,
|
||||
useAmmoParams,
|
||||
shootBullet,
|
||||
) where
|
||||
|
||||
import Linear
|
||||
@@ -58,8 +58,8 @@ updateBulVel bt = case _buTrajectory bt of
|
||||
|
||||
-- should be made safe?
|
||||
-- should be renamed to shootBullet or something
|
||||
useAmmoParams :: Item -> Creature -> World -> World
|
||||
useAmmoParams it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
|
||||
shootBullet :: Item -> Creature -> World -> World
|
||||
shootBullet it cr w = fromMaybe (error "cannot find bullet ammo when expected to") $ do
|
||||
invid <- it ^? itLocation . ipInvID
|
||||
thebullet <- cr ^? crInv . ix (invid + 1) . itUse . attachParams . ammoParams . ampBullet
|
||||
return $ w & cWorld . lWorld . instantBullets
|
||||
@@ -72,7 +72,6 @@ useAmmoParams it cr w = fromMaybe (error "cannot find bullet ammo when expected
|
||||
where
|
||||
sp = _crPos cr +.+ (muzlength ^?! _head . _x) *.* unitVectorAtAngle dir
|
||||
dir = _crDir cr
|
||||
bultype = _laAmmoType $ _heldConsumption $ _itUse it
|
||||
muzvel = _muzVel $ _heldParams $ _itUse it
|
||||
muzlength = aimingMuzzlePos cr it
|
||||
settrajectory traj = case traj of
|
||||
|
||||
@@ -111,6 +111,7 @@ data AmmoAttachType
|
||||
| TINMAG
|
||||
| DRUMMAG
|
||||
| BULLETBELT
|
||||
| SHELLMAG
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
|
||||
|
||||
@@ -290,7 +290,7 @@ useMod hm = case hm of
|
||||
MiniGunMod i ->
|
||||
[ duplicateNumBarrels 1
|
||||
, repeatTransformed
|
||||
[ (moddelay x, modcrpos x)
|
||||
[ (id, modcrpos x)
|
||||
| x <- map ((/ (fromIntegral i - 1)) . fromIntegral) [0 .. i -1]
|
||||
]
|
||||
, afterRecoil (fromIntegral i * 5)
|
||||
@@ -368,11 +368,11 @@ useMod hm = case hm of
|
||||
where
|
||||
p = fromMaybe (_crPos cr) $ cr ^? crTargeting . ctPos . _Just
|
||||
a = argV (mouseWorldPos (w ^. input) (w ^. wCam) -.- p)
|
||||
moddelay x = id
|
||||
--moddelay x = itUse . heldConsumption . laAmmoType . amBullet . buDelayFraction .~ x
|
||||
modcrpos x cr =
|
||||
cr & crDir %~ tweenAngles x (_crOldDir cr)
|
||||
modcrpos x cr = fromMaybe cr $ do
|
||||
invid <- cr ^? crManipulation . manObject . inInventory . ispItem
|
||||
return $ cr & crDir %~ tweenAngles x (_crOldDir cr)
|
||||
& crPos %~ alongSegBy x (_crOldPos cr)
|
||||
& crInv . ix (invid + 1) . itUse . attachParams . ammoParams . ampBullet . buDelayFraction .~ x
|
||||
|
||||
lasWideRate :: Int
|
||||
lasWideRate = 2
|
||||
@@ -385,7 +385,7 @@ mcUseHeld hit = case hit of
|
||||
useHeld :: Huse -> Item -> Creature -> World -> World
|
||||
useHeld hu = case hu of
|
||||
HeldDoNothing -> const $ const id
|
||||
HeldUseAmmoParams -> useAmmoParams
|
||||
HeldUseAmmoParams -> shootBullet
|
||||
HeldOverNozzlesUseGasParams -> overNozzles useGasParams
|
||||
HeldPJCreation -> usePjCreation
|
||||
HeldPJCreationX i -> usePjCreationX i
|
||||
|
||||
@@ -44,3 +44,22 @@ beltMag :: Item
|
||||
beltMag =
|
||||
tinMag & itType . iyBase .~ ATTACH (AMMOATTACH BULLETBELT)
|
||||
& itUse . attachParams . ammoLoadStatus . iaMax .~ 2000
|
||||
|
||||
shellMag :: Item
|
||||
shellMag =
|
||||
defaultHeldItem & itType . iyBase .~ ATTACH (AMMOATTACH SHELLMAG)
|
||||
& itUse
|
||||
.~ AttachUse
|
||||
{ _attachParams =
|
||||
AmmoAttachParams
|
||||
{ _ammoParams = BulletParams defaultBullet
|
||||
, _ammoLoadStatus =
|
||||
InternalAmmo
|
||||
{ _iaMax = 15
|
||||
, _iaLoaded = 15
|
||||
, _iaPrimed = True
|
||||
, _iaCycle = [loadEject 10, loadInsert 10, loadPrime 10]
|
||||
, _iaProgress = Nothing
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4,12 +4,13 @@ module Dodge.Item.Weapon.Bullet (
|
||||
defaultBullet,
|
||||
) where
|
||||
|
||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
import Control.Lens
|
||||
import Dodge.Data.Item.Use.Consumption.Ammo
|
||||
import Geometry.Data
|
||||
|
||||
basicBulletAmmo :: AmmoType
|
||||
basicBulletAmmo = SmallBulletAmmo
|
||||
|
||||
-- , _amBullet = defaultBullet
|
||||
|
||||
defaultBullet :: Bullet
|
||||
@@ -34,10 +35,11 @@ basicBulDams =
|
||||
]
|
||||
|
||||
hvBulletAmmo :: Bullet
|
||||
hvBulletAmmo = defaultBullet
|
||||
& buWidth .~ 6
|
||||
& buVel .~ V2 80 0
|
||||
& buDamages .~ heavyBulDams
|
||||
hvBulletAmmo =
|
||||
defaultBullet
|
||||
& buWidth .~ 6
|
||||
& buVel .~ V2 80 0
|
||||
& buDamages .~ heavyBulDams
|
||||
|
||||
heavyBulDams :: [Damage]
|
||||
heavyBulDams =
|
||||
|
||||
Reference in New Issue
Block a user