Add support for left click actions
This commit is contained in:
@@ -78,8 +78,7 @@ itemLaserScopeEffect
|
||||
| _wpLoadedAmmo it == 0 = 1
|
||||
| otherwise = fromIntegral (_wpReloadState it) / fromIntegral (_wpReloadTime it)
|
||||
col = mixColors reloadFrac (1-reloadFrac) red green
|
||||
{- |
|
||||
Automatically send out radar pulses that detect walls. -}
|
||||
{- | Automatically send out radar pulses that detect walls. -}
|
||||
autoRadarEffect :: ItEffect
|
||||
autoRadarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||
where
|
||||
@@ -90,28 +89,27 @@ autoRadarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||
f t _ cr i w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix i
|
||||
. itEffect . itInvEffect .~ f (t-1)
|
||||
{- |
|
||||
Automatically send out sonar pulses that detect creatures. -}
|
||||
{- | Automatically send out sonar pulses that detect creatures. -}
|
||||
autoSonarEffect :: ItEffect
|
||||
autoSonarEffect = ItInvEffect {_itInvEffect = f 50 ,_itEffectCounter = 0 }
|
||||
where
|
||||
f :: Int -> ItEffect -> Creature -> Int -> World -> World
|
||||
f 0 _ cr i w = aSonarPulse cr
|
||||
w & creatures . ix (_crID cr) . crInv . ix i
|
||||
. itEffect . itInvEffect .~ f 140
|
||||
f t _ cr i w = w & creatures . ix (_crID cr) . crInv . ix i
|
||||
. itEffect . itInvEffect .~ f (t-1)
|
||||
f 0 _ cr i w = aSonarPulse cr w
|
||||
& creatures . ix (_crID cr) . crInv . ix i . itEffect . itInvEffect .~ f 140
|
||||
f t _ cr i w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix i . itEffect . itInvEffect .~ f (t-1)
|
||||
|
||||
bezierTargetEffect :: ItEffect
|
||||
bezierTargetEffect = ItInvEffect
|
||||
{_itInvEffect = setBezierTarget
|
||||
rbSetTarget :: ItEffect
|
||||
rbSetTarget = ItInvEffect
|
||||
{_itInvEffect = setTarg
|
||||
,_itEffectCounter = 0
|
||||
}
|
||||
setBezierTarget :: ItEffect -> Creature -> Int -> World -> World
|
||||
setBezierTarget _ cr invid w
|
||||
| _crInvSel cr /= invid = w
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix invid . itAttachment
|
||||
%~ maybe (Just $ ItTargetPos $ mouseWorldPos w) Just
|
||||
| otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itAttachment .~ Nothing
|
||||
where
|
||||
setTarg :: ItEffect -> Creature -> Int -> World -> World
|
||||
setTarg _ cr invid w
|
||||
| _crInvSel cr /= invid = w
|
||||
| SDL.ButtonRight `S.member` _mouseButtons w = w
|
||||
& creatures . ix (_crID cr) . crInv . ix invid . itAttachment
|
||||
%~ maybe (Just $ ItTargetPos $ mouseWorldPos w) Just
|
||||
| otherwise = w & creatures . ix (_crID cr) . crInv . ix invid . itAttachment .~ Nothing
|
||||
|
||||
|
||||
Reference in New Issue
Block a user