Correctly reduce left click item delay

This commit is contained in:
2022-09-04 10:22:53 +01:00
parent 920bfdbc8e
commit 8c0ad639ad
9 changed files with 30 additions and 56 deletions
+5 -3
View File
@@ -110,7 +110,8 @@ toggleEquipmentAt rbops invid cr w = case rbops ^? opAllocateEquipment of
useLeftItem :: Int -> World -> World
useLeftItem cid w
| _crInvLock cr = w
| itmShouldBeUsed = useItem cr w -- I believe this ONLY sets equipment options
| itmIsConsumable = useItem cr w -- I believe this ONLY sets equipment options
| itmIsEquipable = useItem cr w -- I believe this ONLY sets equipment options
| otherwise = fromMaybe w $ do
invid <- _crLeftInvSel cr
itm <- cr ^? crInv . ix invid
@@ -121,9 +122,10 @@ useLeftItem cid w
$ w
where
cr = _creatures (_cWorld w) IM.! cid
itmShouldBeUsed =
itmIsConsumable =
isJust (cr ^? crInv . ix (crSel cr) . itUse . cUse)
|| ( isJust (cr ^? crInv . ix (crSel cr) . itUse . equipEffect . eeUse)
itmIsEquipable =
( isJust (cr ^? crInv . ix (crSel cr) . itUse . equipEffect . eeUse)
&& _crLeftInvSel cr /= Just (crSel cr)
)