Move towards removing functionality associated with ItemLinks
This commit is contained in:
+39
-28
@@ -57,13 +57,22 @@ itemToBreakLists ::
|
||||
Item ->
|
||||
ItemStructuralFunction ->
|
||||
([(ItemStructuralFunction, ItemLink)], [(ItemStructuralFunction, ItemLink)])
|
||||
itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
itemToBreakLists itm itmf = (fmap f l, fmap f r)
|
||||
where
|
||||
f x = (x, SFLink x)
|
||||
(l,r) = itemToBreakLists' itm itmf
|
||||
|
||||
itemToBreakLists' ::
|
||||
Item ->
|
||||
ItemStructuralFunction ->
|
||||
([(ItemStructuralFunction)], [(ItemStructuralFunction)])
|
||||
itemToBreakLists' itm itmf = case (itm ^. itType, itmf) of
|
||||
(HELD TORCH, _) -> (getAmmoLinks itm, [])
|
||||
(ATTACH UNDERBARRELSLOT, _) -> ([(UnderBarrelPlatformSF, UnderBarrelPlatformLink)], [])
|
||||
(ATTACH UNDERBARRELSLOT, _) -> ([(UnderBarrelPlatformSF)], [])
|
||||
(_, HeldPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
<> extraWeaponLinksBelow itm
|
||||
, [(WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
, [(WeaponTargetingSF), (WeaponScopeSF)]
|
||||
<> getAutoSpringLinks itm
|
||||
<> extraWeaponLinks itm
|
||||
)
|
||||
@@ -71,69 +80,69 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
|
||||
( getAmmoLinks itm,[])
|
||||
(DETECTOR {}, _) ->
|
||||
( getAmmoLinks itm
|
||||
, [(ARHUDSF,SFLink ARHUDSF),(TriggerSF, TriggerLink),(MapperSF,SFLink MapperSF)]
|
||||
, [(ARHUDSF),(TriggerSF),(MapperSF)]
|
||||
)
|
||||
(CRAFT TRANSFORMER, _) -> ([],[(LaserWeaponSF,SFLink LaserWeaponSF)])
|
||||
(CRAFT TRANSFORMER, _) -> ([],[(LaserWeaponSF)])
|
||||
(MAPPER, _) ->
|
||||
( []
|
||||
, [(ARHUDSF,SFLink ARHUDSF)]
|
||||
, [(ARHUDSF)]
|
||||
)
|
||||
(_, GadgetPlatformSF) ->
|
||||
( getAmmoLinks itm
|
||||
, [(TriggerSF, TriggerLink), (WeaponTargetingSF, WeaponTargetingLink), (WeaponScopeSF, WeaponScopeLink)]
|
||||
, [(TriggerSF), (WeaponTargetingSF), (WeaponScopeSF)]
|
||||
)
|
||||
(_, AmmoMagSF{}) -> fromMaybe ([], []) $ do
|
||||
atype <- magAmmoType itm
|
||||
let screenanddet = case atype of
|
||||
LauncherAmmo ->
|
||||
[ (RemoteScreenSF, RemoteScreenLink)
|
||||
, (RemoteDetonatorSF, RemoteDetonatorLink)
|
||||
[ (RemoteScreenSF)
|
||||
, (RemoteDetonatorSF)
|
||||
]
|
||||
_ -> []
|
||||
return
|
||||
( [ (AmmoModifierSF atype, AmmoModLink)
|
||||
, (AmmoTargetingSF atype, AmmoTargetingLink)
|
||||
, (AmmoPayloadSF atype, AmmoPayloadLink)
|
||||
, (AmmoEffectSF atype, AmmoEffectLink)
|
||||
, (SmokeReducerSF, SmokeReducerLink)
|
||||
( [ (AmmoModifierSF atype)
|
||||
, (AmmoTargetingSF atype)
|
||||
, (AmmoPayloadSF atype)
|
||||
, (AmmoEffectSF atype)
|
||||
, (SmokeReducerSF)
|
||||
]
|
||||
<> screenanddet
|
||||
, []
|
||||
)
|
||||
(_, RemoteScreenSF) ->
|
||||
( [(JoystickSF, JoystickLink)]
|
||||
( [(JoystickSF)]
|
||||
, []
|
||||
)
|
||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(ARHUDSF, SFLink ARHUDSF)], [])
|
||||
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(ARHUDSF)], [])
|
||||
(ATTACH BULLETSYNTH, _) ->
|
||||
([(AmmoMagSF ElectricalAmmo, AmmoInLink 0 ElectricalAmmo)], [])
|
||||
([(AmmoMagSF 0 ElectricalAmmo)], [])
|
||||
_ -> ([], [])
|
||||
|
||||
getAutoSpringLinks :: Item -> [(ItemStructuralFunction, ItemLink)]
|
||||
getAutoSpringLinks :: Item -> [(ItemStructuralFunction)]
|
||||
getAutoSpringLinks itm = case baseItemTriggerType itm of
|
||||
HammerTrigger _ -> [(MakeAutoSF, MakeAutoLink)]
|
||||
HammerTrigger _ -> [(MakeAutoSF)]
|
||||
_ -> []
|
||||
|
||||
extraWeaponLinks :: Item -> [(ItemStructuralFunction, ItemLink)]
|
||||
extraWeaponLinks :: Item -> [(ItemStructuralFunction)]
|
||||
extraWeaponLinks itm = case itm ^. itType of
|
||||
HELD GLAUNCHER -> launcherlinks <> [(GrenadeHitEffectSF,GrenadeHitEffectLink)]
|
||||
HELD GLAUNCHER -> launcherlinks <> [(GrenadeHitEffectSF)]
|
||||
HELD RLAUNCHER -> launcherlinks
|
||||
HELD RLAUNCHERX{} -> launcherlinks
|
||||
_ -> []
|
||||
where
|
||||
launcherlinks = [(ProjectileStabiliserSF,ProjectileStabiliserLink)]
|
||||
launcherlinks = [(ProjectileStabiliserSF)]
|
||||
|
||||
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction, ItemLink)]
|
||||
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction)]
|
||||
extraWeaponLinksBelow itm
|
||||
-- | Just TwoHandUnder <- itm ^? itUse . heldAim . aimStance
|
||||
| TwoHandUnder <- itemBaseStance itm
|
||||
= [(UnderBarrelSlotSF,UnderBarrelSlotLink)]
|
||||
= [(UnderBarrelSlotSF)]
|
||||
| otherwise = []
|
||||
|
||||
getAmmoLinks :: Item -> [(ItemStructuralFunction, ItemLink)]
|
||||
getAmmoLinks :: Item -> [(ItemStructuralFunction)]
|
||||
getAmmoLinks itm =
|
||||
map
|
||||
(\(i, a) -> (AmmoMagSF a, AmmoInLink i a))
|
||||
(\(i, a) -> (AmmoMagSF i a))
|
||||
(IM.toList $ itemAmmoSlots itm)
|
||||
|
||||
itemToFunction :: Item -> ItemStructuralFunction
|
||||
@@ -149,8 +158,8 @@ itemToFunction itm = case itm ^. itType of
|
||||
_
|
||||
| Just amtype <- magAmmoType itm-- ^? itConsumables . magType
|
||||
, Just _ <- itm ^? itLocation . ilEquipSite . _Just ->
|
||||
AmmoMagSF amtype
|
||||
AMMOMAG{} -> maybe NoSF AmmoMagSF $ magAmmoType itm -- ^? itConsumables . magType
|
||||
AmmoMagSF 0 amtype
|
||||
AMMOMAG{} -> maybe NoSF (AmmoMagSF 0) $ magAmmoType itm -- ^? itConsumables . magType
|
||||
ATTACH REMOTESCREEN -> RemoteScreenSF
|
||||
ATTACH JOYSTICK -> JoystickSF
|
||||
ATTACH REMOTEDETONATOR -> RemoteDetonatorSF
|
||||
@@ -178,6 +187,8 @@ treeToPotentialFunction ldt = case ldt ^. ldtValue . _1 . itType of
|
||||
HELD GLAUNCHER -> S.singleton UnderBarrelPlatformSF
|
||||
HELD BURSTRIFLE -> S.singleton UnderBarrelPlatformSF
|
||||
HELD LASER -> S.fromList [WeaponTargetingSF,LaserWeaponSF]
|
||||
-- following limits items to ten ammo slots
|
||||
_ | AmmoMagSF _ x <- ldt ^. ldtValue . _2 -> S.fromList [AmmoMagSF i x | i <- [0..9]]
|
||||
_ -> S.singleton (ldt ^. ldtValue . _2)
|
||||
|
||||
baseCI :: Item -> CItem
|
||||
|
||||
Reference in New Issue
Block a user