Move towards being able to orient positions on attached items
This commit is contained in:
+11
-39
@@ -22,7 +22,7 @@ useBreakL' :: [(ItemStructuralFunction, ComposeLinkType)] -> [(ItemStructuralFun
|
||||
-> LinkTest ItemLink
|
||||
useBreakL' x y = useBreakListsLinkTest (map (uncurry noa) x) (map (uncurry noa) y)
|
||||
where
|
||||
noa x y = (x, ILink y orientAttachment)
|
||||
noa a b = (a, ILink b orientAttachment)
|
||||
|
||||
|
||||
useBreakListsLinkTest :: [(ItemStructuralFunction, a)] -> [(ItemStructuralFunction, a)] -> LinkTest a
|
||||
@@ -40,12 +40,10 @@ useBreakListsLinkTest llist rlist = LTest ltest rtest
|
||||
itemToBreakLists :: Item
|
||||
-> ([(ItemStructuralFunction, ComposeLinkType)] , [(ItemStructuralFunction, ComposeLinkType)])
|
||||
itemToBreakLists itm = case itm ^. itType of
|
||||
HELD TORCH -> (getAmmoLinks itm,[])
|
||||
HELD {} ->
|
||||
( map
|
||||
(\(i, a) -> (AmmoMagSF a,AmmoInLink i a))
|
||||
(IM.toList $ itm ^. itUse . heldAmmoTypes)
|
||||
,
|
||||
[(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
|
||||
( getAmmoLinks itm
|
||||
, [(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
|
||||
)
|
||||
AMMOMAG {} -> fromMaybe ([],[]) $ do
|
||||
atype <- itm ^? itUse . amagType
|
||||
@@ -59,8 +57,14 @@ itemToBreakLists itm = case itm ^. itType of
|
||||
TARGETING{} -> ([(AugmentedHUDSF,AugmentedHUDLink)],[])
|
||||
_ -> ([],[])
|
||||
|
||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||
getAmmoLinks itm = map
|
||||
(\(i, a) -> (AmmoMagSF a,AmmoInLink i a))
|
||||
(IM.toList $ itm ^. itUse . heldAmmoTypes)
|
||||
|
||||
itemToFunction :: Item -> ItemStructuralFunction
|
||||
itemToFunction itm = case itm ^. itType of
|
||||
HELD TORCH -> WeaponScopeSF
|
||||
HELD {} -> WeaponPlatformSF
|
||||
AMMOMAG {} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
@@ -78,39 +82,7 @@ simplePCI :: Item -> PartiallyComposedItem ItemLink
|
||||
simplePCI itm = (itm, itemToFunction itm, uncurry useBreakL' $ itemToBreakLists itm)
|
||||
|
||||
basePartiallyComposedItem' :: Item -> PartiallyComposedItem ItemLink
|
||||
basePartiallyComposedItem' itm = case itm ^. itType of
|
||||
-- AMMOMAG _ -> ammoComposedItem' itm
|
||||
-- TARGETING{} -> (itm, WeaponTargetingSF, useBreakListsLinkTest [noa AugmentedHUDSF AugmentedHUDLink] [])
|
||||
-- ATTACH REMOTESCREEN -> nolinks RemoteScreenSF
|
||||
-- ATTACH BULLETSYNTHESIZER -> (itm, AmmoModifierSF BulletAmmo, LTest (const Nothing) (const Nothing))
|
||||
-- LEFT{} -> isolate
|
||||
-- EQUIP{} -> isolate
|
||||
-- CONSUMABLE{} -> isolate
|
||||
-- CRAFT{} -> isolate
|
||||
_ -> simplePCI itm
|
||||
where
|
||||
|
||||
noa x y = (x, ILink y orientAttachment)
|
||||
nolinks x = (itm, x, LTest (const Nothing) (const Nothing))
|
||||
isolate = (itm, UncomposableIsolateSF, LTest (const Nothing) (const Nothing))
|
||||
|
||||
ammoComposedItem' :: Item -> PartiallyComposedItem ItemLink
|
||||
ammoComposedItem' itm = fromMaybe (error "in ammoComposedItem, wrong item") $ do
|
||||
atype <- itm ^? itUse . amagType
|
||||
return
|
||||
( itm
|
||||
, AmmoMagSF atype
|
||||
, useBreakListsLinkTest
|
||||
[ noa (AmmoModifierSF atype) AmmoModLink
|
||||
, noa (AmmoTargetingSF atype) AmmoTargetingLink
|
||||
, noa (AmmoPayloadSF atype) AmmoPayloadLink
|
||||
, noa (AmmoEffectSF atype) AmmoEffectLink
|
||||
, noa RemoteScreenSF RemoteScreenLink
|
||||
]
|
||||
[]
|
||||
)
|
||||
where
|
||||
noa x y = (x, ILink y orientAttachment)
|
||||
basePartiallyComposedItem' itm = simplePCI itm
|
||||
|
||||
type LDTComb a b = LabelDoubleTree b a -> LabelDoubleTree b a -> Maybe (LabelDoubleTree b a)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user