Cleanup inventory management, tweak dragging start
This commit is contained in:
@@ -103,8 +103,6 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
where
|
||||
mremotepos = do
|
||||
Sel 0 i <- w^?hud .diSelection._Just
|
||||
--revise1 i <- cr ^? crManipulation . manObject . imSelectedItem
|
||||
--revise2 i <- w^?hud . manObject . imSelectedItem
|
||||
itid <- cr ^? crInv . ix (NInt i)
|
||||
j <- w ^? cWorld . lWorld . items . ix itid . itUse . uaParams . apProjectiles . ix 0
|
||||
guard $ Just REMOTESCREEN == w ^? cWorld . lWorld . items . ix itid . itType . ibtAttach
|
||||
@@ -113,7 +111,6 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
offset = fromMaybe noscopeoffset $ do
|
||||
guard (SDL.ButtonRight `M.member` _mouseButtons theinput)
|
||||
Sel 0 i <- w^?hud.diSelection._Just
|
||||
--revise2 i <- w^?hud . manObject . imSelectedItem
|
||||
itid <- cr ^? crInv . ix (NInt i)
|
||||
fmap docamrot (w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticPos)
|
||||
noscopeoffset =
|
||||
@@ -121,19 +118,16 @@ moveZoomCamera cfig theinput cr w campos =
|
||||
((newzoom - newDefaultZoom) / (newDefaultZoom * newzoom)) *.* _mousePos theinput
|
||||
newzoom = fromMaybe (newDefaultZoom * newItemZoom) $ do
|
||||
Sel 0 i <- w^?hud .diSelection._Just
|
||||
--revise2 i <- w^?hud . manObject . imSelectedItem
|
||||
itid <- cr ^? crInv . ix (NInt i)
|
||||
w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticZoom
|
||||
idealDefaultZoom = clipZoom wallZoom
|
||||
newDefaultZoom = fromMaybe (changeZoom (campos ^. camDefaultZoom) idealDefaultZoom) $ do
|
||||
Sel 0 i <- w^?hud .diSelection._Just
|
||||
--revise2 i <- w^?hud . manObject . imSelectedItem
|
||||
itid <- cr ^? crInv . ix (NInt i)
|
||||
w ^? cWorld . lWorld . items . ix itid . itUse . uScope . opticZoom
|
||||
idealItemZoom = fromMaybe 1 $ do
|
||||
guard $ crIsAiming cr
|
||||
Sel 0 i <- w^?hud .diSelection._Just
|
||||
--revise2 i <- w^?hud . manObject . imSelectedItem
|
||||
itid <- cr ^? crInv . ix (NInt i)
|
||||
getAimZoom <$> (w ^? cWorld . lWorld . items . ix itid)
|
||||
newItemZoom = changeZoom (campos ^. camItemZoom) idealItemZoom
|
||||
|
||||
@@ -301,9 +301,9 @@ endCombineRegex w = ssSetCursor (ssLookupDown 0 j) sss
|
||||
return (k - 1)
|
||||
|
||||
startDrag :: (Int, Int) -> World -> World
|
||||
startDrag (a, b) w = setcontext $ fromMaybe (invSetSelection (Sel a b) w) $ do
|
||||
startDrag (a, b) w = setcontext $ fromMaybe (invSetSelection (Sel a b) w & hud.diSections.ix a.ssSet.~ mempty) $ do
|
||||
i <- w ^? hud . diSelection . _Just . slSec
|
||||
xs <- w ^? hud . diSections . ix i . ssSet
|
||||
xs <- w ^? hud . diSections . ix a . ssSet
|
||||
guard $ i == a && b `IS.member` xs
|
||||
return w
|
||||
where
|
||||
|
||||
@@ -34,24 +34,22 @@ updateBaseWheelEvent yi w
|
||||
EquipOptions{} -> w & rbState . opSel %~ scrollRBOption yi rbscrollmax
|
||||
NoRightButtonState -> fromMaybe w (selectedItemScroll yi w)
|
||||
| bdown ButtonLeft = w & wCam . camZoom +~ fromIntegral yi
|
||||
| ScancodeCapsLock `M.member` _pressedKeys (_input w)
|
||||
, ScancodeLShift `M.member` (w ^. input . pressedKeys) = changeSwapSel yi w
|
||||
| ScancodeCapsLock `M.member` _pressedKeys (_input w) = changeSwapSelSet yi w
|
||||
| ScancodeLShift `M.member` (w ^. input . pressedKeys) = multiSelScroll yi w
|
||||
| kdown ScancodeCapsLock
|
||||
, kdown ScancodeLShift = changeSwapSel yi w
|
||||
| kdown ScancodeCapsLock = changeSwapSelSet yi w
|
||||
| kdown ScancodeLShift = multiSelScroll yi w
|
||||
| otherwise = scrollAugInvSel yi w
|
||||
where
|
||||
kdown k = k `M.member` (w ^. input . pressedKeys)
|
||||
bdown b = w & has (input . mouseButtons . ix b)
|
||||
rbscrollmax = fromMaybe 1 $ do
|
||||
Sel 0 invid <- w ^. hud.diSelection
|
||||
--revise2 invid <- w ^? hud . manObject . imSelectedItem
|
||||
--revise1 invid <- you w ^? crManipulation . manObject . imSelectedItem
|
||||
etype <- you w ^? crInv . ix (NInt invid) >>= \k -> w ^? cWorld . lWorld . items . ix k >>= equipType
|
||||
return . length $ eqTypeToSites etype
|
||||
|
||||
selectedItemScroll :: Int -> World -> Maybe World
|
||||
selectedItemScroll yi w = do
|
||||
Sel 0 i <- w ^.hud.diSelection
|
||||
--revise2 i <- w ^? hud . manObject . imSelectedItem
|
||||
itm <- you w ^? crInv . ix (NInt i) >>= \k -> w ^? cWorld . lWorld . items . ix k
|
||||
return $ itemScroll yi itm w
|
||||
|
||||
|
||||
Reference in New Issue
Block a user