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)
)
+1
View File
@@ -147,6 +147,7 @@ newExtraAwareness ::
Int ->
Maybe Awareness
newExtraAwareness cr w cid
| dist cpos tpos > 600 = Nothing
| not $ canSeeIndirect (_crID cr) cid w = Nothing
| otherwise = Just . Suspicious $ doFloatFloat (_viFOV vi) ang * doFloatFloat (_viDist vi) d * awakeLevelPerception cr
where
+2
View File
@@ -202,6 +202,8 @@ movementSideEff cr w
useUpdate :: ItemUse -> ItemUse
useUpdate =
(heldHammer %~ moveHammerUp)
. (leftHammer %~ moveHammerUp)
. (leftDelay . rateTime %~ decreaseToZero)
. (heldDelay . warmTime %~ decreaseToZero)
. (heldDelay . rateTime %~ decreaseToZero)
+2
View File
@@ -3,6 +3,7 @@ Rexports all Dodge.Data.x files.
-}
module Dodge.Data (
module Dodge.Data.World,
module Dodge.Data.Scenario,
module Dodge.Data.WorldEffect,
module Dodge.Data.ArcStep,
module Dodge.Data.Config,
@@ -22,6 +23,7 @@ module Dodge.Data (
) where
import Dodge.Data.Config
import Dodge.Data.Scenario
import Dodge.Data.WorldEffect
import Dodge.Data.ActionPlan
import Dodge.Data.ArcStep
+1 -1
View File
@@ -65,7 +65,7 @@ doDrawing pdata u = do
windowPoints
(_floorTiles (_cWorld w))
)
( pokeShape'
( pokeShape
(_vboPtr $ _vaoVBO $ _shadVAO $ _shapeShader pdata)
(_eboPtr $ _shapeEBO pdata)
(_eboPtr $ _silhouetteEBO pdata)
+10 -1
View File
@@ -1,7 +1,16 @@
module Dodge.TestString where
import Dodge.Data.Universe
import Control.Lens
import Data.Maybe
testStringInit :: Universe -> [String]
testStringInit _ = []
testStringInit u = [
show $ u ^? uvWorld . hammers . ix DoubleMouseHam
, show $ u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
, fromMaybe "" $ do
i <- u ^? uvWorld . cWorld . creatures . ix 0 . crLeftInvSel . _Just
h <- u ^? uvWorld . cWorld . creatures . ix 0 . crInv . ix i . itUse . leftHammer
return $ show h
]
+1
View File
@@ -453,6 +453,7 @@ markWallSeen :: World -> Int -> World
markWallSeen !w !i = w & cWorld . walls .~ IM.adjust markSeen i (_walls (_cWorld w))
markSeen :: Wall -> Wall
{-# INLINE markSeen #-}
markSeen wl = wl{_wlSeen = True}
checkEndGame :: Universe -> Universe
+6 -6
View File
@@ -20,16 +20,16 @@ import SDL
updateUsingInput :: World -> World
updateUsingInput w = case _hudElement $ _hud (_cWorld w) of
DisplayInventory subinv ->
updatePressedButtons subinv (_mouseButtons w) w
pressedMBEffects subinv (_mouseButtons w) w
DisplayCarte ->
updatePressedButtonsCarte (_mouseButtons w) w
updatePressedButtons :: SubInventory -> M.Map MouseButton Bool -> World -> World
updatePressedButtons subinv pkeys w = case subinv of
pressedMBEffects :: SubInventory -> M.Map MouseButton Bool -> World -> World
pressedMBEffects subinv pkeys w = case subinv of
NoSubInventory
| ButtonLeft `M.member` pkeys && w ^?! hammers . ix SubInvHam /= HammerUp ->
w & hammers . ix SubInvHam .~ HammerDown
| otherwise -> updatePressedButtons' pkeys w
| otherwise -> pressedMBEffectsNoInventory pkeys w
CombineInventory mi
| pkeys ^? ix ButtonLeft == Just False ->
maybeexitcombine (maybe id doCombine mi w) & hammers . ix SubInvHam .~ HammerDown
@@ -49,8 +49,8 @@ updatePressedButtons subinv pkeys w = case subinv of
| ButtonRight `M.member` _mouseButtons w = id
| otherwise = cWorld . hud . hudElement .~ DisplayInventory NoSubInventory
updatePressedButtons' :: M.Map MouseButton Bool -> World -> World
updatePressedButtons' pkeys w
pressedMBEffectsNoInventory :: M.Map MouseButton Bool -> World -> World
pressedMBEffectsNoInventory pkeys w
| isDown ButtonLeft && isDown ButtonRight && inTopInv =
useItem (you w) w & hammers . ix DoubleMouseHam .~ HammerDown
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)