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
+2 -2
View File
@@ -188,8 +188,8 @@ dropItem cr invid w' =
itid <- cr ^? crInv . ix (NInt invid)
w' ^? cWorld . lWorld . items . ix itid
maybeshiftseldown w = fromMaybe w $ do
3 <- w ^? hud . hudElement . diSelection . _Just . _1
return $ w & hud . hudElement . diSelection . _Just . _2 +~ 1
3 <- w ^? hud . diSelection . _Just . _1
return $ w & hud . diSelection . _Just . _2 +~ 1
-- | Get your creature to drop the item under the cursor.
youDropItem :: World -> World
+6 -6
View File
@@ -106,11 +106,11 @@ toggleEquipmentAt invid cr w = case getEquipmentAllocation invid w of
onremove itm' = effectOnRemove itm'
toggleExamineInv :: World -> World
toggleExamineInv w = case w ^? hud . hudElement . subInventory of
Just ExamineInventory{} -> w & hud . hudElement . subInventory .~ NoSubInventory
_ -> w & hud . hudElement . subInventory .~ ExamineInventory
toggleExamineInv w = case w ^? hud . subInventory of
Just ExamineInventory{} -> w & hud . subInventory .~ NoSubInventory
_ -> w & hud . subInventory .~ ExamineInventory
toggleMapperInv :: Item -> World -> World
toggleMapperInv itm w = case w ^? hud . hudElement . subInventory of
Just MapperInventory{} -> w & hud . hudElement . subInventory .~ NoSubInventory
_ -> w & hud . hudElement . subInventory .~ MapperInventory 0 1 (_itID itm)
toggleMapperInv itm w = case w ^? hud . subInventory of
Just MapperInventory{} -> w & hud . subInventory .~ NoSubInventory
_ -> w & hud . subInventory .~ MapperInventory 0 1 (_itID itm)
+1 -1
View File
@@ -29,7 +29,7 @@ import qualified SDL
yourControl :: Creature -> World -> World
yourControl _ w
| inTextInputFocus w = w
| Just x <- w ^? hud . hudElement . subInventory
| Just x <- w ^? hud . subInventory
, f x =
w
& cWorld . lWorld . creatures . ix 0 %~ wasdWithAiming w