Work on more complicated terminals

This commit is contained in:
2022-05-31 13:30:27 +01:00
parent 79b3a86520
commit b54864bbda
13 changed files with 159 additions and 64 deletions
+10
View File
@@ -92,6 +92,13 @@ handlePressedMouseButton :: MouseButton -> Universe -> Maybe Universe
handlePressedMouseButton but w = case (_hudElement (_hud $ _uvWorld w), but) of
(DisplayCarte,_) -> Just $ w & uvWorld . clickMousePos .~ _mousePos (_uvWorld w)
(_,ButtonMiddle) -> Just $ w & uvWorld . clickMousePos .~ _mousePos (_uvWorld w)
( DisplayInventory (DisplayTerminal tp _) , ButtonLeft)
-> Just $ fromMaybe w
$ do -- ugly
i <- _termSel tp
f <- _termOptions tp !? i
return $ w & uvWorld %~ snd f
& uvWorld . hud . hudElement .~ DisplayInventory NoSubInventory
( DisplayInventory (CombineInventory mi) , ButtonLeft)
-> Just $ fromMaybe (w & uvWorld . hud . hudElement .~ DisplayInventory NoSubInventory)
$ do -- ugly
@@ -140,6 +147,9 @@ wheelEvent y w = case _hudElement $ _hud w of
| otherwise -> w & moveTweakSel yi
DisplayInventory (CombineInventory _) -> w
& hud . hudElement . subInventory . combineInvSel . _Just %~ ((`mod` numcombs) . subtract yi)
DisplayInventory (DisplayTerminal tp _) -> w
& hud . hudElement . subInventory . termParams . termSel . _Just
%~ ((`mod` length (_termOptions tp)) . subtract yi)
_ -> w
where
numcombs = length $ combineItemListYou w