Simplify and correct hammer check for held weapons
This commit is contained in:
+23
-13
@@ -62,7 +62,7 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap4S
|
, withSoundStart tap4S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
, hammerCheckI
|
, blCheck
|
||||||
]
|
]
|
||||||
TeslaMod ->
|
TeslaMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
@@ -109,20 +109,22 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap4S
|
, withSoundStart tap4S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
, hammerCheckI
|
, blCheck
|
||||||
]
|
]
|
||||||
ShatterMod ->
|
ShatterMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
-- , withSoundStart tap3S
|
-- , withSoundStart tap3S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AmmoCheckMod -> [ammoCheckI]
|
AmmoCheckMod -> [ammoCheckI]
|
||||||
AmmoUseCheckMod -> [useAmmoAmount 1,useTimeCheck, ammoCheckI]
|
AmmoUseCheckMod -> [useAmmoAmount 1,useTimeCheck, ammoCheckI]
|
||||||
AmmoHammerTimeUseOneMod ->
|
AmmoHammerTimeUseOneMod ->
|
||||||
[ useAmmoAmount 1
|
[ useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
BangCaneMod ->
|
BangCaneMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -133,7 +135,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
VolleyGunMod ->
|
VolleyGunMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -144,7 +147,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundItemChoiceStart caneStickSoundChoice
|
, withSoundItemChoiceStart caneStickSoundChoice
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoRifleMod ->
|
AutoRifleMod ->
|
||||||
-- note this is the same as BangCanemMod with the first changed
|
-- note this is the same as BangCanemMod with the first changed
|
||||||
@@ -167,7 +171,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
ElephantGunMod ->
|
ElephantGunMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -178,7 +183,8 @@ useMod hm = case hm of
|
|||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoAmrMod ->
|
AutoAmrMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -209,7 +215,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundItemChoiceStart bangStickSoundChoice
|
, withSoundItemChoiceStart bangStickSoundChoice
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
PistolMod ->
|
PistolMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -220,7 +227,8 @@ useMod hm = case hm of
|
|||||||
, withSoundStart tap3S
|
, withSoundStart tap3S
|
||||||
, useAmmoAmount 1
|
, useAmmoAmount 1
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
AutoPistolMod ->
|
AutoPistolMod ->
|
||||||
[ withMuzFlareI
|
[ withMuzFlareI
|
||||||
@@ -254,7 +262,8 @@ useMod hm = case hm of
|
|||||||
, lockInvFor 7
|
, lockInvFor 7
|
||||||
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
, sideEffectOnFrame 7 (\_ cr -> TorqueCr 0.2 (_crID cr)) --(torqueSideEffect 0.2)
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
BurstRifleRepeatMod ->
|
BurstRifleRepeatMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -305,7 +314,8 @@ useMod hm = case hm of
|
|||||||
-- rather than locking the inventory, a better solution may be to check
|
-- rather than locking the inventory, a better solution may be to check
|
||||||
-- that the weapon is still in your hands in the repeated frames
|
-- that the weapon is still in your hands in the repeated frames
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, ammoHammerCheck
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
RevolverXRepeatMod ->
|
RevolverXRepeatMod ->
|
||||||
[ withRecoil
|
[ withRecoil
|
||||||
@@ -328,8 +338,8 @@ useMod hm = case hm of
|
|||||||
, useAllAmmo
|
, useAllAmmo
|
||||||
, withSoundStart bangEchoS
|
, withSoundStart bangEchoS
|
||||||
, useTimeCheck
|
, useTimeCheck
|
||||||
, hammerCheckI
|
|
||||||
, ammoCheckI
|
, ammoCheckI
|
||||||
|
, blCheck
|
||||||
]
|
]
|
||||||
where
|
where
|
||||||
f = do
|
f = do
|
||||||
|
|||||||
@@ -54,16 +54,16 @@ module Dodge.Item.Weapon.TriggerType (
|
|||||||
duplicateOffsets,
|
duplicateOffsets,
|
||||||
duplicateOffsetsV2,
|
duplicateOffsetsV2,
|
||||||
duplicateOffsetsFocus,
|
duplicateOffsetsFocus,
|
||||||
hammerCheckI,
|
|
||||||
hammerCheckL,
|
hammerCheckL,
|
||||||
shootL,
|
shootL,
|
||||||
useTimeCheck,
|
useTimeCheck,
|
||||||
ammoCheckI,
|
ammoCheckI,
|
||||||
applyInaccuracy,
|
applyInaccuracy,
|
||||||
modClock,
|
modClock,
|
||||||
ammoHammerCheck,
|
blCheck,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import qualified SDL
|
||||||
import Data.Foldable
|
import Data.Foldable
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Base
|
import Dodge.Base
|
||||||
@@ -146,17 +146,6 @@ ammoCheckI eff itm cr w = case itm ^? itUse . heldConsumption . laSource of
|
|||||||
-> w
|
-> w
|
||||||
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
_ -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
||||||
|
|
||||||
-- combined ammo and hammer check: want to be able to auto-reload even if the
|
|
||||||
-- hammer is down?
|
|
||||||
ammoHammerCheck :: ChainEffect
|
|
||||||
ammoHammerCheck eff itm cr w
|
|
||||||
| _iaLoaded ic <= 0 || not (_iaPrimed ic) = w
|
|
||||||
-- fromMaybe w (startReloadingWeapon cr w)
|
|
||||||
| otherwise = case itm ^? itUse . heldHammer of
|
|
||||||
Just HammerUp -> eff itm cr $ w & cWorld . lWorld . creatures . ix (_crID cr) %~ crCancelReloading
|
|
||||||
_ -> w
|
|
||||||
where
|
|
||||||
ic = itm ^?! itUse . heldConsumption . laSource . _InternalSource
|
|
||||||
|
|
||||||
itUseCharge :: Int -> Item -> Item
|
itUseCharge :: Int -> Item -> Item
|
||||||
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
itUseCharge x = itUse . leftConsumption . arLoaded %~ (max 0 . subtract x)
|
||||||
@@ -388,12 +377,11 @@ useTimeCheck f item cr w = case item ^? itUse . heldDelay . rateTime of
|
|||||||
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
itRef = cr ^?! crManipulation . manObject . inInventory . ispItem -- unsafe!! TODO change
|
||||||
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
userate = fromMaybe 0 $ item ^? itUse . heldDelay . rateMax
|
||||||
|
|
||||||
|
|
||||||
-- | Applies a world effect after a hammer position check.
|
-- | Applies a world effect after a hammer position check.
|
||||||
hammerCheckI :: ChainEffect
|
blCheck :: ChainEffect
|
||||||
hammerCheckI f it cr w = case it ^? itUse . heldHammer of
|
blCheck f it cr w = case w ^? input . mouseButtons . ix SDL.ButtonLeft of
|
||||||
Just HammerUp
|
Just 0 -> f it cr w
|
||||||
| it ^?! itUse . heldConsumption . laSource . _InternalSource . iaPrimed ->
|
|
||||||
f it cr w
|
|
||||||
_ -> w
|
_ -> w
|
||||||
|
|
||||||
{- | Applies a world effect after a hammer position check.
|
{- | Applies a world effect after a hammer position check.
|
||||||
|
|||||||
@@ -86,7 +86,6 @@ stackPicturesAtOff i = mconcat . zipWith (drawListElement 10 1 0) [i, i -1 ..]
|
|||||||
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
|
selSecDrawCursor :: Int -> ListDisplayParams -> SelectionSections a -> Picture
|
||||||
selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
|
selSecDrawCursor xsize ldp sss = fromMaybe mempty $ do
|
||||||
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
|
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
|
||||||
--yint <- sss ^? sssSections . ix i . ssCursor . _Just . scurPos
|
|
||||||
yint <- selSecYint i j sss
|
yint <- selSecYint i j sss
|
||||||
xint <- sss ^? sssSections . ix i . ssIndent
|
xint <- sss ^? sssSections . ix i . ssIndent
|
||||||
si <- sss ^? sssSections . ix i . ssItems . ix j
|
si <- sss ^? sssSections . ix i . ssItems . ix j
|
||||||
|
|||||||
Reference in New Issue
Block a user