Add hammer for left click items when holding down right click
This commit is contained in:
@@ -132,6 +132,7 @@ data World = World
|
||||
, _rewindWorlds :: [World]
|
||||
, _timeFlow :: TimeFlowStatus
|
||||
, _worldClock :: Int
|
||||
, _doubleMouseHammer :: HammerPosition
|
||||
}
|
||||
|
||||
data HUDElement = DisplayInventory {_subInventory :: SubInventory}
|
||||
|
||||
@@ -94,6 +94,7 @@ defaultWorld = World
|
||||
, _maybeWorld = Nothing'
|
||||
, _rewindWorlds = []
|
||||
, _timeFlow = NormalTimeFlow
|
||||
, _doubleMouseHammer = HammerUp
|
||||
}
|
||||
youLight :: TempLightSource
|
||||
youLight =
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user