Fix rb scrolling
This commit is contained in:
@@ -30,7 +30,7 @@ useItem cr' w = fromMaybe (f w) $ do
|
||||
itemEffect :: Creature -> Item -> World -> World
|
||||
itemEffect cr it w = case it ^. itUse of
|
||||
HeldUse{_heldUse = eff, _heldMods = usemods} ->
|
||||
hammerTest $ tryReload cr it w $ foldl' (&) (useHeld eff) (useMod usemods) it cr
|
||||
hammerTest $ tryReload cr it (_input w) $ foldl' (&) (useHeld eff) (useMod usemods) it cr
|
||||
--hammerTest $ tryReload cr it w $ foldl' (&) (useHeld eff) (reverse $ useMod usemods) it cr
|
||||
LeftUse{} -> doequipmentchange
|
||||
EquipUse{} -> doequipmentchange
|
||||
@@ -49,13 +49,15 @@ itemEffect cr it w = case it ^. itUse of
|
||||
. activateEquipmentAt (_rbOptions w) cr
|
||||
)
|
||||
|
||||
tryReload :: Creature -> Item -> World -> (World -> World) -> World -> World
|
||||
tryReload cr it w f
|
||||
| _crID cr == 0 && itNeedsLoading it && _mouseButtons (_input w) M.!? SDL.ButtonLeft == Just False =
|
||||
crToggleReloading cr
|
||||
tryReload :: Creature -> Item -> Input -> (World -> World) -> World -> World
|
||||
tryReload cr it theinput f
|
||||
| cid == 0 && itNeedsLoading it && _mouseButtons theinput M.!? SDL.ButtonLeft == Just False =
|
||||
cWorld . lWorld . creatures . ix cid %~ crToggleReloading
|
||||
| otherwise =
|
||||
(runIdentity . pointerToItemLocation (_itLocation it) (return . (itUse . heldHammer .~ HammerDown)))
|
||||
. f
|
||||
where
|
||||
cid = _crID cr
|
||||
|
||||
itNeedsLoading :: Item -> Bool
|
||||
itNeedsLoading it = _laLoaded ic == 0 || not (_laPrimed ic)
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Creature.State (
|
||||
doDamage,
|
||||
) where
|
||||
|
||||
import Data.Maybe
|
||||
import Dodge.Creature.Test
|
||||
import Data.Foldable
|
||||
import Dodge.Base
|
||||
@@ -64,13 +65,12 @@ stateUpdate f =
|
||||
]
|
||||
|
||||
heldAimEffects :: Creature -> World -> World
|
||||
heldAimEffects cr
|
||||
| crIsAiming cr = case cr ^? crInv . ix (cr ^. crInvSel . iselPos) of
|
||||
Just itm -> case itm ^? itEffect . ieWhileAiming of
|
||||
Just f -> doInvEffect f itm cr
|
||||
_ -> id
|
||||
_ -> id
|
||||
| otherwise = id
|
||||
heldAimEffects cr = fromMaybe id $ do
|
||||
guard (crIsAiming cr)
|
||||
ipos <- cr ^? crInvSel . iselPos
|
||||
itm <- cr ^? crInv . ix ipos
|
||||
f <- itm ^? itEffect . ieWhileAiming
|
||||
return $ doInvEffect f itm cr
|
||||
|
||||
checkDeath :: Creature -> World -> World
|
||||
checkDeath cr w
|
||||
|
||||
Reference in New Issue
Block a user