Fix reset of reloading from 0 scrolling

This commit is contained in:
2023-01-08 00:17:16 +00:00
parent f8d9b54586
commit 44bb6e7e02
4 changed files with 9 additions and 16 deletions
-1
View File
@@ -31,7 +31,6 @@ itemEffect :: Creature -> Item -> World -> World
itemEffect cr it w = case it ^. itUse of itemEffect cr it w = case it ^. itUse of
HeldUse{_heldUse = eff, _heldMods = usemods} -> HeldUse{_heldUse = eff, _heldMods = usemods} ->
hammerTest $ tryReload cr it (_input 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 LeftUse{} -> doequipmentchange
EquipUse{} -> doequipmentchange EquipUse{} -> doequipmentchange
-- ConsumeUse will cause problems if the item is not selected -- ConsumeUse will cause problems if the item is not selected
+5 -2
View File
@@ -308,7 +308,7 @@ closeObjScrollDir x
changeInvSel :: Int -> World -> World changeInvSel :: Int -> World -> World
changeInvSel i w changeInvSel i w
| n == 0 = w | i == 0 || n == 0 = w
| yourInvSel w < n = | yourInvSel w < n =
w w
& pointcrInvSel . iselPos %~ (`mod` n) . subtract i & pointcrInvSel . iselPos %~ (`mod` n) . subtract i
@@ -325,6 +325,7 @@ changeInvSel i w
changeSwapInvSel :: Int -> World -> World changeSwapInvSel :: Int -> World -> World
changeSwapInvSel k w changeSwapInvSel k w
| k == 0 = w
| yourInvSel w < n = | yourInvSel w < n =
w w
& cWorld . lWorld . creatures . ix 0 %~ updatecreature & cWorld . lWorld . creatures . ix 0 %~ updatecreature
@@ -356,7 +357,9 @@ changeSwapInvSel k w
numCO = length $ w ^. hud . closeObjects numCO = length $ w ^. hud . closeObjects
changeAugInvSel :: Int -> World -> World changeAugInvSel :: Int -> World -> World
changeAugInvSel i w = changeAugInvSel i w
| i == 0 = w
| otherwise =
w w
& cWorld . lWorld . creatures . ix 0 . crInvSel . iselPos %~ (`mod` n) . subtract i & cWorld . lWorld . creatures . ix 0 . crInvSel . iselPos %~ (`mod` n) . subtract i
& cWorld . lWorld . creatures . ix 0 . crInvSel . iselAction .~ NoInvSelAction & cWorld . lWorld . creatures . ix 0 . crInvSel . iselAction .~ NoInvSelAction
-1
View File
@@ -16,7 +16,6 @@ crCancelReloading cr =
stepReloading :: Creature -> Creature stepReloading :: Creature -> Creature
stepReloading cr = case cr ^?! crInvSel . iselAction of stepReloading cr = case cr ^?! crInvSel . iselAction of
-- ReloadAction _ _ (HasHammer HammerUp) -> cr & crInvSel . iselAction .~ NoInvSelAction
ReloadAction x la ReloadAction x la
| x > 0 -> | x > 0 ->
cr & crInvSel . iselAction . actionProgress -~ 1 cr & crInvSel . iselAction . actionProgress -~ 1
+1 -9
View File
@@ -9,18 +9,10 @@ import Dodge.Data.Universe
--import qualified IntMapHelp as IM --import qualified IntMapHelp as IM
testStringInit :: Universe -> [String] testStringInit :: Universe -> [String]
testStringInit u = testStringInit u =
[ show $ u ^. uvWorld . input . scrollAmount [ show $ ycr ^?! crInvSel . iselAction
, maybe mempty show mit
, maybe mempty (show . f) mit
, maybe mempty show mit'
, maybe mempty show mit''
] ]
where where
f x = 1/ (x *2) ** (40/39)
ycr = you (u ^. uvWorld) ycr = you (u ^. uvWorld)
mit = ycr ^? crInv . ix (crSel ycr) . itScope . scopeZoom
mit' = ycr ^? crInv . ix (crSel ycr) . itScope . scopePos
mit'' = ycr ^? crInv . ix (crSel ycr) . itScope . scopeZoomChange
showTimeFlow :: TimeFlowStatus -> String showTimeFlow :: TimeFlowStatus -> String
showTimeFlow tfs = case tfs of showTimeFlow tfs = case tfs of