Move towards unifying (your) creature manipulation with selection

This commit is contained in:
2026-05-14 13:42:33 +01:00
parent ab393febcb
commit 59d128f87a
35 changed files with 271 additions and 252 deletions
+6 -5
View File
@@ -101,7 +101,8 @@ moveZoomCamera cfig theinput cr w campos =
& camItemZoom .~ newItemZoom
where
mremotepos = do
i <- cr ^? crManipulation . manObject . imSelectedItem
i <- w^?hud . manObject . imSelectedItem
--revise1 i <- cr ^? crManipulation . manObject . imSelectedItem
itid <- cr ^? crInv . ix i
j <- w ^? cWorld . lWorld . items . ix itid . itUse . uaParams . apProjectiles . ix 0
guard $ Just REMOTESCREEN == w ^? cWorld . lWorld . items . ix itid . itType . ibtAttach
@@ -109,24 +110,24 @@ moveZoomCamera cfig theinput cr w campos =
docamrot = rotateV (campos ^. camRot)
offset = fromMaybe noscopeoffset $ do
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
i <- cr ^? crManipulation . manObject . imSelectedItem
i <- w^?hud . manObject . imSelectedItem
itid <- cr ^? crInv . ix i
fmap docamrot (w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticPos)
noscopeoffset =
docamrot $
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
i <- cr ^? crManipulation . manObject . imSelectedItem
i <- w^?hud . manObject . imSelectedItem
itid <- cr ^? crInv . ix i
w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticZoom
idealDefaultZoom = clipZoom wallZoom
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
i <- cr ^? crManipulation . manObject . imSelectedItem
i <- w^?hud . manObject . imSelectedItem
itid <- cr ^? crInv . ix i
w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticZoom
idealItemZoom = fromMaybe 1 $ do
guard $ crIsAiming cr
i <- cr ^? crManipulation . manObject . imSelectedItem
i <- w^?hud . manObject . imSelectedItem
itid <- cr ^? crInv . ix i
getAimZoom <$> (w ^? cWorld . lWorld . items . ix itid)
newItemZoom = changeZoom (campos ^. camItemZoom) idealItemZoom
+3 -2
View File
@@ -42,13 +42,14 @@ updateBaseWheelEvent yi w
where
bdown b = w & has (input . mouseButtons . ix b)
rbscrollmax = fromMaybe 1 $ do
invid <- you w ^? crManipulation . manObject . imSelectedItem
invid <- w ^? hud . manObject . imSelectedItem
--revise1 invid <- you w ^? crManipulation . manObject . imSelectedItem
etype <- you w ^? crInv . ix invid >>= \k -> w ^? cWorld . lWorld . items . ix k >>= equipType
return . length $ eqTypeToSites etype
selectedItemScroll :: Int -> World -> Maybe World
selectedItemScroll yi w = do
i <- you w ^? crManipulation . manObject . imSelectedItem
i <- w ^? hud . manObject . imSelectedItem
itm <- you w ^? crInv . ix i >>= \k -> w ^? cWorld . lWorld . items . ix k
return $ itemScroll yi itm w