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
+7 -8
View File
@@ -18,11 +18,10 @@ import LensHelp
defaultBangCane :: Item
defaultBangCane =
defaultBulletWeapon
& itParams
.~ BulletShooter
& itUse . heldParams
.~ BulletShooterParams
{ _muzVel = 0.8
, _rifling = 0.9
, _bore = 2
, _recoil = 50
, _torqueAfter = 0.1
, _randomOffset = 0
@@ -44,7 +43,7 @@ volleyGun i =
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itType . iyBase .~ HELD (VOLLEYGUN i)
multiGun :: Int -> Item
@@ -56,7 +55,7 @@ multiGun i =
& itUse . heldAim . aimStance .~ TwoHandFlat
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 x) 0 0.01 | x <- spreadAroundCenter i 3]
& itParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.15 + 0.05 * fromIntegral i
& itType . iyBase .~ HELD (MULTIGUN i)
rifle :: Item
@@ -109,9 +108,9 @@ miniGunX i =
& itUse .~ miniGunUse i
& itUse . heldAim . aimTurnSpeed .~ 0.5
& itUse . heldAim . aimMuzzles .~ replicate i (Muzzle (V2 30 0) 0 0.05)
& itParams . recoil .~ 10
& itParams . torqueAfter .~ 0.01
& itParams . randomOffset .~ 10
& itUse . heldParams . recoil .~ 10
& itUse . heldParams . torqueAfter .~ 0.01
& itUse . heldParams . randomOffset .~ 10
& itInvSize .~ fromIntegral i + 1
& itDimension . dimRad .~ 20
& itDimension . dimCenter .~ V3 5 0 0
+10 -10
View File
@@ -12,13 +12,6 @@ bangCone =
defaultBulletWeapon
{ _itParams =
BulletShooter
{ _muzVel = 0.7
, _rifling = 0.8
, _bore = 5
, _recoil = 150
, _torqueAfter = 0.1
, _randomOffset = 12
}
}
& itDimension . dimRad .~ 8
& itDimension . dimCenter .~ V3 5 0 0
@@ -26,6 +19,13 @@ bangCone =
& itUse . heldMods .~ BangConeMod
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 15 0) 0 0.5]
& itUse . heldParams .~ BulletShooterParams
{ _muzVel = 0.7
, _rifling = 0.8
, _recoil = 150
, _torqueAfter = 0.1
, _randomOffset = 12
}
& itType . iyBase .~ HELD BANGCONE
blunderbuss :: Item
@@ -41,6 +41,6 @@ grapeCannon :: Int -> Item
grapeCannon i =
blunderbuss
& itType . iyBase .~ HELD (GRAPECANNON i)
& itParams . recoil .~ (150 + fromIntegral i * 50)
& itParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itParams . randomOffset .~ (12 + 4 * fromIntegral i)
& itUse . heldParams . recoil .~ (150 + fromIntegral i * 50)
& itUse . heldParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itUse . heldParams . randomOffset .~ (12 + 4 * fromIntegral i)
+4 -5
View File
@@ -17,11 +17,10 @@ import LensHelp
bangRod :: Item
bangRod =
defaultBulletWeapon
& itParams
.~ BulletShooter
& itUse . heldParams
.~ BulletShooterParams
{ _muzVel = 0.8
, _rifling = 1
, _bore = 2
, _recoil = 50
, _torqueAfter = 0.3
, _randomOffset = 0
@@ -46,7 +45,7 @@ elephantGun =
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles . ix 0 . mzInaccuracy .~ 0.05
& itUse . heldMods .~ ElephantGunMod
& itParams . recoil .~ 50
& itUse . heldParams . recoil .~ 50
amr :: Item
amr =
@@ -78,4 +77,4 @@ machineGun =
& itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
& itUse . heldDelay .~ VariableRate{_rateMax = 25, _rateMaxMax = 24, _rateMinMax = 7, _rateTime = 0}
& itInvSize .~ 3
& itParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
& itUse . heldParams . torqueAfter .~ 0.2 -- not sure if this is necessary?
+5 -7
View File
@@ -16,11 +16,10 @@ import LensHelp
bangStick :: Int -> Item
bangStick i =
defaultBulletWeapon
& itParams
.~ BulletShooter
& itUse . heldParams
.~ BulletShooterParams
{ _muzVel = 0.8
, _rifling = 0.8
, _bore = 2
, _recoil = 25
, _torqueAfter = 0.18 + 0.02 * fromIntegral i
, _randomOffset = 0
@@ -45,10 +44,9 @@ pistol =
& itUse . heldDelay . rateMax .~ 6
& itUse . heldMods .~ PistolMod
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 10 0) 0 0.05]
& itParams
& itUse . heldParams
%~ ( (muzVel .~ 0.8)
. (rifling .~ 0.8)
. (bore .~ 2)
. (recoil .~ 10)
. (torqueAfter .~ 0.2)
)
@@ -68,7 +66,7 @@ machinePistol =
& itUse . heldMods .~ MachinePistolMod -- (ammoCheckI : machinePistolAfterHamMods)
& itType . iyBase .~ HELD MACHINEPISTOL
& itType . iyModules . at ModAutoMag .~ Nothing
& itParams . recoil .~ 20
& itUse . heldParams . recoil .~ 20
smg :: Item
smg =
@@ -78,4 +76,4 @@ smg =
& itUse . heldAim . aimStance .~ TwoHandUnder
& itUse . heldAim . aimMuzzles .~ [Muzzle (V2 20 0) 0 0]
-- & itUse . heldAim . aimHandlePos .~ 2
& itParams . torqueAfter .~ 0.05
& itUse . heldParams . torqueAfter .~ 0.05
-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