Move weapon torque out of records
This commit is contained in:
+95
-5
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user