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
+1 -1
View File
@@ -43,7 +43,7 @@ tryPutItemInInv cid itid w = do
& updateselectionextra invid
where
updateselectionextra i
| cid == 0 = hud . hudElement . diSelection . _Just . _3 %~ IS.map (f i)
| cid == 0 = hud . diSelection . _Just . _3 %~ IS.map (f i)
| otherwise = id
f j i | i >= _unNInt j = i + 1
| otherwise = i
+1 -1
View File
@@ -97,7 +97,7 @@ setInvPosFromSS w = w
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject .~ thesel
where
thesel = fromMaybe SelNothing $ do
(i, j, _) <- w ^? hud . hudElement . diSelection . _Just
(i, j, _) <- w ^? hud . diSelection . _Just
case i of
(-1) -> Just SortInventory
0 -> do
+1 -1
View File
@@ -88,7 +88,7 @@ itemExternalValue itm w cr
displayPulse $ cr ^?! crType . avatarPulse . pulseProgress
| Just t <- itm ^? itType . ibtIntroScanType = Just $ introScanValue cr t
| ITEMSCAN <- itm ^. itType
, Just ExamineInventory <- w ^? hud . hudElement . subInventory
, Just ExamineInventory <- w ^? hud . subInventory
= Just (Right "ON")
| BINGATE <- itm ^. itType = do
invid <- itm ^? itLocation . ilInvID
+6 -6
View File
@@ -24,11 +24,11 @@ swapInvItems ::
World ->
World
swapInvItems f i w = fromMaybe w $ do
ss <- w ^? hud . hudElement . diSections . ix 0 . ssItems
ss <- w ^? hud . diSections . ix 0 . ssItems
k <- f i ss
let updateselection = case w ^? hud . hudElement . diSelection . _Just of
Just (0, j,_) | j == k -> hud . hudElement . diSelection . _Just . _2 .~ i
Just (0, j,_) | j == i -> hud . hudElement . diSelection . _Just . _2 .~ k
let updateselection = case w ^? hud . diSelection . _Just of
Just (0, j,_) | j == k -> hud . diSelection . _Just . _2 .~ i
Just (0, j,_) | j == i -> hud . diSelection . _Just . _2 .~ k
_ -> id
return $
w
@@ -55,11 +55,11 @@ swapInvItems f i w = fromMaybe w $ do
swapAnyExtraSelection :: Int -> Int -> World -> World
swapAnyExtraSelection i k w = fromMaybe w $ do
is <- w ^? hud . hudElement . diSelection . _Just . _3
is <- w ^? hud . diSelection . _Just . _3
let f = if i `IS.member` is then IS.insert k else id
g = if k `IS.member` is then IS.insert i else id
return $
w & hud . hudElement . diSelection . _Just . _3
w & hud . diSelection . _Just . _3
%~ (f . g . IS.delete i . IS.delete k)
checkConnection :: SoundOrigin -> SoundID -> Int -> Int -> World -> World