diff --git a/src/Dodge/Data.hs b/src/Dodge/Data.hs index 2b4aaa840..2999e8efd 100644 --- a/src/Dodge/Data.hs +++ b/src/Dodge/Data.hs @@ -132,6 +132,7 @@ data World = World , _rewindWorlds :: [World] , _timeFlow :: TimeFlowStatus , _worldClock :: Int + , _doubleMouseHammer :: HammerPosition } data HUDElement = DisplayInventory {_subInventory :: SubInventory} diff --git a/src/Dodge/Default/World.hs b/src/Dodge/Default/World.hs index 35c1d41da..38820a34c 100644 --- a/src/Dodge/Default/World.hs +++ b/src/Dodge/Default/World.hs @@ -94,6 +94,7 @@ defaultWorld = World , _maybeWorld = Nothing' , _rewindWorlds = [] , _timeFlow = NormalTimeFlow + , _doubleMouseHammer = HammerUp } youLight :: TempLightSource youLight = diff --git a/src/Dodge/Item/Weapon/TriggerType.hs b/src/Dodge/Item/Weapon/TriggerType.hs index 85c334e3d..8be49fdce 100644 --- a/src/Dodge/Item/Weapon/TriggerType.hs +++ b/src/Dodge/Item/Weapon/TriggerType.hs @@ -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 diff --git a/src/Dodge/Update.hs b/src/Dodge/Update.hs index 495ac2346..d2fa382db 100644 --- a/src/Dodge/Update.hs +++ b/src/Dodge/Update.hs @@ -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 diff --git a/src/Dodge/Update/UsingInput.hs b/src/Dodge/Update/UsingInput.hs index 7bca3b163..07d880432 100644 --- a/src/Dodge/Update/UsingInput.hs +++ b/src/Dodge/Update/UsingInput.hs @@ -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