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]
, _timeFlow :: TimeFlowStatus
, _worldClock :: Int
, _doubleMouseHammer :: HammerPosition
}
data HUDElement = DisplayInventory {_subInventory :: SubInventory}
+1
View File
@@ -94,6 +94,7 @@ defaultWorld = World
, _maybeWorld = Nothing'
, _rewindWorlds = []
, _timeFlow = NormalTimeFlow
, _doubleMouseHammer = HammerUp
}
youLight :: TempLightSource
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
. itUse . useHammer . hammerPosition .~ HammerDown
{- | Applies a world effect after an ammo check.
Arbitrary inventory position. -}
Arbitrary inventory position -- cannot be replaced with ammoUseCheck. -}
shootL
:: (Item -> Creature -> World -> World)
-- ^ Underlying effect
+2
View File
@@ -11,6 +11,7 @@ import Dodge.SoundLogic
--import Dodge.Menu
import Dodge.Base
import Dodge.Zone
import Dodge.Hammer
import Dodge.WallCreatureCollisions
import Dodge.Update.Camera
import Dodge.Inventory
@@ -49,6 +50,7 @@ functionalUpdate cfig w = checkEndGame
-- . updateRandGen
. (worldClock +~ 1)
. doRewind
. (doubleMouseHammer %~ moveHammerUp)
. updateDistortions
. updateCreatureSoundPositions
. ppEvents
+4 -1
View File
@@ -19,9 +19,12 @@ updateUsingInput w = case _hudElement $ _hud w of
updatePressedButtons :: S.Set MouseButton -> World -> World
updatePressedButtons pkeys w
| isDown ButtonLeft && isDown ButtonRight && inTopInv
= useItem (you w) w
= useItem (you w) w & doubleMouseHammer .~ HammerDown
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)
&& _doubleMouseHammer w == HammerUp
= useLeftItem (_yourID w) w
| isDown ButtonLeft && (inTopInv || _timeFlow w == RewindingLastFrame)
= w & doubleMouseHammer .~ HammerDown
| isDown ButtonMiddle
= w & cameraRot -~ rotation
& clickMousePos .~ _mousePos w