Flatten values in creature manipulation data types
This commit is contained in:
@@ -82,10 +82,10 @@ rmInvItem cid invid w = w
|
||||
pointcid = cWorld . lWorld . creatures . ix cid
|
||||
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . inInventory . imSelectedItem == Just invid =
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
scrollAugInvSel (-1) . scrollAugInvSel 1 . updateInventorySectionItems
|
||||
| otherwise =
|
||||
pointcid . crManipulation . manObject . inInventory . imSelectedItem %~ g
|
||||
pointcid . crManipulation . manObject . imSelectedItem %~ g
|
||||
|
||||
cr = w ^?! cWorld . lWorld . creatures . ix cid
|
||||
itm = _crInv cr IM.! invid
|
||||
@@ -185,7 +185,7 @@ rmInvItem cid invid w = w
|
||||
-- | otherwise = x
|
||||
|
||||
rmSelectedInvItem :: Int -> World -> World
|
||||
rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crManipulation . manObject . inInventory . imSelectedItem of
|
||||
rmSelectedInvItem cid w = case w ^? cWorld . lWorld . creatures . ix cid . crManipulation . manObject . imSelectedItem of
|
||||
Just i -> rmInvItem cid i w
|
||||
Nothing -> w
|
||||
|
||||
@@ -198,7 +198,7 @@ updateCloseObjects w =
|
||||
where
|
||||
newcloseobjects = unionBy closeObjEq oldCloseFiltered currentClose
|
||||
updatecursorposifnecessary =
|
||||
case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inNearby . ispCloseObject of
|
||||
case w ^? cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . ispCloseObject of
|
||||
Just i
|
||||
| i >= length newcloseobjects -> scrollAugInvSel 1
|
||||
| isNothing (w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems . ix i) ->
|
||||
@@ -237,7 +237,7 @@ changeSwapClose f i w = fromMaybe w $ do
|
||||
k <- f i ss
|
||||
return $
|
||||
w
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . inNearby . ispCloseObject
|
||||
& cWorld . lWorld . creatures . ix 0 . crManipulation . manObject . ispCloseObject
|
||||
.~ k
|
||||
& hud . closeObjects %~ swapIndices i k
|
||||
& hud . hudElement . diSections . sssExtra . sssSelPos . _Just . _2 .~ k
|
||||
@@ -263,7 +263,7 @@ changeSwapInv f i w = fromMaybe w $ do
|
||||
where
|
||||
updatecreature k =
|
||||
(crInv %~ IM.safeSwapKeys i k)
|
||||
. (crManipulation . manObject . inInventory . imSelectedItem .~ k)
|
||||
. (crManipulation . manObject . imSelectedItem .~ k)
|
||||
. (crInvEquipped %~ IM.safeSwapKeys i k)
|
||||
. swapSite i k
|
||||
. swapSite k i
|
||||
@@ -297,6 +297,6 @@ scrollAugInvSel yi w
|
||||
selectedCloseObject :: World -> Maybe (Either FloorItem Button)
|
||||
selectedCloseObject w = do
|
||||
i <-
|
||||
you w ^? crManipulation . manObject . inNearby . ispCloseObject
|
||||
you w ^? crManipulation . manObject . ispCloseObject
|
||||
<|> fmap fst (IM.lookupMin =<< w ^? hud . hudElement . diSections . sssSections . ix 3 . ssItems)
|
||||
w ^? hud . closeObjects . ix i
|
||||
|
||||
Reference in New Issue
Block a user