Cleanup, remove inventory display update code on dropping item
This commit is contained in:
@@ -4,7 +4,7 @@
|
||||
|
||||
module Dodge.DisplayInventory (
|
||||
toggleCombineInv,
|
||||
updateInventorySectionItems,
|
||||
-- updateInventorySectionItems,
|
||||
updateInventoryPositioning,
|
||||
updateCombinePositioning,
|
||||
) where
|
||||
@@ -117,7 +117,7 @@ updateDisplaySections w cfig sss =
|
||||
invitems' = IM.mapWithKey (\k (y,x) -> invSelectionItem cr k (x ^. locLDT . ldtValue) y)
|
||||
invlocs
|
||||
cr = you w
|
||||
invlocs = invTrees'' $ _crInv (you w)
|
||||
invlocs = allInvLocs $ _crInv (you w)
|
||||
nfreeslots = crNumFreeSlots cr
|
||||
filtpair i itms filtdescription =
|
||||
( (i, filtsis)
|
||||
@@ -139,21 +139,21 @@ updateDisplaySections w cfig sss =
|
||||
invDimColor :: Color
|
||||
invDimColor = greyN 0.7
|
||||
|
||||
-- this appears to be only for filtering
|
||||
updateInventorySectionItems :: World -> World
|
||||
updateInventorySectionItems w =
|
||||
w
|
||||
& hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f
|
||||
where
|
||||
f olditems = fromMaybe olditems $ do
|
||||
cr <- w ^? cWorld . lWorld . creatures . ix 0
|
||||
--invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
|
||||
let invitms = IM.mapWithKey (invSelectionItem' cr)
|
||||
$ fmap (^. _2 . locLDT . ldtValue)
|
||||
$ invTrees'' $ cr ^. crInv
|
||||
return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
|
||||
Just str -> IM.filter (plainRegex str) invitms
|
||||
_ -> invitms
|
||||
---- this appears to be only for filtering
|
||||
--updateInventorySectionItems :: World -> World
|
||||
--updateInventorySectionItems w =
|
||||
-- w
|
||||
-- & hud . hudElement . diSections . sssSections . ix 0 . ssItems %~ f
|
||||
-- where
|
||||
-- cr = w ^?! cWorld . lWorld . creatures . ix 0
|
||||
-- invitms = IM.mapWithKey (invSelectionItem' cr)
|
||||
-- $ fmap (^. _2 . locLDT . ldtValue)
|
||||
-- $ allInvLocs $ cr ^. crInv
|
||||
-- f olditems = fromMaybe olditems $ do
|
||||
-- --invitms <- IM.mapWithKey (invSelectionItem' cr) <$> cr ^? crInv
|
||||
-- return $ case w ^? hud . hudElement . diSections . sssExtra . sssFilters . ix (-1) . _Just of
|
||||
-- Just str -> IM.filter (plainRegex str) invitms
|
||||
-- _ -> invitms
|
||||
|
||||
plainRegex :: String -> SelectionItem a -> Bool
|
||||
plainRegex = flip $ andOrRegex (\si str -> regexList str (_siPictures si))
|
||||
|
||||
@@ -21,7 +21,7 @@ import Data.Maybe
|
||||
import Dodge.Base
|
||||
import Dodge.Data.SelectionList
|
||||
import Dodge.Data.World
|
||||
import Dodge.DisplayInventory
|
||||
--import Dodge.DisplayInventory
|
||||
import Dodge.Euse
|
||||
import Dodge.Inventory.CheckSlots
|
||||
import Dodge.Inventory.CloseObject
|
||||
@@ -81,7 +81,7 @@ rmInvItem cid invid w = w
|
||||
|
||||
updateselection
|
||||
| cid == 0 && cr ^? crManipulation . manObject . imSelectedItem == Just invid =
|
||||
scrollAugInvSel (-1) . scrollAugInvSel 1 . updateInventorySectionItems
|
||||
scrollAugInvSel (-1) . scrollAugInvSel 1-- . updateInventorySectionItems
|
||||
| otherwise =
|
||||
pointcid . crManipulation . manObject . imSelectedItem %~ g
|
||||
|
||||
|
||||
@@ -18,21 +18,6 @@ import Picture.Base
|
||||
|
||||
invSelectionItem' :: Creature -> Int -> ComposedItem -> SelectionItem ()
|
||||
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 cr i ci indent =
|
||||
|
||||
@@ -7,7 +7,7 @@ module Dodge.Item.Grammar (
|
||||
invRootTrees,
|
||||
pciToCI,
|
||||
basePCI,
|
||||
invTrees'',
|
||||
allInvLocs,
|
||||
) where
|
||||
|
||||
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
|
||||
--invTrees'' :: IM.IntMap Item -> [LocationLDT ItemLink ComposedItem]
|
||||
invTrees'' :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem)
|
||||
invTrees'' inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty
|
||||
allInvLocs :: IM.IntMap Item -> IM.IntMap (Int,LocationLDT ItemLink ComposedItem)
|
||||
allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempty
|
||||
where
|
||||
f t = cldtPropagateFold h h g 0 t id
|
||||
h x _ _ _ = x + 1
|
||||
|
||||
+40
-38
@@ -1,12 +1,14 @@
|
||||
module Dodge.Luse
|
||||
( useL
|
||||
)
|
||||
where
|
||||
|
||||
import Dodge.Base
|
||||
--import Dodge.Base
|
||||
import Dodge.Creature.Action
|
||||
import Dodge.Data.World
|
||||
import Dodge.Item.Weapon.TriggerType
|
||||
import Geometry
|
||||
import qualified IntMapHelp as IM
|
||||
--import Geometry
|
||||
--import qualified IntMapHelp as IM
|
||||
import LensHelp
|
||||
|
||||
useL :: Luse -> Item -> Creature -> World -> World
|
||||
@@ -82,40 +84,40 @@ boostSelfL = undefined
|
||||
-- . (itAttachment .~ AttachInt pid)
|
||||
-- )
|
||||
|
||||
-- | Move a creature towards the mouse position, with shockwave
|
||||
boostPoint ::
|
||||
-- | boost amount
|
||||
Float ->
|
||||
Creature ->
|
||||
World ->
|
||||
Either Point2 Point2
|
||||
boostPoint x cr w = case mayp2 of
|
||||
Nothing -> Right p1
|
||||
Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
|
||||
where
|
||||
cpos = _crPos cr
|
||||
r = 1.5 * _crRad cr
|
||||
p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
|
||||
mayp2 = bouncePoint (const True) 1 cpos p1 w
|
||||
---- | Move a creature towards the mouse position, with shockwave
|
||||
--boostPoint ::
|
||||
-- -- | boost amount
|
||||
-- Float ->
|
||||
-- Creature ->
|
||||
-- World ->
|
||||
-- Either Point2 Point2
|
||||
--boostPoint x cr w = case mayp2 of
|
||||
-- Nothing -> Right p1
|
||||
-- Just p2 -> Left $ mvPointTowardAtSpeed r cpos $ fst p2
|
||||
-- where
|
||||
-- cpos = _crPos cr
|
||||
-- r = 1.5 * _crRad cr
|
||||
-- p1 = cpos +.+ x *.* squashNormalizeV (mouseWorldPos (w ^. input) (w ^. wCam) -.- cpos)
|
||||
-- mayp2 = bouncePoint (const True) 1 cpos p1 w
|
||||
|
||||
addBoostShockwave ::
|
||||
Int ->
|
||||
Point2 ->
|
||||
Point2 ->
|
||||
World ->
|
||||
World
|
||||
addBoostShockwave pjid p v w =
|
||||
w & cWorld . lWorld . linearShockwaves
|
||||
%~ IM.insertWith f pjid thePJ
|
||||
where
|
||||
thePJ =
|
||||
LinearShockwave
|
||||
{ _lwPos = p
|
||||
, _lwID = pjid
|
||||
, _lwPoints = [(p, v)]
|
||||
, _lwTimer = maxT
|
||||
}
|
||||
f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
|
||||
--addBoostShockwave ::
|
||||
-- Int ->
|
||||
-- Point2 ->
|
||||
-- Point2 ->
|
||||
-- World ->
|
||||
-- World
|
||||
--addBoostShockwave pjid p v w =
|
||||
-- w & cWorld . lWorld . linearShockwaves
|
||||
-- %~ IM.insertWith f pjid thePJ
|
||||
-- where
|
||||
-- thePJ =
|
||||
-- LinearShockwave
|
||||
-- { _lwPos = p
|
||||
-- , _lwID = pjid
|
||||
-- , _lwPoints = [(p, v)]
|
||||
-- , _lwTimer = maxT
|
||||
-- }
|
||||
-- f newVal oldVal = newVal & lwPoints %~ (++ _lwPoints oldVal)
|
||||
|
||||
maxT :: Int
|
||||
maxT = 20
|
||||
--maxT :: Int
|
||||
--maxT = 20
|
||||
|
||||
Reference in New Issue
Block a user