Remove reduntant left click item use code
This commit is contained in:
+26
-14
@@ -72,8 +72,8 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
, []
|
||||
)
|
||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(AugmentedHUDSF, AugmentedHUDLink)], [])
|
||||
(ATTACH BULLETSYNTH, _)
|
||||
-> ([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)],[])
|
||||
(ATTACH BULLETSYNTH, _) ->
|
||||
([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)], [])
|
||||
_ -> ([], [])
|
||||
|
||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
@@ -186,7 +186,10 @@ invLDT =
|
||||
-- consider explicitly reseting the inventory ids (but this probably really
|
||||
-- should be done upstream anyway in the actually creature inventory)
|
||||
invRootMap :: IM.IntMap Item -> IM.IntMap (Maybe Int, DoubleTree Item)
|
||||
invRootMap = foldMap (dtToIntMapWithRoot (^?! itLocation . ilInvID) . fmap (^. _1) . ldtToDT) . invLDT
|
||||
invRootMap =
|
||||
foldMap
|
||||
(dtToIntMapWithRoot (^?! itLocation . ilInvID) . fmap (^. _1) . ldtToDT)
|
||||
. invLDT
|
||||
|
||||
-- this assumes the creature inventory is well formed, specifically the
|
||||
-- location ids
|
||||
@@ -208,7 +211,8 @@ invTrees = fmap (first _iatType) . invTrees'
|
||||
|
||||
-- returns an intmap with trees for all items
|
||||
invTrees' :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink Item)
|
||||
invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x, y, _) -> (x, y))) . invLDT
|
||||
--invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x, y, _) -> (x, y))) . invLDT
|
||||
invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . invLDT
|
||||
where
|
||||
getindex i =
|
||||
fromMaybe (error "in invTrees try to get non-inventory item tree") $
|
||||
@@ -216,10 +220,11 @@ invTrees' = IM.unions . map (ldtToIM getindex . fmap (^. _1)) . map (fmap (\(x,
|
||||
|
||||
-- returns an intmap with trees for (only!) root items, indexed by inventory position
|
||||
invRootTrees :: IM.IntMap Item -> IM.IntMap (LabelDoubleTree ItemLink ComposedItem)
|
||||
invRootTrees = IM.fromDistinctAscList . reverse . map (getid) . invLDT
|
||||
invRootTrees = IM.fromDistinctAscList . reverse . map getid . invLDT
|
||||
where
|
||||
getid :: LabelDoubleTree ItemLink ComposedItem
|
||||
-> (Int, LabelDoubleTree ItemLink ComposedItem)
|
||||
getid ::
|
||||
LabelDoubleTree ItemLink ComposedItem ->
|
||||
(Int, LabelDoubleTree ItemLink ComposedItem)
|
||||
getid t = (t ^?! ldtValue . _1 . itLocation . ilInvID, t)
|
||||
|
||||
-- returns an intmap with indents and locations for all items
|
||||
@@ -228,10 +233,17 @@ allInvLocs inv = foldMap (f . LocLDT TopLDT) (IM.elems (invRootTrees inv)) mempt
|
||||
where
|
||||
f t = cldtPropagateFold h h g 0 t id
|
||||
h x _ _ _ = x + 1
|
||||
g :: Int -> LocationLDT ItemLink ComposedItem
|
||||
-> (IM.IntMap (Int, LocationLDT ItemLink ComposedItem)
|
||||
-> IM.IntMap (Int, LocationLDT ItemLink ComposedItem))
|
||||
-> IM.IntMap (Int, LocationLDT ItemLink ComposedItem)
|
||||
-> IM.IntMap (Int, LocationLDT ItemLink ComposedItem)
|
||||
g x ldt = (.) (IM.insert (ldt ^?! locLDT . ldtValue . _1 . itLocation . ilInvID)
|
||||
(x, ldt))
|
||||
g ::
|
||||
Int ->
|
||||
LocationLDT ItemLink ComposedItem ->
|
||||
( IM.IntMap (Int, LocationLDT ItemLink ComposedItem) ->
|
||||
IM.IntMap (Int, LocationLDT ItemLink ComposedItem)
|
||||
) ->
|
||||
IM.IntMap (Int, LocationLDT ItemLink ComposedItem) ->
|
||||
IM.IntMap (Int, LocationLDT ItemLink ComposedItem)
|
||||
g x ldt =
|
||||
(.)
|
||||
( IM.insert
|
||||
(ldt ^?! locLDT . ldtValue . _1 . itLocation . ilInvID)
|
||||
(x, ldt)
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user