Remove data Hammers

This commit is contained in:
2024-12-31 12:42:03 +00:00
parent 9e2dc995e9
commit 17da9e00f8
15 changed files with 146 additions and 166 deletions
+8 -9
View File
@@ -43,19 +43,20 @@ handleHotkeys w
|| SDL.ScancodeRShift `M.member` _pressedKeys (_input w) =
foldl' tryAssignHotkey w allHotkeys
| otherwise =
foldl'
M.foldl'
useHotkey
w
(M.intersection thehotkeys (M.filter (== InitialPress) (w ^. input . pressedKeys)))
(M.intersectionWith (,) thehotkeys (w ^. input . pressedKeys))
where
thehotkeys = M.mapKeys hotkeyToScancode $ w ^. cWorld . lWorld . hotkeys
useHotkey :: World -> NewInt ItmInt -> World
useHotkey w (NInt itid) = fromMaybe w $ do
useHotkey :: World -> (NewInt ItmInt,PressType) -> World
useHotkey w (NInt itid,pt) = fromMaybe w $ do
invid <- w ^? cWorld . lWorld . itemLocations . ix itid . ilInvID
cr <- w ^? cWorld . lWorld . creatures . ix 0
itmloc <- allInvLocs (cr ^. crInv) ^? ix invid . _2 . locLDT
return $ heldEffectNoHammerCheck (bimap (^. iatType) (^. _1) itmloc) cr w
return $ useItem invid pt w
-- cr <- w ^? cWorld . lWorld . creatures . ix 0
-- itmloc <- allInvLocs (cr ^. crInv) ^? ix invid . _2 . locLDT
-- return $ heldEffectNoHammerCheck (bimap (^. iatType) (^. _1) itmloc) cr w
allHotkeys :: [SDL.Scancode]
allHotkeys = map hotkeyToScancode [minBound .. maxBound]
@@ -176,8 +177,6 @@ pressedMBEffectsTopInventory pkeys w
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
, Just rtime <- pkeys ^? ix SDL.ButtonRight
, ltime <= rtime && inTopInv =
--youhammerdown $
--useSelectedItem 0 w
fromMaybe w $ do
invid <- w ^? cWorld . lWorld . creatures . ix 0
. crManipulation . manObject . imSelectedItem