Improve item use hammer, improve wide laser

This commit is contained in:
2022-07-07 10:58:18 +01:00
parent 3759434d92
commit 68cb191063
26 changed files with 328 additions and 301 deletions
+8 -5
View File
@@ -44,8 +44,8 @@ tryClickReload :: Creature -> Item -> World -> (World -> World) -> World -> Worl
tryClickReload cr it w f
| _crID cr == _yourID w && itNeedsLoading it && _mouseButtons w M.!? SDL.ButtonLeft == Just False
= crToggleReloading cr
| otherwise =
(runIdentity . pointToItem (_itPos it) (return . (itUse . useHammer' .~ HammerDown)))
| otherwise
= (runIdentity . pointToItem (_itPos it) (return . (itUse . useHammer .~ HammerDown)))
. f
itNeedsLoading :: Item -> Bool
@@ -96,12 +96,15 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
useLeftItem :: Int -> World -> World
useLeftItem cid w
| _crInvLock cr = w
| itmShouldBeUsed = useItem cr w
| itmShouldBeUsed = useItem cr w -- I believe this ONLY sets equipment options
| otherwise = fromMaybe w $ do
invid <- _crLeftInvSel cr
itm <- cr ^? crInv . ix invid
f <- cr ^? crInv . ix invid . itUse . lUse
return $ f itm cr w
f <- cr ^? crInv . ix invid . itUse . lUse
return
. (runIdentity . pointToItem (_itPos itm) (return . (itUse . useHammer .~ HammerDown)))
. f itm cr
$ w
where
cr = _creatures w IM.! cid
itmShouldBeUsed = isJust (cr ^? crInv . ix (crSel cr) . itUse . cUse)