Use item function in determining attachments
This commit is contained in:
+1
-1
@@ -1 +1 @@
|
|||||||
All good (597 modules, at 16:02:38)
|
All good (597 modules, at 16:43:58)
|
||||||
|
|||||||
+16
-12
@@ -9,11 +9,11 @@ module Dodge.Item.Grammar (
|
|||||||
allInvLocs,
|
allInvLocs,
|
||||||
) where
|
) where
|
||||||
|
|
||||||
|
import Dodge.Data.ComposedItem
|
||||||
import Control.Applicative
|
import Control.Applicative
|
||||||
import Data.Bifunctor
|
import Data.Bifunctor
|
||||||
import qualified Data.IntMap.Strict as IM
|
import qualified Data.IntMap.Strict as IM
|
||||||
import Data.Maybe
|
import Data.Maybe
|
||||||
import Dodge.Data.ComposedItem
|
|
||||||
import Dodge.Data.DoubleTree
|
import Dodge.Data.DoubleTree
|
||||||
import Dodge.Data.Item
|
import Dodge.Data.Item
|
||||||
import Dodge.DoubleTree
|
import Dodge.DoubleTree
|
||||||
@@ -41,15 +41,17 @@ useBreakListsLinkTest llist rlist = LTest ltest rtest
|
|||||||
(_, linktype) <- safeHead xs
|
(_, linktype) <- safeHead xs
|
||||||
return $ LUpdate linktype (set _3 (useBreakListsLinkTest llist (tail xs))) id
|
return $ LUpdate linktype (set _3 (useBreakListsLinkTest llist (tail xs))) id
|
||||||
|
|
||||||
itemToBreakLists :: Item
|
itemToBreakLists
|
||||||
|
:: ComposedItem
|
||||||
-> ([(ItemStructuralFunction, ComposeLinkType)] , [(ItemStructuralFunction, ComposeLinkType)])
|
-> ([(ItemStructuralFunction, ComposeLinkType)] , [(ItemStructuralFunction, ComposeLinkType)])
|
||||||
itemToBreakLists itm = case itm ^. itType of
|
itemToBreakLists ci = case (itm ^. itType,ci ^. cItemFunction) of
|
||||||
HELD TORCH -> (getAmmoLinks itm,[])
|
-- HELD TORCH -> (getAmmoLinks itm,[])
|
||||||
HELD {} ->
|
(_,WeaponPlatformSF) ->
|
||||||
( getAmmoLinks itm
|
( getAmmoLinks itm
|
||||||
, [(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
|
, [(WeaponTargetingSF,WeaponTargetingLink), (WeaponScopeSF,WeaponScopeLink)]
|
||||||
)
|
)
|
||||||
AMMOMAG {} -> fromMaybe ([],[]) $ do
|
-- AMMOMAG {} -> fromMaybe ([],[]) $ do
|
||||||
|
(_,AmmoMagSF {}) -> fromMaybe ([],[]) $ do
|
||||||
atype <- itm ^? itUse . amagType
|
atype <- itm ^? itUse . amagType
|
||||||
return
|
return
|
||||||
([ (AmmoModifierSF atype, AmmoModLink)
|
([ (AmmoModifierSF atype, AmmoModLink)
|
||||||
@@ -58,9 +60,11 @@ itemToBreakLists itm = case itm ^. itType of
|
|||||||
, (AmmoEffectSF atype, AmmoEffectLink)
|
, (AmmoEffectSF atype, AmmoEffectLink)
|
||||||
, (RemoteScreenSF, RemoteScreenLink)
|
, (RemoteScreenSF, RemoteScreenLink)
|
||||||
],[])
|
],[])
|
||||||
TARGETING TARGETLASER -> (getAmmoLinks itm ++ [(AugmentedHUDSF,AugmentedHUDLink)],[])
|
(_,WeaponTargetingSF) -> (getAmmoLinks itm ++ [(AugmentedHUDSF,AugmentedHUDLink)],[])
|
||||||
TARGETING{} -> ([(AugmentedHUDSF,AugmentedHUDLink)],[])
|
-- TARGETING{} -> ([(AugmentedHUDSF,AugmentedHUDLink)],[])
|
||||||
_ -> ([],[])
|
_ -> ([],[])
|
||||||
|
where
|
||||||
|
itm = ci ^. cItem
|
||||||
|
|
||||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
getAmmoLinks :: Item -> [(ItemStructuralFunction, ComposeLinkType)]
|
||||||
getAmmoLinks itm = map
|
getAmmoLinks itm = map
|
||||||
@@ -89,22 +93,22 @@ pciToCI (x,y,_) = CItem x y
|
|||||||
basePCI :: Item -> PartiallyComposedItem
|
basePCI :: Item -> PartiallyComposedItem
|
||||||
basePCI itm = case _itType itm of
|
basePCI itm = case _itType itm of
|
||||||
HELD LASER -> (itm, WeaponTargetingSF, laserLinkTest itm)
|
HELD LASER -> (itm, WeaponTargetingSF, laserLinkTest itm)
|
||||||
_ -> (itm, itemToFunction itm, uncurry useBreakL $ itemToBreakLists itm)
|
_ -> (itm, itemToFunction itm, uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm)))
|
||||||
|
|
||||||
laserLinkTest :: Item -> LinkTest
|
laserLinkTest :: Item -> LinkTest
|
||||||
laserLinkTest itm = LTest (llleft itm) (llright itm)
|
laserLinkTest itm = LTest (llleft itm) (llright itm)
|
||||||
|
|
||||||
llleft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
llleft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
||||||
llleft itm pci = _tryLeftLink (uncurry useBreakL $ itemToBreakLists itm) pci
|
llleft itm pci = _tryLeftLink (uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm))) pci
|
||||||
|
|
||||||
llright :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
llright :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
||||||
llright itm pci = case pci ^. _1 . itType of
|
llright itm pci = case pci ^. _1 . itType of
|
||||||
CRAFT TRANSFORMER -> Just (toLasgunUpdate itm)
|
CRAFT TRANSFORMER -> Just (toLasgunUpdate itm)
|
||||||
_ -> _tryRightLink (uncurry useBreakL $ itemToBreakLists itm) pci
|
_ -> _tryRightLink (uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm))) pci
|
||||||
|
|
||||||
toLasgunUpdate :: Item -> LinkUpdate
|
toLasgunUpdate :: Item -> LinkUpdate
|
||||||
toLasgunUpdate itm = LUpdate (ILink FunctionChangeLink orientAttachment)
|
toLasgunUpdate itm = LUpdate (ILink FunctionChangeLink orientAttachment)
|
||||||
(\(par,_,_) -> (par,WeaponPlatformSF,uncurry useBreakL $ itemToBreakLists itm))
|
(\(par,_,_) -> (par,WeaponPlatformSF,uncurry useBreakL $ itemToBreakLists (CItem itm WeaponPlatformSF)))
|
||||||
(\(chi,_,up) -> (chi,FunctionChangeSF,up))
|
(\(chi,_,up) -> (chi,FunctionChangeSF,up))
|
||||||
|
|
||||||
--itemLinkTestLeft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
--itemLinkTestLeft :: Item -> PartiallyComposedItem -> Maybe LinkUpdate
|
||||||
|
|||||||
Reference in New Issue
Block a user