Continue weapon effect chain work

Start work on using muzzles to determine the effect of the ammo when
loaded
This commit is contained in:
2024-09-18 00:36:28 +01:00
parent 791003ebb9
commit 2c96a514ea
22 changed files with 502 additions and 404 deletions
+10 -3
View File
@@ -214,7 +214,7 @@ withWarmUp soundID f item cr w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) soundID (Just 2)
| otherwise =
w
& pointertoitem . itUse . heldDelay . warmTime .~ maxWarmUp
& pointertoitem . itUse . heldDelay . warmTime .~ (maxWarmUp + 1)
& f item cr
where
item' = _ldtValue item
@@ -376,8 +376,15 @@ useAmmoAmount amAmount eff item cr = fromMaybe id $ do
Applies a world effect after an item use cooldown check.
-}
useTimeCheck :: ChainEffect
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay . rateTime of
Just 0 -> f item cr $ setUseTime w
useTimeCheck f item cr w = case item ^? ldtValue . itUse . heldDelay of
Just (FixedRate _ 0) -> f item cr $ setUseTime w
Just (FixedRate _ _) -> w
Just (WarmUpNoDelay wt wm ws) | wt < wm -> w
& soundContinue (CrWeaponSound cid 0) (_crPos cr) ws (Just 2)
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime +~2
Just (WarmUpNoDelay _ wm _) -> f item cr w
& cWorld . lWorld . creatures . ix cid . crInv . ix itRef . itUse . heldDelay . warmTime .~ (wm+1)
Just NoDelay -> f item cr w
_ -> w
where
cid = _crID cr