Flatten HUDElement

This commit is contained in:
2025-08-26 16:46:02 +01:00
parent 596880f76a
commit 9034c409e1
24 changed files with 255 additions and 270 deletions
+8 -8
View File
@@ -333,11 +333,11 @@ updateMagnets lw =
checkTermDist :: World -> World
checkTermDist w = fromMaybe w $ do
tmid <- w ^? hud . hudElement . subInventory . termID
tmid <- w ^? hud . subInventory . termID
btid <- w ^? cWorld . lWorld . terminals . ix tmid . tmButtonID
btpos <- w ^? cWorld . lWorld . buttons . ix btid . btPos
guard $ dist btpos (_crPos $ you w) > 40
return $ w & hud . hudElement . subInventory .~ NoSubInventory
return $ w & hud . subInventory .~ NoSubInventory
updateMouseContext :: Configuration -> Universe -> Universe
updateMouseContext cfig u = case u ^? uvScreenLayers . ix 0 of
@@ -363,13 +363,13 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
| otherwise = MouseInGame
mpos = w ^. input . mousePos
invdrag i' = fromMaybe (OverInvDrag i' Nothing) $ do
sss <- w ^? hud . hudElement . diSections
sss <- w ^? hud . diSections
(i, j) <- inverseSelNumPos cfig invDP sss mpos
return $ OverInvDrag i' (Just (i, j))
overinv = do
sss <- w ^? hud . hudElement . diSections
sss <- w ^? hud . diSections
selpos@(i, j) <- inverseSelNumPos cfig invDP sss mpos
case w ^? hud . hudElement . subInventory . ciSelection of
case w ^? hud . subInventory . ciSelection of
Just _ | i == 0 -> return $ OverCombFiltInv selpos
Just _ -> Nothing
_ -> do
@@ -377,8 +377,8 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
guard =<< sss ^? ix i . ssItems . ix j . siIsSelectable
return $ OverInvSelect selpos
overcomb = do
sss <- w ^? hud . hudElement . subInventory . ciSections
(xl, xr, _) <- w ^? hud . hudElement . subInventory . ciSelection . _Just
sss <- w ^? hud . subInventory . ciSections
(xl, xr, _) <- w ^? hud . subInventory . ciSelection . _Just
let msel = (xl, xr)
let mpossel = inverseSelNumPos cfig secondColumnParams sss (w ^. input . mousePos)
return $ case mpossel of
@@ -387,7 +387,7 @@ updateMouseContextGame cfig u = case u ^. uvWorld . input . mouseContext of
Just x | x == msel -> OverCombCombine x
Just x -> OverCombSelect x
overterm = do
tmid <- w ^? hud . hudElement . subInventory . termID
tmid <- w ^? hud . subInventory . termID
tm <- w ^? cWorld . lWorld . terminals . ix tmid
return $
if isOverTerminalScreen cfig mpos