Cleanup
This commit is contained in:
@@ -33,26 +33,7 @@ import ListHelp
|
||||
tryAttachItems :: DTree CItem -> DTree CItem -> Maybe (DTree CItem)
|
||||
tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
|
||||
|
||||
--breakListAbove :: Item -> ItemStructuralFunction -> [(ItemStructuralFunction, ItemLink)]
|
||||
--breakListAbove itm itmf = case (itm ^. itType, itmf) of
|
||||
-- (_, HeldPlatformSF) ->
|
||||
-- [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
-- <> getAutoSpringLinks itm
|
||||
-- <> extraWeaponLinks itm
|
||||
-- (DETECTOR {}, _) ->
|
||||
-- [(ARHUDSF,SFLink ARHUDSF),(TriggerSF, TriggerLink),(MapperSF,SFLink MapperSF)]
|
||||
-- (CRAFT TRANSFORMER, _) -> [(LaserWeaponSF,SFLink LaserWeaponSF)]
|
||||
-- (MAPPER, _) -> [(ARHUDSF,SFLink ARHUDSF)]
|
||||
-- (_, GadgetPlatformSF) ->
|
||||
-- [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
-- (_, RemoteScreenSF) ->
|
||||
-- [(JoystickSF, JoystickLink)]
|
||||
-- _ -> []
|
||||
|
||||
itemToBreakLists ::
|
||||
Item ->
|
||||
ItemStructuralFunction ->
|
||||
([ItemStructuralFunction], [ItemStructuralFunction])
|
||||
itemToBreakLists :: Item -> ItemSF -> ([ItemSF], [ItemSF])
|
||||
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
(HELD TORCH, _) -> (getAmmoLinks itm, [])
|
||||
(ATTACH UNDERBARRELSLOT, _) -> ([UnderBarrelPlatformSF], [])
|
||||
@@ -105,12 +86,12 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
([AmmoMagSF 0 ElectricalAmmo], [])
|
||||
_ -> ([], [])
|
||||
|
||||
getAutoSpringLinks :: Item -> [ItemStructuralFunction]
|
||||
getAutoSpringLinks :: Item -> [ItemSF]
|
||||
getAutoSpringLinks itm = case baseItemTriggerType itm of
|
||||
HammerTrigger _ -> [MakeAutoSF]
|
||||
_ -> []
|
||||
|
||||
extraWeaponLinks :: Item -> [ItemStructuralFunction]
|
||||
extraWeaponLinks :: Item -> [ItemSF]
|
||||
extraWeaponLinks itm = case itm ^. itType of
|
||||
HELD GLAUNCHER -> launcherlinks <> [GrenadeHitEffectSF]
|
||||
HELD RLAUNCHER -> launcherlinks
|
||||
@@ -119,15 +100,15 @@ extraWeaponLinks itm = case itm ^. itType of
|
||||
where
|
||||
launcherlinks = [ProjectileStabiliserSF]
|
||||
|
||||
extraWeaponLinksBelow :: Item -> [ItemStructuralFunction]
|
||||
extraWeaponLinksBelow :: Item -> [ItemSF]
|
||||
extraWeaponLinksBelow itm
|
||||
| TwoHandUnder <- itemBaseStance itm = [UnderBarrelSlotSF]
|
||||
| otherwise = []
|
||||
|
||||
getAmmoLinks :: Item -> [ItemStructuralFunction]
|
||||
getAmmoLinks :: Item -> [ItemSF]
|
||||
getAmmoLinks itm = map (uncurry AmmoMagSF) (IM.toList $ itemAmmoSlots itm)
|
||||
|
||||
itemToFunction :: Item -> ItemStructuralFunction
|
||||
itemToFunction :: Item -> ItemSF
|
||||
itemToFunction itm = case itm ^. itType of
|
||||
DETECTOR {} -> GadgetPlatformSF
|
||||
MAPPER -> MapperSF
|
||||
@@ -161,7 +142,7 @@ itemToFunction itm = case itm ^. itType of
|
||||
CLICKER{} -> GadgetPlatformSF
|
||||
_ -> NoSF
|
||||
|
||||
treeToPotentialFunction :: DTree CItem -> S.Set ItemStructuralFunction
|
||||
treeToPotentialFunction :: DTree CItem -> S.Set ItemSF
|
||||
treeToPotentialFunction ldt = case ldt ^. dtValue . _1 . itType of
|
||||
STICKYMOD -> S.singleton GrenadeHitEffectSF
|
||||
ATTACH GIMBAL -> S.singleton ProjectileStabiliserSF
|
||||
@@ -192,13 +173,13 @@ rightIsParentCombine ltree rtree = do
|
||||
sf <- safeHead xs
|
||||
return $ rtree & dtLeft .:~ ( ltree & dtValue . _2 .~ sf)
|
||||
|
||||
leftChildList :: DTree CItem -> [ItemStructuralFunction]
|
||||
leftChildList :: DTree CItem -> [ItemSF]
|
||||
leftChildList t = foldl' f l (reverse $ t ^.. dtLeft . each . dtValue . _2)
|
||||
where
|
||||
l = fst $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||
f x y = tail $ dropWhile (/=y) x
|
||||
|
||||
rightChildList :: DTree CItem -> [ItemStructuralFunction]
|
||||
rightChildList :: DTree CItem -> [ItemSF]
|
||||
rightChildList t = foldl' f l (reverse $ t ^.. dtRight . each . dtValue . _2)
|
||||
where
|
||||
l = snd $ itemToBreakLists (t ^. dtValue . _1) (t ^. dtValue . _2)
|
||||
|
||||
@@ -55,7 +55,7 @@ handOrient cr = case cr ^. crStance . posture of
|
||||
|
||||
locOrient :: LocationDT OItem -> Creature -> Point3Q
|
||||
locOrient loc cr =
|
||||
handHandleOrient ((\(x, y, _) -> (x, y)) <$> locToTop' loc) cr
|
||||
handHandleOrient ((\(x, y, _) -> (x, y)) <$> locToTop loc) cr
|
||||
`Q.comp` (loc ^. locDT . dtValue . _3)
|
||||
|
||||
handHandleOrient :: LocationDT CItem -> Creature -> Point3Q
|
||||
@@ -63,7 +63,7 @@ handHandleOrient loc cr =
|
||||
handOrient cr (aimStance (loc' ^. locDT))
|
||||
`Q.comp` handleOrient loc'
|
||||
where
|
||||
loc' = locToTop' loc
|
||||
loc' = locToTop loc
|
||||
|
||||
shoulderHeight :: Float
|
||||
shoulderHeight = 18
|
||||
|
||||
@@ -21,7 +21,7 @@ orientChild itm = case _itType itm of
|
||||
--r = Q.axisAngle (V3 0 0 1) (-pi/4)
|
||||
r = Q.qID
|
||||
|
||||
orientByParentChSF :: Item -> ItemStructuralFunction -> Point3Q
|
||||
orientByParentChSF :: Item -> ItemSF -> Point3Q
|
||||
orientByParentChSF itm lt = case (_itType itm, lt) of
|
||||
(HELD FLAMETHROWER, AmmoMagSF{}) -> (V3 4 (-6) 0, Q.qID)
|
||||
(HELD _, AmmoMagSF{}) -> (V3 7 (-2) 0, Q.qID)
|
||||
|
||||
Reference in New Issue
Block a user