This commit is contained in:
2025-07-12 21:52:12 +01:00
parent 026dbf9d15
commit a054d433b3
7 changed files with 28 additions and 51 deletions
+9 -28
View File
@@ -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)