Fix rb scrolling

This commit is contained in:
2022-12-31 22:29:12 +00:00
parent beac123dd2
commit 0dc9a09723
11 changed files with 44 additions and 37 deletions
+5 -11
View File
@@ -1,13 +1,12 @@
module Dodge.Reloading (
crCancelReloading,
crToggleReloading,
crHoldReloading,
stepReloading,
tryStartLoading,
) where
import Control.Lens
import Dodge.Data.World
import Dodge.Data.Creature
import Dodge.Hammer
crCancelReloading :: Creature -> Creature
@@ -38,15 +37,10 @@ tryNextLoadAction cr = case cr ^? crInv . ix (crSel cr) . itUse . heldConsumptio
cr & crInvSel . iselAction . actionProgress .~ _actionTime la
& crInvSel . iselAction . reloadAction .~ la
crToggleReloading :: Creature -> World -> World
crToggleReloading cr w = case cr ^. crInvSel . iselAction of
ReloadAction{} -> w & cWorld . lWorld . creatures . ix (_crID cr) . crInvSel . iselAction .~ NoInvSelAction
_ -> w & cWorld . lWorld . creatures . ix (_crID cr) %~ tryStartLoading
crHoldReloading :: Creature -> World -> World
crHoldReloading cr w =
w
& cWorld . lWorld . creatures . ix (_crID cr) . crInvSel . iselAction . actionHammer .~ HasHammer HammerDown
crToggleReloading :: Creature -> Creature
crToggleReloading cr = case cr ^? crInvSel . iselAction of
Just ReloadAction{} -> cr & crInvSel . iselAction .~ NoInvSelAction
_ -> cr & tryStartLoading
tryStartLoading :: Creature -> Creature
tryStartLoading cr = case cr ^? crInv . ix (crSel cr) . itUse . heldConsumption of