Hlint pass
This commit is contained in:
@@ -1,7 +1,5 @@
|
|||||||
{-# LANGUAGE DeriveAnyClass #-}
|
|
||||||
{-# LANGUAGE DeriveGeneric #-}
|
{-# LANGUAGE DeriveGeneric #-}
|
||||||
{-# LANGUAGE StrictData #-}
|
{-# LANGUAGE StrictData #-}
|
||||||
{-# LANGUAGE TemplateHaskell #-}
|
|
||||||
|
|
||||||
module Dodge.Data.ComposedItem where
|
module Dodge.Data.ComposedItem where
|
||||||
|
|
||||||
|
|||||||
@@ -24,8 +24,8 @@ import ShapePicture
|
|||||||
itemTreeSPic :: DTree CItem -> SPic
|
itemTreeSPic :: DTree CItem -> SPic
|
||||||
itemTreeSPic (DT (itm,_) l r) = itemSPic itm <> foldMap (itemRotTreeSPic itm) (l <> r)
|
itemTreeSPic (DT (itm,_) l r) = itemSPic itm <> foldMap (itemRotTreeSPic itm) (l <> r)
|
||||||
|
|
||||||
itemRotTreeSPic :: Item -> (DTree CItem) -> SPic
|
itemRotTreeSPic :: Item -> DTree CItem -> SPic
|
||||||
itemRotTreeSPic par ( t) = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
|
itemRotTreeSPic par t = translateSP p . overPosSP (Q.rotate q) $ itemTreeSPic t
|
||||||
where
|
where
|
||||||
(p, q) = orientAttachment par itm
|
(p, q) = orientAttachment par itm
|
||||||
itm = t ^. dtValue
|
itm = t ^. dtValue
|
||||||
|
|||||||
+11
-16
@@ -52,10 +52,10 @@ tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
|
|||||||
itemToBreakLists ::
|
itemToBreakLists ::
|
||||||
Item ->
|
Item ->
|
||||||
ItemStructuralFunction ->
|
ItemStructuralFunction ->
|
||||||
([(ItemStructuralFunction)], [(ItemStructuralFunction)])
|
([ItemStructuralFunction], [ItemStructuralFunction])
|
||||||
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||||
(HELD TORCH, _) -> (getAmmoLinks itm, [])
|
(HELD TORCH, _) -> (getAmmoLinks itm, [])
|
||||||
(ATTACH UNDERBARRELSLOT, _) -> ([(UnderBarrelPlatformSF)], [])
|
(ATTACH UNDERBARRELSLOT, _) -> ([UnderBarrelPlatformSF], [])
|
||||||
(_, HeldPlatformSF) ->
|
(_, HeldPlatformSF) ->
|
||||||
( getAmmoLinks itm
|
( getAmmoLinks itm
|
||||||
<> extraWeaponLinksBelow itm
|
<> extraWeaponLinksBelow itm
|
||||||
@@ -181,41 +181,36 @@ type DTComb a = DTree a -> DTree a -> Maybe (DTree a)
|
|||||||
leftIsParentCombine :: DTComb CItem
|
leftIsParentCombine :: DTComb CItem
|
||||||
leftIsParentCombine ltree rtree = do
|
leftIsParentCombine ltree rtree = do
|
||||||
let l = rightChildList ltree
|
let l = rightChildList ltree
|
||||||
xs = dropWhile ((\s -> not $ S.member s (treeToPotentialFunction rtree))) l
|
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction rtree)) l
|
||||||
(sf) <- safeHead xs
|
sf <- safeHead xs
|
||||||
return $ ltree & dtRight .:~ ( rtree & dtValue . _2 .~ sf)
|
return $ ltree & dtRight .:~ ( rtree & dtValue . _2 .~ sf)
|
||||||
|
|
||||||
rightIsParentCombine :: DTComb CItem
|
rightIsParentCombine :: DTComb CItem
|
||||||
rightIsParentCombine ltree rtree = do
|
rightIsParentCombine ltree rtree = do
|
||||||
let l = leftChildList rtree
|
let l = leftChildList rtree
|
||||||
xs = dropWhile ((\s -> not $ S.member s (treeToPotentialFunction ltree))) l
|
xs = dropWhile (\s -> not $ S.member s (treeToPotentialFunction ltree)) l
|
||||||
(sf) <- safeHead xs
|
sf <- safeHead xs
|
||||||
return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf)
|
return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf)
|
||||||
|
|
||||||
leftChildList :: DTree CItem -> [ItemStructuralFunction]
|
leftChildList :: DTree CItem -> [ItemStructuralFunction]
|
||||||
leftChildList t = foldl' f l (reverse $ t ^.. dtLeft . each . dtValue . _2)
|
leftChildList t = foldl' f l (reverse $ t ^.. dtLeft . each . dtValue . _2)
|
||||||
where
|
where
|
||||||
l = fst $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
l = fst $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||||
f x y = tail $ dropWhile ((/=y) ) x
|
f x y = tail $ dropWhile (/=y) x
|
||||||
|
|
||||||
rightChildList :: DTree CItem -> [ItemStructuralFunction]
|
rightChildList :: DTree CItem -> [ItemStructuralFunction]
|
||||||
rightChildList t = foldl' f l (reverse $ t ^.. dtRight . each . dtValue . _2)
|
rightChildList t = foldl' f l (reverse $ t ^.. dtRight . each . dtValue . _2)
|
||||||
where
|
where
|
||||||
l = snd $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
l = snd $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||||
f x y = tail $ dropWhile ((/=y)) x
|
f x y = tail $ dropWhile (/=y) x
|
||||||
|
|
||||||
leftRightCombine ::
|
leftRightCombine :: DTComb a -> DTComb a -> DTree a -> DTree a -> Maybe (DTree a)
|
||||||
DTComb a ->
|
|
||||||
DTComb a ->
|
|
||||||
DTree a ->
|
|
||||||
DTree a ->
|
|
||||||
Maybe (DTree a)
|
|
||||||
leftRightCombine f f' t1 t2 = f t1 t2 <|> checkdepth t1 t2
|
leftRightCombine f f' t1 t2 = f t1 t2 <|> checkdepth t1 t2
|
||||||
where
|
where
|
||||||
checkdepth t t'@(DT x ls rs) = fromMaybe (checktop t t') $ do
|
checkdepth t t'@(DT x ls rs) = fromMaybe (checktop t t') $ do
|
||||||
(t'') <- safeHead ls
|
t'' <- safeHead ls
|
||||||
tx <- checkdepth t t''
|
tx <- checkdepth t t''
|
||||||
return $ Just $ DT x (( tx) : tail ls) rs
|
return $ Just $ DT x (tx : tail ls) rs
|
||||||
checktop t t' = f' t t'
|
checktop t t' = f' t t'
|
||||||
|
|
||||||
joinItemsInList :: (a -> a -> Maybe a) -> [a] -> [a]
|
joinItemsInList :: (a -> a -> Maybe a) -> [a] -> [a]
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ handOrient cr = case cr ^. crStance . posture of
|
|||||||
|
|
||||||
locOrient :: LocationDT OItem -> Creature -> Point3Q
|
locOrient :: LocationDT OItem -> Creature -> Point3Q
|
||||||
locOrient loc cr =
|
locOrient loc cr =
|
||||||
handHandleOrient (fmap (\(x, y, _) -> (x, y)) $ locToTop' loc) cr
|
handHandleOrient ((\(x, y, _) -> (x, y)) <$> locToTop' loc) cr
|
||||||
`Q.comp` (loc ^. locDT . dtValue . _3)
|
`Q.comp` (loc ^. locDT . dtValue . _3)
|
||||||
|
|
||||||
handHandleOrient :: LocationDT CItem -> Creature -> Point3Q
|
handHandleOrient :: LocationDT CItem -> Creature -> Point3Q
|
||||||
|
|||||||
@@ -1,6 +1,5 @@
|
|||||||
module Dodge.Item.Orientation (
|
module Dodge.Item.Orientation (
|
||||||
orientAttachment,
|
orientAttachment,
|
||||||
-- propagateOrientation,
|
|
||||||
propagateOrientation',
|
propagateOrientation',
|
||||||
) where
|
) where
|
||||||
|
|
||||||
@@ -40,12 +39,6 @@ orientAttachment par (ch,chsf) = case (_itType par, chsf) of
|
|||||||
(t1, q1) = orientByParentChSF par chsf
|
(t1, q1) = orientByParentChSF par chsf
|
||||||
(t2, q2) = orientChild ch
|
(t2, q2) = orientChild ch
|
||||||
|
|
||||||
--propagateOrientation :: LDTree ItemLink CItem -> LDTree ItemLink OItem
|
|
||||||
--propagateOrientation = ldtStartPropagate g f
|
|
||||||
-- where
|
|
||||||
-- g (x,y) = (x,y,(V3 0 0 0,Q.qID))
|
|
||||||
-- f (x,_,pq) _ (y,y1) = (y,y1,Q.comp pq $ orientAttachment x (y,y1))
|
|
||||||
|
|
||||||
propagateOrientation' :: DTree CItem -> DTree OItem
|
propagateOrientation' :: DTree CItem -> DTree OItem
|
||||||
propagateOrientation' = dtStartPropagate g f
|
propagateOrientation' = dtStartPropagate g f
|
||||||
where
|
where
|
||||||
|
|||||||
Reference in New Issue
Block a user