Stop equip after combining
This commit is contained in:
@@ -253,7 +253,8 @@ tryCombine :: SelectionSections CombinableItem -> World -> World
|
||||
tryCombine sss w = fromMaybe w $ do
|
||||
(i, j) <- sss ^? sssExtra . sssSelPos . _Just
|
||||
CombinableItem is it _ <- sss ^? sssSections . ix i . ssItems . ix j . siPayload
|
||||
return $ createAndSelectItem it $ foldr (rmInvItem 0) w (sort is)
|
||||
return $ createAndSelectItem it (foldr (rmInvItem 0) w (sort is))
|
||||
& cWorld . lWorld . creatures . ix 0 . crHammerPosition .~ HammerDown
|
||||
|
||||
maybeExitCombine :: Universe -> Universe
|
||||
maybeExitCombine u
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user