Implement bullet synth
This commit is contained in:
@@ -21,6 +21,12 @@ import Dodge.Item.Orientation
|
||||
import LensHelp
|
||||
import ListHelp
|
||||
|
||||
tryAttachItems ::
|
||||
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||
LabelDoubleTree ItemLink PartiallyComposedItem ->
|
||||
Maybe (LabelDoubleTree ItemLink PartiallyComposedItem)
|
||||
tryAttachItems = leftRightCombine leftIsParentCombine rightIsParentCombine
|
||||
|
||||
useBreakL ::
|
||||
[(ItemStructuralFunction, ComposeLinkType)] ->
|
||||
[(ItemStructuralFunction, ComposeLinkType)] ->
|
||||
@@ -66,6 +72,8 @@ itemToBreakLists ci = case (itm ^. itType, ci ^. cItemFunction) of
|
||||
, []
|
||||
)
|
||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(AugmentedHUDSF, AugmentedHUDLink)], [])
|
||||
(ATTACH BULLETSYNTH, _)
|
||||
-> ([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)],[])
|
||||
_ -> ([], [])
|
||||
where
|
||||
itm = ci ^. cItem
|
||||
@@ -78,10 +86,11 @@ getAmmoLinks itm =
|
||||
|
||||
itemToFunction :: Item -> ItemStructuralFunction
|
||||
itemToFunction itm = case itm ^. itType of
|
||||
HELD LASER -> WeaponTargetingSF
|
||||
HELD{} -> WeaponPlatformSF
|
||||
AMMOMAG{} -> maybe UncomposableIsolateSF AmmoMagSF $ itm ^? itUse . amagType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
ATTACH BULLETSYNTHESIZER -> AmmoModifierSF BulletAmmo
|
||||
ATTACH BULLETSYNTH -> AmmoModifierSF BulletAmmo
|
||||
ATTACH ZOOMSCOPE -> WeaponScopeSF
|
||||
ATTACH HOMINGMODULE -> AmmoTargetingSF ProjectileAmmo
|
||||
ATTACH AUGMENTEDHUD -> AugmentedHUDSF
|
||||
@@ -89,8 +98,8 @@ itemToFunction itm = case itm ^. itType of
|
||||
BULLETMOD BulletModPayload{} -> AmmoPayloadSF BulletAmmo
|
||||
BULLETMOD BulletModEffect{} -> AmmoEffectSF BulletAmmo
|
||||
TARGETING{} -> WeaponTargetingSF
|
||||
LEFT {} -> EquipmentPlatformSF
|
||||
EQUIP {} -> EquipmentPlatformSF
|
||||
LEFT{} -> EquipmentPlatformSF
|
||||
EQUIP{} -> EquipmentPlatformSF
|
||||
_ -> UncomposableIsolateSF
|
||||
|
||||
pciToCI :: PartiallyComposedItem -> ComposedItem
|
||||
@@ -98,8 +107,12 @@ pciToCI (x, y, _) = CItem x y
|
||||
|
||||
basePCI :: Item -> PartiallyComposedItem
|
||||
basePCI itm = case _itType itm of
|
||||
HELD LASER -> (itm, WeaponTargetingSF, laserLinkTest itm)
|
||||
_ -> (itm, itemToFunction itm, uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm)))
|
||||
_ -> (itm, itemToFunction itm, itemBaseConnections itm)
|
||||
|
||||
itemBaseConnections :: Item -> LinkTest
|
||||
itemBaseConnections itm = case _itType itm of
|
||||
HELD LASER -> laserLinkTest itm
|
||||
_ -> uncurry useBreakL $ itemToBreakLists (CItem itm (itemToFunction itm))
|
||||
|
||||
laserLinkTest :: Item -> LinkTest
|
||||
laserLinkTest itm = LTest (llleft itm) (llright itm)
|
||||
@@ -171,7 +184,7 @@ joinItemsInList f xs = snd $ h (xs, [])
|
||||
-- this puts the first elements in the intmap at the end of the list
|
||||
invLDT :: IM.IntMap Item -> [LabelDoubleTree ItemLink PartiallyComposedItem]
|
||||
invLDT =
|
||||
joinItemsInList (leftRightCombine leftIsParentCombine rightIsParentCombine) . IM.elems
|
||||
joinItemsInList tryAttachItems . IM.elems
|
||||
. fmap (singleLDT . basePCI)
|
||||
|
||||
-- this assumes the creature inventory is well formed, specifically the
|
||||
|
||||
Reference in New Issue
Block a user