Fix aiming with scope
This commit is contained in:
@@ -5,7 +5,6 @@ module Dodge.Update.Camera (
|
||||
updateCamera,
|
||||
) where
|
||||
|
||||
import Dodge.HeldScroll
|
||||
import Bound
|
||||
import Control.Applicative
|
||||
import Control.Monad
|
||||
@@ -127,12 +126,11 @@ moveZoomCamera cfig theinput cr campos =
|
||||
zoomInSpeed = 25
|
||||
zoomOutSpeed = 15
|
||||
|
||||
-- note that your _crInvLock does not apply to this TODO check that this is what
|
||||
-- is wanted
|
||||
updateScopeZoom :: World -> World
|
||||
updateScopeZoom w = fromMaybe w $ do
|
||||
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
|
||||
itm <- _crInv (you w) IM.!? i
|
||||
atparams <- you w ^? crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams
|
||||
guard (canHeldScrollAttach itm atparams)
|
||||
i <- yourScopeInvID w
|
||||
return $ updateScopeZoom' i w
|
||||
|
||||
updateScopeZoom' :: Int -> World -> World
|
||||
@@ -141,7 +139,7 @@ updateScopeZoom' i w
|
||||
w & wppointer %~ doScopeZoom (w ^. input . smoothScrollAmount) mp
|
||||
| otherwise = w & wppointer %~ resetscope
|
||||
where
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix (i - 1) . itUse . attachParams . scrollAttachParams
|
||||
wppointer = cWorld . lWorld . creatures . ix 0 . crInv . ix i . itUse . attachParams . scrollAttachParams
|
||||
resetscope (ZoomScrollParams _ _ defz) = ZoomScrollParams (V2 0 0) defz defz
|
||||
resetscope otherAtt = otherAtt
|
||||
mp = rotateV (w ^. wCam . camRot) $ _mousePos (_input w)
|
||||
|
||||
Reference in New Issue
Block a user