Rethink selection lists as intmaps

This commit is contained in:
2023-01-15 23:17:47 +00:00
parent 17734738f6
commit 048135c370
17 changed files with 245 additions and 93 deletions
+5 -3
View File
@@ -3,6 +3,7 @@ module Dodge.Update.UsingInput (
updateUsingInput,
) where
import Dodge.Data.SelectionList
import Control.Lens
import qualified Data.Map.Strict as M
import Dodge.Base.You
@@ -30,11 +31,12 @@ pressedMBEffects subinv pkeys w = case subinv of
| ButtonLeft `M.member` pkeys && w ^?! input . hammers . ix SubInvHam /= HammerUp ->
w & input . hammers . ix SubInvHam .~ HammerDown
| otherwise -> pressedMBEffectsNoInventory pkeys w
CombineInventory mi _ False
CombineInventory SelectionIntMap {_smSelPos = mi, _smRegexInput = False}
| pkeys ^? ix ButtonLeft == Just False ->
maybeexitcombine (maybe id doCombine mi w) & input . hammers . ix SubInvHam .~ HammerDown
CombineInventory _ _ True | pkeys ^? ix ButtonLeft == Just False
-> w & hud . hudElement . subInventory . subInvRegexInput .~ False
CombineInventory SelectionIntMap {_smRegexInput = True}
| pkeys ^? ix ButtonLeft == Just False
-> w & hud . hudElement . subInventory . subInvMap . smRegexInput .~ False
DisplayTerminal tmid
| pkeys ^? ix ButtonLeft == Just False && inTermFocus w ->
doTerminalEffectLB (w ^?! cWorld . lWorld . terminals . ix tmid) w