Commit before changing ItemUse into single product type

This commit is contained in:
2024-12-20 14:49:18 +00:00
parent e1989eaa1e
commit 3a72bd366f
8 changed files with 32 additions and 27 deletions
+8 -5
View File
@@ -173,18 +173,21 @@ mouseActionsCr pkeys
pressedMBEffectsTopInventory :: M.Map SDL.MouseButton Int -> World -> World
pressedMBEffectsTopInventory pkeys w
| isDown SDL.ButtonLeft && isDown SDL.ButtonRight && inTopInv = youhammerdown $ useRootItem 0 w
-- | isDown SDL.ButtonLeft && inTopInv = youhammerdown $ useItemLeftClick (you w) w
| isDown SDL.ButtonMiddle = w & wCam . camRot -~ rotation
| Just ltime <- pkeys ^? ix SDL.ButtonLeft
, Just rtime <- pkeys ^? ix SDL.ButtonRight
, ltime <= rtime && inTopInv
= youhammerdown $ useSelectedItem 0 w
| Just _ <- pkeys ^? ix SDL.ButtonLeft
, Just _ <- pkeys ^? ix SDL.ButtonRight
= w & wCam . camRot -~ rotation
| otherwise = w
where
youhammerdown = set (cWorld . lWorld . creatures . ix 0 . crHammerPosition) HammerDown
inTopInv = case w ^. hud . hudElement of
DisplayInventory{_subInventory = NoSubInventory{}} -> True
_ -> False
isDown but = but `M.member` pkeys
rotation =
maybe
0
(angleBetween $ w ^. input . mousePos)
(w ^. input . heldPos . at SDL.ButtonMiddle)
(w ^. input . heldPos . at SDL.ButtonRight)