Stop equip after combining

This commit is contained in:
2023-05-15 06:46:09 +01:00
parent 1cec50c5ab
commit 0735b46266
13 changed files with 38 additions and 112 deletions
+7 -30
View File
@@ -79,44 +79,21 @@ mouseClickOptionsList screen u = fromMaybe u $ do
return $ f u
_ -> u
mouseOverSelectionList ::
ListDisplayParams ->
ScreenLayer ->
Universe ->
Universe
mouseOverSelectionList :: ListDisplayParams -> ScreenLayer -> Universe -> Universe
mouseOverSelectionList ldps screen u = fromMaybe u $ do
yi <- ldpVerticalSelection (u ^. uvConfig) ldps (u ^. uvWorld . input . mousePos)
guard $
(mmoving || (_scDisplayTime screen <= 1))
&& isselectable yi
&& yi >= 0
&& yi < ymax
-- && x > xl && x < xr
return $ u & uvScreenLayers . _head . scSelectionList . slSelPos ?~ yi
guard $ mmoving || (_scDisplayTime screen <= 1)
let myi = do
guard (yi >= 0 && yi < ymax && isselectable yi)
return yi
return $ u & uvScreenLayers . _head . scSelectionList . slSelPos .~ myi
where
-- | x > xl && x < xr
-- && ylower == yupper
-- && (mmoving || (_scDisplayTime screen <= 1)) -- slight hack
-- && isselectable =
-- u & uvScreenLayers . _head . scSelectionList . slSelPos ?~ yupper
-- | otherwise = u
sl = _scSelectionList screen
isselectable yi =
fromMaybe False $
u ^? uvScreenLayers . _head . scSelectionList . slItems . ix yi . siIsSelectable
ymax = maybe 0 length $ sl ^? slItems
ymax = maybe 0 length $ screen ^? scSelectionList . slItems
mmoving = u ^. uvWorld . input . mouseMoving
-- ylower = ceiling $ (hh - (75 + y + _ldpPosY ldps)) / 50
-- yupper = floor $ (hh - (15 + y + _ldpPosY ldps)) / 50
-- xl = _ldpPosX ldps - hw
-- xr = xl + _ldpScale ldps * 26 * 9
-- V2 _ y = u ^. uvWorld . input . mousePos
-- cfig = u ^. uvConfig
-- hh = halfHeight cfig
-- hw = halfWidth cfig
ldpVerticalSelection :: Configuration -> ListDisplayParams -> Point2 -> Maybe Int
ldpVerticalSelection cfig ldp (V2 _ y)
| yupper == ylower = Just yupper