From 1ed09fa8de517162c4fc633556f05db04bbcca84 Mon Sep 17 00:00:00 2001 From: justin Date: Mon, 4 Nov 2024 00:53:19 +0000 Subject: [PATCH] Allow selecting using mouse click in combine inventory --- ghcidOutput | 2 +- src/Dodge/Update/Input/InGame.hs | 11 +++++++---- 2 files changed, 8 insertions(+), 5 deletions(-) diff --git a/ghcidOutput b/ghcidOutput index eac2d4e21..aef019da6 100644 --- a/ghcidOutput +++ b/ghcidOutput @@ -1 +1 @@ -All good (594 modules, at 00:29:19) +All good (594 modules, at 00:48:31) diff --git a/src/Dodge/Update/Input/InGame.hs b/src/Dodge/Update/Input/InGame.hs index a21a8646a..764132a78 100644 --- a/src/Dodge/Update/Input/InGame.hs +++ b/src/Dodge/Update/Input/InGame.hs @@ -105,10 +105,13 @@ updateCombineInvClick msel sss w = fromMaybe trydocombination $ do & hud . hudElement . subInventory . ciFilter .~ Nothing _ -> w & hud . hudElement . subInventory . ciFilter ?~ ("<" ++ str) where - trydocombination = - (worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $ - tryCombine sss msel w - & worldEventFlags . at CombineInventoryChange ?~ () + trydocombination = case w ^? hud . hudElement . subInventory . ciMouseOver . _Just of + x@Just{} | x /= msel -> w & hud . hudElement . subInventory . ciSelection .~ x + & worldEventFlags . at CombineInventoryChange ?~ () + _ -> + (worldEventFlags . at InventoryChange ?~ ()) . maybeExitCombine $ + tryCombine sss msel w + & worldEventFlags . at CombineInventoryChange ?~ () --checkCombineSelectionExists :: SubInventory -> SubInventory --checkCombineSelectionExists x@CombineInventory{_ciSections=sss,_ciSelection=msel}