Move weapon torque out of records

This commit is contained in:
2025-06-04 11:21:15 +01:00
parent 9f884b5aa7
commit 636a13b678
10 changed files with 279 additions and 216 deletions
+2 -5
View File
@@ -75,17 +75,14 @@ data AttachParams
data HeldParams
= DefaultHeldParams
| GasSprayParams
{ _gasCreation :: GasCreate
, _torqueAfter :: Float
, _randomOffset :: Float
{ _randomOffset :: Float
, _sidePush :: Float
, _weaponInvLock :: Int
, _weaponRepeat :: [Int]
}
| BeamShooterParams
| BulletShooterParams
{ _torqueAfter :: Float
, _randomOffset :: Float
{ _randomOffset :: Float
, _sidePush :: Float
, _weaponInvLock :: Int
, _weaponRepeat :: [Int]
+1 -2
View File
@@ -29,8 +29,7 @@ defaultHeldUse = UseHeld
-- , _heldHammer = HammerUp
, _heldMuzzles = defaultMuzzles
, _heldParams = BulletShooterParams
{ _torqueAfter = 0.2
, _randomOffset = 0
{ _randomOffset = 0
, _sidePush = 0
-- , _bulGunSound = Just (tap3S, 0)
, _weaponInvLock = 0
+95 -5
View File
@@ -322,7 +322,56 @@ applyTorqueCME itm cr w
where
cid = _crID cr
(rot, g) = randomR (- torque, torque) $ _randGen w
torque = fromMaybe 0 $ itm ^? itUse . heldParams . torqueAfter
torque = torqueAmount itm
torqueAmount :: Item -> Float
torqueAmount itm = case itm ^. itType of
HELD hit -> heldTorqueAmount hit
_ -> 0
heldTorqueAmount :: HeldItemType -> Float
heldTorqueAmount = \case
BANGSTICK i -> 0.18 + 0.02 * fromIntegral i
REWINDER -> 0
TIMESTOPPER -> 0
TIMESCROLLER -> 0
PISTOL -> 0.2
MACHINEPISTOL -> 0.2
AUTOPISTOL -> 0.2
SMG -> 0.05
BANGCONE -> 0.1
BLUNDERBUSS -> 0.1
GRAPECANNON i -> 0.1 + 0.2 * fromIntegral i
MINIGUNX i -> 0.04 + 0.02 * fromIntegral i
VOLLEYGUN{} -> 0.1
RIFLE -> 0.1
ALTERIFLE -> 0.1
AUTORIFLE -> 0.1
BURSTRIFLE -> 0.1
BANGROD -> 0.3
ELEPHANTGUN -> 0.3
AMR -> 0.3
AUTOAMR -> 0.3
SNIPERRIFLE -> 0.3
FLAMESPITTER -> 0
FLAMETHROWER -> 0
FLAMETORRENT -> 0
FLAMEWALL -> 0
BLOWTORCH -> 0
SPARKGUN -> 0
TESLAGUN -> 0
LASER -> 0
TRACTORGUN -> 0
RLAUNCHER -> 0
RLAUNCHERX{} -> 0
GLAUNCHER -> 0
POISONSPRAYER -> 0
SHATTERGUN -> 0
TORCH -> 0
FLATSHIELD -> 0
KEYCARD{} -> 0
BLINKER -> 0
BLINKERUNSAFE -> 0
-- (Muzzle,Int,Int) = (muzzle, amountloaded, id of mag taken from)
loadMuzzle ::
@@ -787,9 +836,9 @@ useGasParams mmagid mz itm cr w =
(pressure, g) = doGenFloat (_nzPressure $ _mzEffect mz) (_randGen w)
gastype = fromMaybe (error "cannot find gas ammo") $ do
magid <- mmagid
hit <- itm ^? itType . ibtHeld
fueltype <- cr ^? crInv . ix magid . itConsumables . magParams . ampCreateGas
gc <- itm ^? itUse . heldParams . gasCreation
return $ gasCreate fueltype gc
gasType hit fueltype
--pos = _crPos cr + rotateV (_crDir cr) (_mzPos mz + aimingWeaponZeroPos cr itm)
(moff, mrot) = heldItemOrient2D itm cr (_mzPos mz) (_mzRot mz)
pos = _crPos cr + rotateV (_crDir cr) moff
@@ -797,8 +846,49 @@ useGasParams mmagid mz itm cr w =
inacc = _mzInaccuracy mz
dir = _crDir cr + mrot + a + _nzCurrentWalkAngle (_mzEffect mz)
gasCreate :: GasFuel -> GasCreate -> GasCreate
gasCreate = const id
gasType :: HeldItemType -> GasFuel -> Maybe GasCreate
gasType hit _ = case hit of
BANGSTICK{} -> Nothing
REWINDER -> Nothing
TIMESTOPPER -> Nothing
TIMESCROLLER -> Nothing
PISTOL -> Nothing
MACHINEPISTOL -> Nothing
AUTOPISTOL -> Nothing
SMG -> Nothing
BANGCONE -> Nothing
BLUNDERBUSS -> Nothing
GRAPECANNON{} -> Nothing
MINIGUNX{} -> Nothing
VOLLEYGUN{} -> Nothing
RIFLE -> Nothing
ALTERIFLE -> Nothing
AUTORIFLE -> Nothing
BURSTRIFLE -> Nothing
BANGROD -> Nothing
ELEPHANTGUN -> Nothing
AMR -> Nothing
AUTOAMR -> Nothing
SNIPERRIFLE -> Nothing
FLAMESPITTER -> Nothing
FLAMETHROWER -> Just CreateFlame
FLAMETORRENT -> Just CreateFlame
FLAMEWALL -> Just CreateFlame
BLOWTORCH -> Nothing
SPARKGUN -> Nothing
TESLAGUN -> Nothing
LASER -> Nothing
TRACTORGUN -> Nothing
RLAUNCHER -> Nothing
RLAUNCHERX{} -> Nothing
GLAUNCHER -> Nothing
POISONSPRAYER -> Just CreatePoisonGas
SHATTERGUN -> Nothing
TORCH -> Nothing
FLATSHIELD -> Nothing
KEYCARD{} -> Nothing
BLINKER -> Nothing
BLINKERUNSAFE -> Nothing
doGenFloat :: RandomGen g => GenFloat -> g -> (Float, g)
doGenFloat (ConstFloat x) g = (x, g)
-3
View File
@@ -21,7 +21,6 @@ defaultBangCane :: Item
defaultBangCane =
defaultBulletWeapon
-- & itUse . heldParams . recoil .~ 50
& itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldDelay . rateMax .~ 6
-- & itUse . heldMods .~ BangCaneMod
-- & itUse . heldAim . aimHandlePos .~ 5
@@ -39,7 +38,6 @@ volleyGun i =
<*> ZipList [0..i-1]
)
& itUse . heldParams . weaponInvLock .~ i + 1
& itUse . heldParams . torqueAfter .~ 0.1
-- & itUse . heldParams . recoil .~ 30
& itType .~ HELD (VOLLEYGUN i)
& itAmmoSlots .~ IM.fromList (zip [0..i-1] $ repeat BulletAmmo)
@@ -94,7 +92,6 @@ miniGunX i =
.~ replicate i
(Muzzle (V2 30 0) 0 0.05 0 MiniGunFlare MuzzleShootBullet (UseExactly 1) 0)
-- & itUse . heldParams . recoil .~ 10 * fromIntegral i
& itUse . heldParams . torqueAfter .~ 0.04 + 0.02 * fromIntegral i
& itUse . heldParams . sidePush .~ 10 * fromIntegral i
& itUse . heldParams . randomOffset .~ 10
& itType .~ HELD (MINIGUNX i)
-2
View File
@@ -19,7 +19,6 @@ bangCone =
15
(Muzzle (V2 15 0) 0 0.5 0 NoFlare MuzzleShootBullet (UseExactly 1) 0)
& itUse . heldMuzzles . ix 0 . mzFlareType .~ BasicFlare
& itUse . heldParams . torqueAfter .~ 0.1
& itUse . heldParams . randomOffset .~ 12
& itType .~ HELD BANGCONE
@@ -33,5 +32,4 @@ grapeCannon :: Int -> Item
grapeCannon i =
blunderbuss
& itType .~ HELD (GRAPECANNON i)
& itUse . heldParams . torqueAfter .~ (0.1 + 0.2 * fromIntegral i)
& itUse . heldParams . randomOffset .~ (12 + 4 * fromIntegral i)
-1
View File
@@ -20,7 +20,6 @@ rLauncher =
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
& itAmmoSlots .~ singleAmmo LauncherAmmo
& itType .~ HELD RLAUNCHER
& itUse . heldParams . torqueAfter .~ 0
-- & itUse . heldParams . bulGunSound ?~ (tap4S, 0)
-5
View File
@@ -18,13 +18,8 @@ import LensHelp
bangRod :: Item
bangRod =
defaultBulletWeapon
-- & itUse . heldParams . recoil .~ 50
& itUse . heldParams . torqueAfter .~ 0.3
-- & itUse . heldParams . bulGunSound ?~ (bangEchoS,0)
& itUse . heldDelay . rateMax .~ 12
& itType .~ HELD BANGROD
-- & itUse . heldAim . aimZoom .~ defaultItZoom{_izFac = 1.5}
-- & itUse . heldAim . aimHandlePos .~ 5
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 30 0
& itUse . heldMuzzles . ix 0 . mzFlareType .~ HeavySmokeFlare
-- & itUse . heldConsumption . laAmmoType .~ hvBulletAmmo
+1 -7
View File
@@ -19,9 +19,6 @@ poisonSprayer =
flameThrower
& itType .~ HELD POISONSPRAYER
& itAmmoSlots .~ singleAmmo GasAmmo
& itUse . heldParams . gasCreation .~ CreatePoisonGas --aGasCloud
-- & itUse . heldParams . recoil .~ 0
& itUse . heldParams . torqueAfter .~ 0
& itUse . heldParams . randomOffset .~ 0
& itUse . heldParams . sidePush .~ 0
-- & itUse . heldParams . bulGunSound ?~ (foamSprayLoopS,5)
@@ -86,10 +83,7 @@ flameThrower =
& itAmmoSlots .~ singleAmmo GasAmmo
& itType .~ HELD FLAMETHROWER
& itUse . heldParams .~ GasSprayParams
{_gasCreation = CreateFlame
-- , _recoil = 0
, _torqueAfter = 0
, _randomOffset = 0
{ _randomOffset = 0
, _sidePush = 25
-- , _bulGunSound = Nothing
, _weaponInvLock = 0
+1 -4
View File
@@ -17,7 +17,6 @@ bangStick :: Int -> Item
bangStick i =
defaultBulletWeapon
-- & itUse . heldParams . recoil .~ 25
& itUse . heldParams . torqueAfter .~ 0.18 + 0.02 * fromIntegral i
& itType .~ HELD (BANGSTICK i)
& itUse . heldDelay . rateMax .~ 8
& itUse . heldMuzzles
@@ -47,8 +46,7 @@ pistol =
& itUse . heldMuzzles . ix 0 . mzInaccuracy %~ const 0.05
& itUse . heldMuzzles . ix 0 . mzFlareType %~ const BasicFlare
& itUse . heldParams
%~ ( (torqueAfter .~ 0.2)
. (sidePush .~ 50)
%~ ( (sidePush .~ 50)
)
& itType .~ HELD PISTOL
@@ -68,5 +66,4 @@ smg =
& itType .~ HELD SMG
& itUse . heldMuzzles . ix 0 . mzPos .~ V2 20 0
& itUse . heldMuzzles . ix 0 . mzInaccuracy .~ 0
& itUse . heldParams . torqueAfter .~ 0.05
& itUse . heldParams . sidePush .~ 30