Add hammer for left click items when holding down right click

This commit is contained in:
2022-05-23 14:04:10 +01:00
parent a870457f2a
commit dcd3fdf563
5 changed files with 9 additions and 2 deletions
+1
View File
@@ -132,6 +132,7 @@ data World = World
, _rewindWorlds :: [World] , _rewindWorlds :: [World]
, _timeFlow :: TimeFlowStatus , _timeFlow :: TimeFlowStatus
, _worldClock :: Int , _worldClock :: Int
, _doubleMouseHammer :: HammerPosition
} }
data HUDElement = DisplayInventory {_subInventory :: SubInventory} data HUDElement = DisplayInventory {_subInventory :: SubInventory}
+1
View File
@@ -94,6 +94,7 @@ defaultWorld = World
, _maybeWorld = Nothing' , _maybeWorld = Nothing'
, _rewindWorlds = [] , _rewindWorlds = []
, _timeFlow = NormalTimeFlow , _timeFlow = NormalTimeFlow
, _doubleMouseHammer = HammerUp
} }
youLight :: TempLightSource youLight :: TempLightSource
youLight = youLight =
+1 -1
View File
@@ -342,7 +342,7 @@ hammerCheckL f itm cr w = case itm ^? itUse . useHammer . hammerPosition of
setHammerDown = creatures . ix cid . crInv . ix invid setHammerDown = creatures . ix cid . crInv . ix invid
. itUse . useHammer . hammerPosition .~ HammerDown . itUse . useHammer . hammerPosition .~ HammerDown
{- | Applies a world effect after an ammo check. {- | Applies a world effect after an ammo check.
Arbitrary inventory position. -} Arbitrary inventory position -- cannot be replaced with ammoUseCheck. -}
shootL shootL
:: (Item -> Creature -> World -> World) :: (Item -> Creature -> World -> World)
-- ^ Underlying effect -- ^ Underlying effect
+2
View File
@@ -11,6 +11,7 @@ import Dodge.SoundLogic
--import Dodge.Menu --import Dodge.Menu
import Dodge.Base import Dodge.Base
import Dodge.Zone import Dodge.Zone
import Dodge.Hammer
import Dodge.WallCreatureCollisions import Dodge.WallCreatureCollisions
import Dodge.Update.Camera import Dodge.Update.Camera
import Dodge.Inventory import Dodge.Inventory
@@ -49,6 +50,7 @@ functionalUpdate cfig w = checkEndGame
-- . updateRandGen -- . updateRandGen
. (worldClock +~ 1) . (worldClock +~ 1)
. doRewind . doRewind
. (doubleMouseHammer %~ moveHammerUp)
. updateDistortions . updateDistortions
. updateCreatureSoundPositions . updateCreatureSoundPositions
. ppEvents . ppEvents
+4 -1
View File
@@ -19,9 +19,12 @@ updateUsingInput w = case _hudElement $ _hud w of
updatePressedButtons :: S.Set MouseButton -> World -> World updatePressedButtons :: S.Set MouseButton -> World -> World
updatePressedButtons pkeys w updatePressedButtons pkeys w
| isDown ButtonLeft && isDown ButtonRight && inTopInv | isDown ButtonLeft && isDown ButtonRight && inTopInv
= useItem (you w) w = useItem (you w) w & doubleMouseHammer .~ HammerDown
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame) | isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)
&& _doubleMouseHammer w == HammerUp
= useLeftItem (_yourID w) w = useLeftItem (_yourID w) w
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)
= w & doubleMouseHammer .~ HammerDown
| isDown ButtonMiddle | isDown ButtonMiddle
= w & cameraRot -~ rotation = w & cameraRot -~ rotation
& clickMousePos .~ _mousePos w & clickMousePos .~ _mousePos w