Start moving bullet ammo parameters to more sensible places

This commit is contained in:
2024-06-22 00:08:42 +01:00
parent 944b40cb56
commit a3eca3a674
15 changed files with 271 additions and 248 deletions
-1
View File
@@ -21,7 +21,6 @@ defaultBullet =
{ _buDelayFraction = 1
, _buEffect = DestroyBullet
, _buSpawn = BulSpark
, _buUpdateMod = NoBulletUpdateMod
, _buTrajectory = BasicBulletTrajectory
, _buVel = V2 50 0
, _buDrag = 1
+9 -3
View File
@@ -24,6 +24,7 @@ module Dodge.Item.Weapon.TriggerType (
withTorqueAfter,
torqueSideEffect,
withRandomItemParams,
withRandomItem,
withRandomItemUpdate,
withSoundStart,
withSoundItemChoiceStart,
@@ -297,7 +298,7 @@ withRecoil :: ChainEffect
withRecoil eff it cr = eff it cr . over (cWorld . lWorld . creatures . ix cid) pushback
where
cid = _crID cr
recoilAmount = fromMaybe 0 $ it ^? itParams . recoil
recoilAmount = fromMaybe 0 $ it ^? itUse . heldParams . recoil
pushback = over crPos (+.+ rotateV (_crDir cr) (V2 ((- recoilAmount) / _crMass cr) 0))
{- | Pushes a creature sideways by a random amount.
@@ -517,6 +518,11 @@ withRandomItemParams rip eff it cr w = eff (it & itParams %~ f) cr $ w & randGen
where
(f, g) = runState rip (_randGen w)
withRandomItem :: State StdGen (Item -> Item) -> ChainEffect
withRandomItem rip eff it cr w = eff (f it) cr $ w & randGen .~ g
where
(f, g) = runState rip (_randGen w)
withPositionOffset ::
(Item -> Creature -> World -> (Point2, Float)) ->
ChainEffect
@@ -548,7 +554,7 @@ withRandomOffset f item cr w = f item (cr & crPos %~ (+.+ offV)) $ set randGen g
where
(offsetVal, g) = randomR (- offsetAmount, offsetAmount) $ _randGen w
offV = rotateV (_crDir cr) (V2 0 offsetVal)
offsetAmount = fromMaybe 0 $ item ^? itParams . randomOffset
offsetAmount = fromMaybe 0 $ item ^? itUse . heldParams . randomOffset
-- | Rotates a creature
torqueBefore ::
@@ -615,7 +621,7 @@ withTorqueAfter feff item cr w
where
cid = _crID cr
(rot, g) = randomR (- torque, torque) $ _randGen w
torque = fromMaybe 0 $ item ^? itParams . torqueAfter
torque = fromMaybe 0 $ item ^? itUse . heldParams . torqueAfter
rotateScope = fromMaybe id $ do
i <- yourScopeInvID w
return $ cWorld . lWorld . creatures . ix cid . crInv . ix i . itUse . attachParams . scrollAttachParams . opticPos %~ rotateV rot