Commit before changing ItemUse into single product type
This commit is contained in:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user