Cleanup, remove inventory display update code on dropping item

This commit is contained in:
2024-10-06 22:32:10 +01:00
parent 650854d13e
commit 507c8e9819
7 changed files with 64 additions and 77 deletions
+1 -1
View File
@@ -1 +1 @@
All good (597 modules, at 22:09:47) All good (597 modules, at 22:32:07)
+1 -1
View File
File diff suppressed because one or more lines are too long
+17 -17
View File
@@ -4,7 +4,7 @@
module Dodge.DisplayInventory ( module Dodge.DisplayInventory (
toggleCombineInv, toggleCombineInv,
updateInventorySectionItems, -- updateInventorySectionItems,
updateInventoryPositioning, updateInventoryPositioning,
updateCombinePositioning, updateCombinePositioning,
) where ) where
@@ -117,7 +117,7 @@ updateDisplaySections w cfig sss =
invitems' = IM.mapWithKey (\k (y,x) -> invSelectionItem cr k (x ^. locLDT . ldtValue) y) invitems' = IM.mapWithKey (\k (y,x) -> invSelectionItem cr k (x ^. locLDT . ldtValue) y)
invlocs invlocs
cr = you w cr = you w
invlocs = invTrees'' $ _crInv (you w) invlocs = allInvLocs $ _crInv (you w)
nfreeslots = crNumFreeSlots cr nfreeslots = crNumFreeSlots cr
filtpair i itms filtdescription = filtpair i itms filtdescription =
( (i, filtsis) ( (i, filtsis)
@@ -139,21 +139,21 @@ updateDisplaySections w cfig sss =
invDimColor :: Color invDimColor :: Color
invDimColor = greyN 0.7 invDimColor = greyN 0.7
-- this appears to be only for filtering ---- this appears to be only for filtering
updateInventorySectionItems :: World -> World --updateInventorySectionItems :: World -> World
updateInventorySectionItems w = --updateInventorySectionItems w =
w -- w
& hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f -- & hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f
where -- where
f olditems = fromMaybe olditems $ do -- cr = w ^?! cWorld . lWorld . creatures . ix 0
cr <- w ^? cWorld . lWorld . creatures . ix 0 -- invitms = IM.mapWithKey (invSelectionItem' cr)
--invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv -- $ fmap (^. _2 . locLDT . ldtValue)
let invitms = IM.mapWithKey (invSelectionItem' cr) -- $ allInvLocs $ cr ^. crInv
$ fmap (^. _2 . locLDT . ldtValue) -- f olditems = fromMaybe olditems $ do
$ invTrees'' $ cr ^. crInv -- --invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of -- return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
Just str -> IM.filter (plainRegex str) invitms -- Just str -> IM.filter (plainRegex str) invitms
_ -> invitms -- _ -> invitms
plainRegex :: String -> SelectionItem a -> Bool plainRegex :: String -> SelectionItem a -> Bool
plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si)) plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si))
+2 -2
View File
@@ -21,7 +21,7 @@ import Data.Maybe
import Dodge.Base import Dodge.Base
import Dodge.Data.SelectionList import Dodge.Data.SelectionList
import Dodge.Data.World import Dodge.Data.World
import Dodge.DisplayInventory --import Dodge.DisplayInventory
import Dodge.Euse import Dodge.Euse
import Dodge.Inventory.CheckSlots import Dodge.Inventory.CheckSlots
import Dodge.Inventory.CloseObject import Dodge.Inventory.CloseObject
@@ -81,7 +81,7 @@ rmInvItem cid invid w = w
updateselection updateselection
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid = | cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
scrollAugInvSel (-1) . scrollAugInvSel 1 . updateInventorySectionItems scrollAugInvSel (-1) . scrollAugInvSel 1-- . updateInventorySectionItems
| otherwise = | otherwise =
pointcid . crManipulation . manObject . imSelectedItem %~ g pointcid . crManipulation . manObject . imSelectedItem %~ g
-15
View File
@@ -18,21 +18,6 @@ import Picture.Base
invSelectionItem' :: Creature -> Int -> ComposedItem -> SelectionItem () invSelectionItem' :: Creature -> Int -> ComposedItem -> SelectionItem ()
invSelectionItem' cr i it = invSelectionItem cr i it 0 invSelectionItem' cr i it = invSelectionItem cr i it 0
-- SelectionItem
-- { _siPictures = pics & ix 0 %~ (++ anyequippos ++ anyhotkey)
-- , _siHeight = _itInvSize it
-- , _siIsSelectable = True
-- , _siColor = col
-- , _siOffX = 0
-- , _siPayload = ()
-- }
-- where
-- anyhotkey = maybe [] ((' ':) .hotkeyToString) (cr ^? crInvHotkeys . ix i)
-- anyequippos = maybe [] (rightPad 8 ' ' . (' ':) . eqPosText) (cr ^? crInvEquipped . ix i)
-- col = itemInvColor it
-- pics = case _itCurseStatus it of
-- UndroppableIdentified -> itemDisplay cr it
-- _ -> itemDisplay cr it
invSelectionItem :: Creature -> Int -> ComposedItem -> Int -> SelectionItem () invSelectionItem :: Creature -> Int -> ComposedItem -> Int -> SelectionItem ()
invSelectionItem cr i ci indent = invSelectionItem cr i ci indent =
+3 -3
View File
@@ -7,7 +7,7 @@ module Dodge.Item.Grammar (
invRootTrees, invRootTrees,
pciToCI, pciToCI,
basePCI, basePCI,
invTrees'', allInvLocs,
) where ) where
import Control.Applicative import Control.Applicative
@@ -201,8 +201,8 @@ invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x,
-- returns an intmap with trees for all items -- returns an intmap with trees for all items
--invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem] --invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem]
invTrees'' :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem) allInvLocs :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem)
invTrees'' inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty
where where
f t = cldtPropagateFold h h g 0 t id f t = cldtPropagateFold h h g 0 t id
h x _ _ _ = x + 1 h x _ _ _ = x + 1
+40 -38
View File
@@ -1,12 +1,14 @@
module Dodge.Luse module Dodge.Luse
( useL
)
where where
import Dodge.Base --import Dodge.Base
import Dodge.Creature.Action import Dodge.Creature.Action
import Dodge.Data.World import Dodge.Data.World
import Dodge.Item.Weapon.TriggerType import Dodge.Item.Weapon.TriggerType
import Geometry --import Geometry
import qualified IntMapHelp as IM --import qualified IntMapHelp as IM
import LensHelp import LensHelp
useL :: Luse -> Item -> Creature -> World -> World useL :: Luse -> Item -> Creature -> World -> World
@@ -82,40 +84,40 @@ boostSelfL = undefined
-- . (itAttachment .~ AttachInt pid) -- . (itAttachment .~ AttachInt pid)
-- ) -- )
-- | Move a creature towards the mouse position, with shockwave ---- | Move a creature towards the mouse position, with shockwave
boostPoint :: --boostPoint ::
-- | boost amount -- -- | boost amount
Float -> -- Float ->
Creature -> -- Creature ->
World -> -- World ->
Either Point2 Point2 -- Either Point2 Point2
boostPoint x cr w = case mayp2 of --boostPoint x cr w = case mayp2 of
Nothing -> Right p1 -- Nothing -> Right p1
Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2 -- Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
where -- where
cpos = _crPos cr -- cpos = _crPos cr
r = 1.5 * _crRad cr -- r = 1.5 * _crRad cr
p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos) -- p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
mayp2 = bouncePoint (const True) 1 cpos p1 w -- mayp2 = bouncePoint (const True) 1 cpos p1 w
addBoostShockwave :: --addBoostShockwave ::
Int -> -- Int ->
Point2 -> -- Point2 ->
Point2 -> -- Point2 ->
World -> -- World ->
World -- World
addBoostShockwave pjid p v w = --addBoostShockwave pjid p v w =
w & cWorld . lWorld . linearShockwaves -- w & cWorld . lWorld . linearShockwaves
%~ IM.insertWith f pjid thePJ -- %~ IM.insertWith f pjid thePJ
where -- where
thePJ = -- thePJ =
LinearShockwave -- LinearShockwave
{ _lwPos = p -- { _lwPos = p
, _lwID = pjid -- , _lwID = pjid
, _lwPoints = [(p, v)] -- , _lwPoints = [(p, v)]
, _lwTimer = maxT -- , _lwTimer = maxT
} -- }
f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal) -- f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
maxT :: Int --maxT :: Int
maxT = 20 --maxT = 20