Cleanup dragging

This commit is contained in:
2026-05-13 11:58:41 +01:00
parent 91480c957d
commit 9df23c27c2
3 changed files with 278 additions and 170 deletions
+5
View File
@@ -44,4 +44,9 @@ data CardinalCover
data XInfinity a = NegInf | NonInf {_nonInf :: a} | PosInf
deriving (Eq, Ord, Show)
instance Functor XInfinity where
fmap f (NonInf x) = NonInf (f x)
fmap _ NegInf = NegInf
fmap _ PosInf = PosInf
makeLenses ''XInfinity
+240 -137
View File
@@ -5,10 +5,6 @@ module Dodge.Update.Input.InGame (
updateMouseInGame,
) where
import Dodge.Data.ScreenPos
import Geometry.Data
import Dodge.Base.Coordinate
import Dodge.Button.Event
import Control.Applicative
import Control.Monad
import Data.Foldable
@@ -19,10 +15,13 @@ import qualified Data.Map.Strict as M
import Data.Maybe
import Data.Monoid
import Dodge.Base.Collide
import Dodge.Base.Coordinate
import Dodge.Button.Event
import Dodge.Camera
import Dodge.Creature.Action
import Dodge.Data.CardinalPoint
import Dodge.Data.Combine
import Dodge.Data.ScreenPos
import Dodge.Data.Terminal.Status
import Dodge.Data.Universe
import Dodge.DisplayInventory
@@ -41,6 +40,7 @@ import Dodge.SoundLogic
import Dodge.Terminal
import Dodge.Update.Input.DebugTest
import Dodge.Update.Input.Text
import Geometry.Data
import Geometry.Vector
import LensHelp
import NewInt
@@ -49,38 +49,32 @@ import SDL
updateUseInputInGame :: Universe -> Universe
updateUseInputInGame u = updateFunctionKeys $ case u ^. uvWorld . hud . subInventory of
DisplayTerminal tmid -> updateKeysInTerminal tmid u
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just (Sel (-1) _))} ->
u
& tohud . subInventory %~ docombineregexinput sss msel
& uvWorld . worldEventFlags . at CombineInventoryChange ?~ ()
_ | disel == Just (-1) ->
u
& tohud %~ dodisplayregexinput diInvFilter diInvFilter (-1)
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
& uvWorld %~ setInvPosFromSS
_ | disel == Just 2 ->
u
& tohud %~ dodisplayregexinput diCloseFilter diCloseFilter 2
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
& uvWorld %~ setInvPosFromSS
CombineInventory{_ciSections = sss, _ciSelection = msel@(Just (Sel (-1) _))} -> u
& uvWorld . hud . subInventory %~ docombineregexinput sss msel
& uvWorld . worldEventFlags . at CombineInventoryChange ?~ ()
_ | Just (-1) <- disel -> f diInvFilter diInvFilter (-1)
_ | Just 2 <- disel -> f diCloseFilter diCloseFilter 2
_ -> updateKeysInGame u
where
disel = u ^? uvWorld . hud . diSelection . _Just . slSec
tohud = uvWorld . hud
f x y i = u
& uvWorld . hud %~ dodisplayregexinput x y i
& uvWorld . worldEventFlags . at InventoryChange ?~ ()
& uvWorld %~ setInvPosFromSS
dodisplayregexinput filterprism filterlens x di = fromMaybe di $ do
sss <- di ^? diSections
msel <- di ^? diSelection
filts <- di ^? filterprism
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) x sss msel filts
return $
di & diSections .~ sss'
return $ di
& diSections .~ sss'
& diSelection .~ msel'
& filterlens .~ filts'
docombineregexinput sss msel ci = fromMaybe ci $ do
filts <- ci ^? ciFilter
let (sss', msel', filts') = doRegexInput (u ^. uvWorld . input) (-1) sss msel filts
return $
ci & ciSections .~ sss'
return $ ci
& ciSections .~ sss'
& ciSelection .~ msel'
& ciFilter .~ filts'
@@ -103,26 +97,23 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
| ButtonRight `M.member` (w ^. input . mouseButtons) ->
w & input . mouseContext .~ MouseGameRotate (dist (mouseWorldPosW w) (w ^. wCam . camCenter))
OverInvDragSelect (Just sstart) _ ->
let sss = w ^. hud . diSections
in case inverseSelNumPos cfig invDP (w ^. input . mousePos) sss of
Nothing -> w & input . mouseContext . mcoSelEnd .~ Nothing
Just (NonInf (i, j))
| i == fst sstart -> w & input . mouseContext . mcoSelEnd ?~ j
| i < fst sstart -> w & input . mouseContext . mcoSelEnd ?~ 0
| otherwise -> w
& input . mouseContext . mcoSelEnd
.~ fmap
fst
(IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
Just NegInf -> w & input . mouseContext . mcoSelEnd ?~ 0
Just PosInf ->
w & input . mouseContext . mcoSelEnd
.~ fmap
fst
(IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
case inverseSelNumPos cfig invDP (w ^. input . mousePos) sss of
Nothing -> w & input . mouseContext . mcoSelEnd .~ Nothing
Just m
| fmap fst m == NonInf (fst sstart) -> w & input . mouseContext . mcoSelEnd ?~ (m ^?! nonInf . _2)
| fmap fst m < NonInf (fst sstart) -> w & input . mouseContext . mcoSelEnd ?~ 0
| otherwise -> w & input . mouseContext . mcoSelEnd .~
fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
-- Just (NonInf (i, j))
-- | i == fst sstart -> w & input . mouseContext . mcoSelEnd ?~ j
-- | i < fst sstart -> w & input . mouseContext . mcoSelEnd ?~ 0
-- | otherwise -> w & input . mouseContext . mcoSelEnd .~
-- fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
-- Just NegInf -> w & input . mouseContext . mcoSelEnd ?~ 0
-- Just PosInf -> w & input . mouseContext . mcoSelEnd .~
-- fmap fst (IM.lookupMax =<< sss ^? ix (fst sstart) . ssItems)
-- not sure how the above performs when filtering...
OverInvDragSelect Nothing _ -> fromMaybe w $ do
sss <- w ^? hud . diSections
ysel <-
inverseSelSecYint
(posSelSecYint cfig invDP (w ^. input . mousePos . _y))
@@ -133,16 +124,20 @@ updateMouseHeldInGame cfig w = case w ^. input . mouseContext of
OverInvDrag k mmouseover -> doDrag cfig 30 k mmouseover w
OverTerminalBar p -> w & tmLDP %~ setPixelOffsetBounded cfig (p + w ^. input . mousePos)
_ -> w
where
sss = w ^. hud . diSections
setPixelOffsetBounded :: Config -> Point2 -> LDParams -> LDParams
setPixelOffsetBounded cfig (V2 x y) ldp = ldp & ldpPos . spPixelOff .~ V2 x' y'
where
h = fromIntegral $ cfig ^. windowY
w = fromIntegral $ cfig ^. windowX
x' = min (w - (w*a + 1+10*ldp ^?! ldpSize . _Just . _x . to fromIntegral))
$ max (1 - w * a) x
y' = min (h-(h*b + 20))
$ max (1+20*(ldp^.ldpVerticalGap + ldp^?!ldpSize._Just._y.to fromIntegral)-h*b) y
x' =
min (w - (w * a + 1 + 10 * ldp ^?! ldpSize . _Just . _x . to fromIntegral)) $
max (1 - w * a) x
y' =
min (h - (h * b + 20)) $
max (1 + 20 * (ldp ^. ldpVerticalGap + ldp ^?! ldpSize . _Just . _y . to fromIntegral) - h * b) y
V2 a b = ldp ^. ldpPos . spScreenOff
doDrag :: Config -> Int -> Int -> Maybe (Int, Int) -> World -> World
@@ -164,10 +159,12 @@ tryDropSelected mpos w = do
j <- w ^? hud . diSelection . _Just . slInt
xs <- selectionSet w
let xmin = IS.findMin xs
return
. (hud . diSelection ?~ Sel 3 (j-xmin) )
. (hud . diSections . ix 3 . ssSet .~ IS.fromDistinctAscList [0..IS.size xs - 1])
. foldl' (flip $ dropItem cr) w . IS.toDescList $ xs
return
. (hud . diSelection ?~ Sel 3 (j - xmin))
. (hud . diSections . ix 3 . ssSet .~ IS.fromDistinctAscList [0 .. IS.size xs - 1])
. foldl' (flip $ dropItem cr) w
. IS.toDescList
$ xs
selectionSet :: World -> Maybe IS.IntSet
selectionSet w = do
@@ -175,12 +172,12 @@ selectionSet w = do
case w ^? hud . diSections . ix j . ssSet of
Just is | not $ IS.null is -> Just is
_ -> IS.singleton <$> w ^? hud . diSelection . _Just . slInt
--selectionSet :: World -> Maybe IS.IntSet
--selectionSet w = case w ^? hud . diSelection . _Just . slSet of
-- selectionSet :: World -> Maybe IS.IntSet
-- selectionSet w = case w ^? hud . diSelection . _Just . slSet of
-- Just is' | not $ IS.null is' -> Just is'
-- _ -> IS.singleton <$> w ^? hud . diSelection . _Just . slInt
tryPickupSelected :: Int -> Maybe (Int, Int) -> World -> Maybe World
tryPickupSelected k mpos w = do
guard $ k == 3
@@ -200,9 +197,9 @@ tryPickupSelected k mpos w = do
_ -> foldl' (flip $ pickUpItem 0) w ispickup & newdisel (length (cr ^. crInv)) joff xs
where
newdisel j joff xs =
-- hud . diSelection ?~ Sel 0 (j+joff) (IS.fromDistinctAscList [j .. j + IS.size xs -1])
(hud . diSelection ?~ Sel 0 (j+joff))
. (hud . diSections . ix 0 . ssSet .~ IS.fromDistinctAscList [j .. j + IS.size xs -1])
-- hud . diSelection ?~ Sel 0 (j+joff) (IS.fromDistinctAscList [j .. j + IS.size xs -1])
(hud . diSelection ?~ Sel 0 (j + joff))
. (hud . diSections . ix 0 . ssSet .~ IS.fromDistinctAscList [j .. j + IS.size xs - 1])
g i = do
NInt j <- w ^? hud . closeItems . ix i
w ^? cWorld . lWorld . items . ix j
@@ -211,51 +208,77 @@ updateMouseReleaseInGame :: World -> World
updateMouseReleaseInGame w = case w ^. input . mouseContext of
OverInvDrag k mpos ->
input . mouseContext .~ MouseInGame $
fromMaybe w $ tryDropSelected mpos w <|> tryPickupSelected k mpos w
fromMaybe w $
tryDropSelected mpos w <|> tryPickupSelected k mpos w
OverInvDragSelect (Just ssel) mesel
| ScancodeLShift `M.member` (w ^. input . pressedKeys) ->
w & input . mouseContext .~ MouseInGame
& (fromMaybe id $ do
j <- w ^? hud . diSelection . _Just . slSec
return $ hud . diSections . ix j . ssSet
%~ getuniques
( maybe
mempty
mempty
--(h ssel)
(guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
))
& hud . diSections . ix (fst ssel) . ssSet
%~ getuniques
( maybe
mempty
(h ssel)
(guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
)
-- & hud . diSelection . _Just . slSet
-- %~ getuniques
-- ( maybe
-- mempty
-- (h ssel)
-- (guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
-- )
w
& input
. mouseContext
.~ MouseInGame
& ( fromMaybe id $ do
j <- w ^? hud . diSelection . _Just . slSec
return $
hud
. diSections
. ix j
. ssSet
%~ getuniques
( maybe
mempty
mempty
-- (h ssel)
(guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
)
)
& hud
. diSections
. ix (fst ssel)
. ssSet
%~ getuniques
( maybe
mempty
(h ssel)
(guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
)
-- & hud . diSelection . _Just . slSet
-- %~ getuniques
-- ( maybe
-- mempty
-- (h ssel)
-- (guard (ssel ^? _1 == w ^? hud . diSelection . _Just . slSec) >> mesel ^? _Just)
-- )
OverInvDragSelect (Just ssel) (Just esel) ->
w & input . mouseContext .~ MouseInGame
w
& input
. mouseContext
.~ MouseInGame
-- & invSetSelection (f (fst ssel, esel) (h ssel esel))
& hud . diSections . ix (fst ssel) . ssSet .~ h ssel esel
& hud
. diSections
. ix (fst ssel)
. ssSet
.~ h ssel esel
& invSetSelection (f (fst ssel, esel))
OverInvDragSelect{} ->
w & input . mouseContext .~ MouseInGame
-- & hud . diSelection . _Just . slSet %~ const mempty
& hud . diSections . each . ssSet %~ const mempty
w
& input
. mouseContext
.~ MouseInGame
-- & hud . diSelection . _Just . slSet %~ const mempty
& hud
. diSections
. each
. ssSet
%~ const mempty
_ -> w
where
getuniques x y = IS.union x y IS.\\ IS.intersection x y
f (x, y) = Sel x y
-- need to set this in OverInvDragSelect (twice)?
-- need to set this in OverInvDragSelect (twice)?
h (k, i) j = fold $ do
sss <- w ^? hud . diSections . ix k . ssItems
let (_, xss) = IM.split (min i j -1) sss
let (_, xss) = IM.split (min i j - 1) sss
(yss, _) = IM.split (max i j + 1) xss
return . IM.keysSet $ yss
@@ -278,12 +301,22 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
return $ w & input . mouseContext .~ OverInvDragSelect (Just ysel) Nothing
OverInvSelect (-1, _)
| selsec == Just (-1) ->
w & hud . diSelection %~ endRegex (-1) w
& hud . diInvFilter .~ Nothing
w
& hud
. diSelection
%~ endRegex (-1) w
& hud
. diInvFilter
.~ Nothing
OverInvSelect (2, _)
| selsec == Just 2 ->
w & hud . diSelection %~ endRegex 2 w
& hud . diCloseFilter .~ Nothing
w
& hud
. diSelection
%~ endRegex 2 w
& hud
. diCloseFilter
.~ Nothing
OverInvSelect (5, j) -> fromMaybe w $ do
k <- w ^? hud . closeButtons . ix j
but <- w ^? cWorld . lWorld . buttons . ix k
@@ -297,22 +330,45 @@ updateMouseClickInGame cfig w = case w ^. input . mouseContext of
OverTerminal tmid TerminalPressTo{} -> continueTerminal tmid w
OutsideTerminal -> w & hud . subInventory .~ NoSubInventory
OverCombSelect x ->
w & hud . subInventory . ciSelection ?~ f x
& worldEventFlags . at CombineInventoryChange ?~ ()
w
& hud
. subInventory
. ciSelection
?~ f x
& worldEventFlags
. at CombineInventoryChange
?~ ()
OverCombFilter ->
w & hud . subInventory . ciFilter .~ Nothing
& worldEventFlags . at CombineInventoryChange ?~ ()
& hud . subInventory . ciSelection %~ endCombineRegex w
w
& hud
. subInventory
. ciFilter
.~ Nothing
& worldEventFlags
. at CombineInventoryChange
?~ ()
& hud
. subInventory
. ciSelection
%~ endCombineRegex w
OverCombCombine x ->
w
& tryCombine x
& worldEventFlags . at CombineInventoryChange ?~ ()
& worldEventFlags . at InventoryChange ?~ ()
& worldEventFlags
. at CombineInventoryChange
?~ ()
& worldEventFlags
. at InventoryChange
?~ ()
& maybeExitCombine
OverCombEscape ->
w
& worldEventFlags . at InventoryChange ?~ ()
& hud . subInventory .~ NoSubInventory
& worldEventFlags
. at InventoryChange
?~ ()
& hud
. subInventory
.~ NoSubInventory
OverCombFiltInv (0, j) -> fromMaybe w $ do
str <-
fmap (take 5) $
@@ -344,23 +400,23 @@ endCombineRegex w = ssSetCursor (ssLookupDown 0 j) sss
j = fromMaybe 0 $ do
itms <- sss ^? ix 0 . ssItems
(k, _) <- IM.lookupMin itms
return (k -1)
return (k - 1)
startDrag :: (Int, Int) -> World -> World
startDrag (a, b) w = setcontext $ fromMaybe (invSetSelection (Sel a b) w) $ do
i <- w ^? hud . diSelection . _Just . slSec
i <- w ^? hud . diSelection . _Just . slSec
xs <- w ^? hud . diSections . ix i . ssSet
guard $ i == a && b `IS.member` xs
return w
where
setcontext = input . mouseContext .~ OverInvDrag a (Just (a, b))
--startDrag (a, b) w = setcontext $ case w ^? hud . diSelection . _Just of
-- startDrag (a, b) w = setcontext $ case w ^? hud . diSelection . _Just of
-- Just (Sel i _ xs) | i == a && b `IS.member` xs -> w
-- _ -> invSetSelection (Sel a b mempty) w
-- where
-- setcontext = input . mouseContext .~ OverInvDrag a (Just (a, b))
shiftInvItems ::
Config ->
Int -> -- recurse limit
@@ -379,18 +435,18 @@ shiftInvItems cfig n k x xs ss w = setSelWhileDragging . fromMaybe w $ do
ab =
(\v -> inverseSelSecYint (yint - 1) v ^? nonInf)
=<< w ^? hud . diSections
guard $ xk == k || xk + 1 == k || xk -1 == k
guard $ xk == k || xk + 1 == k || xk - 1 == k
(maxi, _) <- IS.maxView xs
(mini, _) <- IS.minView xs
case True of
_ | x < (k, mini) -> do
guard $ not . null . fst $ IM.split mini ss
guard $ Just (k, mini -1) /= ab
return . doDrag cfig (n -1) k (Just x) $ shiftInvItemsUp k xs w
guard $ Just (k, mini - 1) /= ab
return . doDrag cfig (n - 1) k (Just x) $ shiftInvItemsUp k xs w
_ | x > (k, maxi) -> do
guard $ not . null . snd $ IM.split maxi ss
guard $ Just (k, maxi + 1) /= bn
return . doDrag cfig (n -1) k (Just x) $ shiftInvItemsDown k xs w
return . doDrag cfig (n - 1) k (Just x) $ shiftInvItemsDown k xs w
_ -> Nothing
setSelWhileDragging :: World -> World
@@ -400,12 +456,12 @@ setSelWhileDragging w = fromMaybe w $ do
(k, j) <- w ^? input . mouseContext . mcoMaybeSelect . _Just
guard $ i == k && j `IS.member` xs
return $ w & hud . diSelection . _Just . slInt .~ j
-- Sel i _ xs <- w ^? hud . diSelection . _Just
-- (k, j) <- w ^? input . mouseContext . mcoMaybeSelect . _Just
-- guard $ i == k && j `IS.member` xs
-- return $ w & hud . diSelection . _Just . slInt .~ j
updateFunctionKeys :: Universe -> Universe
updateFunctionKeys u =
M.foldlWithKey' updateFunctionKey u (u ^. uvWorld . input . pressedKeys)
@@ -459,7 +515,14 @@ updateKeysTextInputTerminal tmid u =
(uvWorld . cWorld . lWorld . terminals . ix tmid . tmStatus . tiText)
& checkEndStatus
& tryTabComplete
& uvWorld . cWorld . lWorld . terminals . ix tmid . tmStatus . tiText %~ take 42
& uvWorld
. cWorld
. lWorld
. terminals
. ix tmid
. tmStatus
. tiText
%~ take 42
where
checkEndStatus
| u ^. uvWorld . input . pressedKeys . at ScancodeReturn == Just 0 =
@@ -504,7 +567,7 @@ doRegexInput ::
(IMSS a, Maybe Selection, Maybe String)
doRegexInput inp i sss msel filts
| backspacetonothing || escapekey = endregex i 0
| endkeys = endregex (i + 1) (j -1)
| endkeys = endregex (i + 1) (j - 1)
| otherwise =
( sss
, msel
@@ -530,15 +593,28 @@ updateBackspaceRegex :: World -> World
updateBackspaceRegex w = case di ^? subInventory of
Just NoSubInventory{}
| secfocus (-1) 0 ->
w & hud %~ trybackspace (-1) diInvFilter diInvFilter diSelection
& worldEventFlags . at InventoryChange ?~ ()
w
& hud
%~ trybackspace (-1) diInvFilter diInvFilter diSelection
& worldEventFlags
. at InventoryChange
?~ ()
Just NoSubInventory{}
| secfocus 2 3 ->
w & hud %~ trybackspace 2 diCloseFilter diCloseFilter diSelection
& worldEventFlags . at InventoryChange ?~ ()
w
& hud
%~ trybackspace 2 diCloseFilter diCloseFilter diSelection
& worldEventFlags
. at InventoryChange
?~ ()
Just CombineInventory{} ->
w & hud . subInventory %~ trybackspace (-1) ciFilter ciFilter ciSelection
& worldEventFlags . at InventoryChange ?~ ()
w
& hud
. subInventory
%~ trybackspace (-1) ciFilter ciFilter ciSelection
& worldEventFlags
. at InventoryChange
?~ ()
_ -> w
where
secfocus a b = fromMaybe False $ do
@@ -548,9 +624,13 @@ updateBackspaceRegex w = case di ^? subInventory of
str <- he ^? filtget . _Just
return $ case str of
(_ : _) ->
he & filtset . _Just %~ init
& selset ?~ Sel x 0
-- & selset ?~ Sel x 0 mempty
he
& filtset
. _Just
%~ init
& selset
?~ Sel x 0
-- & selset ?~ Sel x 0 mempty
[] -> he & filtset .~ Nothing
di = w ^. hud
@@ -558,18 +638,35 @@ updateEnterRegex :: World -> World
updateEnterRegex w = case w ^? hud . subInventory of
Just NoSubInventory{}
| secfocus [-1, 0, 1] ->
-- w & hud . diSelection ?~ Sel (-1) 0 mempty
w & hud . diSelection ?~ Sel (-1) 0
& hud . diInvFilter %~ enterregex
-- w & hud . diSelection ?~ Sel (-1) 0 mempty
w
& hud
. diSelection
?~ Sel (-1) 0
& hud
. diInvFilter
%~ enterregex
Just NoSubInventory{}
| secfocus [2, 3] ->
-- w & hud . diSelection ?~ Sel 2 0 mempty
w & hud . diSelection ?~ Sel 2 0
& hud . diCloseFilter %~ enterregex
w
& hud
. diSelection
?~ Sel 2 0
& hud
. diCloseFilter
%~ enterregex
Just CombineInventory{} ->
w & hud . subInventory . ciFilter %~ enterregex
-- & hud . subInventory . ciSelection ?~ Sel (-1) 0 mempty
& hud . subInventory . ciSelection ?~ Sel (-1) 0
w
& hud
. subInventory
. ciFilter
%~ enterregex
-- & hud . subInventory . ciSelection ?~ Sel (-1) 0 mempty
& hud
. subInventory
. ciSelection
?~ Sel (-1) 0
_ -> w
where
secfocus xs = fromMaybe False $ do
@@ -601,18 +698,24 @@ tryCombine :: (Int, Int) -> World -> World
tryCombine (i, j) w = fromMaybe w $ do
CombItem is it <-
w
^? hud . subInventory
. ciSections
. ix i
. ssItems
. ix j
. siPayload
. _Just
^? hud
. subInventory
. ciSections
. ix i
. ssItems
. ix j
. siPayload
. _Just
p <- w ^? cWorld . lWorld . creatures . ix 0 . crPos . _xy
return $
createItemYou it (foldr (destroyInvItem 0 . NInt) w (sort is))
& soundStart InventorySound p wrench1S Nothing
& hud . diSections . ix 1 . ssSet.~ mempty
& hud
. diSections
. ix 1
. ssSet
.~ mempty
-- & hud . diSelection . _Just . slSet .~ mempty
maybeExitCombine :: World -> World