Continue inventory tweak

This commit is contained in:
2023-02-16 17:07:59 +00:00
parent 934dd64704
commit 4afc216b25
28 changed files with 106 additions and 94 deletions
+6 -7
View File
@@ -45,7 +45,7 @@ moveZoomCamera cfig theinput cr campos =
where
cpos = _crPos cr
mitm = do
i <- cr ^? crManipulation . isel . ispItem
i <- cr ^? crManipulation . manObject . inInventory . ispItem
cr ^? crInv . ix i
newvf = cpos +.+ fromMaybe (V2 0 0) vfoffset
vfoffset = do
@@ -87,7 +87,7 @@ moveZoomCamera cfig theinput cr campos =
updateScopeZoom :: World -> World
updateScopeZoom w = fromMaybe w $ do
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . isel . ispItem
i <- w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
return $ updateScopeZoom' i w
updateScopeZoom' :: Int -> World -> World
@@ -178,13 +178,14 @@ rotateCameraBy :: Float -> CWorld -> CWorld
rotateCameraBy x w =
w
& camPos . camRot +~ x
& fromMaybe id (do
i <- w ^? lWorld . creatures . ix 0 . crManipulation . isel . ispItem
& rotateanyscope
where
rotateanyscope = fromMaybe id $ do
i <- w ^? lWorld . creatures . ix 0 . crManipulation . manObject . inInventory . ispItem
return $ lWorld . creatures . ix 0 . crInv . ix i
. itScope
. scopePos
%~ rotateV x
)
rotateCamera :: Configuration -> World -> World
rotateCamera cfig w
@@ -195,8 +196,6 @@ rotateCamera cfig w
where
keydown scode = scode `M.member` _pressedKeys (_input w) && not (inputFocus w)
--zoomCamBy :: Float -> World -> World
--zoomCamBy x w = w {_cameraZoom = max (_cameraZoom w + x) 0.01}
zoomFromItem ::
ItZoom ->
Float
+1 -1
View File
@@ -104,7 +104,7 @@ moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
changeTweakParam :: Maybe Int -> Int -> World -> World
changeTweakParam mi i w = fromMaybe w $ do
curpos <- you w ^? crManipulation . isel . ispItem
curpos <- you w ^? crManipulation . manObject . inInventory . ispItem
paramid <- mi
params <- yourItem w ^? _Just . itTweaks . tweakParams . ix paramid
let x = (_tweakVal params + i) `mod` _tweakMax params