Remove ItemLink

This commit is contained in:
2025-07-12 21:41:49 +01:00
parent dc631263da
commit cab125a1e9
3 changed files with 24 additions and 52 deletions
+1 -26
View File
@@ -6,34 +6,11 @@
module Dodge.Data.ComposedItem where
import Dodge.Data.AmmoType
import Control.Lens
--import Control.Lens
import Dodge.Data.Item
import Linear
import qualified Linear.Quaternion as Q
data ItemLink
--TriggerLink
-- | AmmoInLink Int AmmoType
-- | AmmoModLink
-- | AmmoTargetingLink
-- | AmmoPayloadLink
-- | AmmoEffectLink
-- | WeaponScopeLink
-- | WeaponTargetingLink
-- | JoystickLink
-- | RemoteScreenLink
-- | RemoteDetonatorLink
-- | SmokeReducerLink
---- | AugmentedHUDLink
-- | FunctionChangeLink
-- | MakeAutoLink
-- | ProjectileStabiliserLink
-- | UnderBarrelSlotLink
-- | UnderBarrelPlatformLink
-- | GrenadeHitEffectLink
= SFLink {_sfLink :: ItemStructuralFunction}
deriving (Eq, Ord, Show, Read)
data ItemStructuralFunction
= UnloadedWeaponSF
| HeldPlatformSF
@@ -68,5 +45,3 @@ data ItemStructuralFunction
type CItem = (Item, ItemStructuralFunction)
type OItem = (Item, ItemStructuralFunction, (V3 Float,Q.Quaternion Float))
makeLenses ''ItemLink
+17 -20
View File
@@ -87,48 +87,45 @@ itemToBreakLists itm itmf = case (itm ^. itType, itmf) of
]
_ -> []
return
( [ (AmmoModifierSF atype)
, (AmmoTargetingSF atype)
, (AmmoPayloadSF atype)
, (AmmoEffectSF atype)
, (SmokeReducerSF)
( [ AmmoModifierSF atype
, AmmoTargetingSF atype
, AmmoPayloadSF atype
, AmmoEffectSF atype
, SmokeReducerSF
]
<> screenanddet
, []
)
(_, RemoteScreenSF) ->
( [(JoystickSF)]
( [JoystickSF]
, []
)
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(ARHUDSF)], [])
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [ARHUDSF], [])
(ATTACH BULLETSYNTH, _) ->
([(AmmoMagSF 0 ElectricalAmmo)], [])
([AmmoMagSF 0 ElectricalAmmo], [])
_ -> ([], [])
getAutoSpringLinks :: Item -> [(ItemStructuralFunction)]
getAutoSpringLinks :: Item -> [ItemStructuralFunction]
getAutoSpringLinks itm = case baseItemTriggerType itm of
HammerTrigger _ -> [(MakeAutoSF)]
HammerTrigger _ -> [MakeAutoSF]
_ -> []
extraWeaponLinks :: Item -> [(ItemStructuralFunction)]
extraWeaponLinks :: Item -> [ItemStructuralFunction]
extraWeaponLinks itm = case itm ^. itType of
HELD GLAUNCHER -> launcherlinks <> [(GrenadeHitEffectSF)]
HELD GLAUNCHER -> launcherlinks <> [GrenadeHitEffectSF]
HELD RLAUNCHER -> launcherlinks
HELD RLAUNCHERX{} -> launcherlinks
_ -> []
where
launcherlinks = [(ProjectileStabiliserSF)]
launcherlinks = [ProjectileStabiliserSF]
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction)]
extraWeaponLinksBelow :: Item -> [ItemStructuralFunction]
extraWeaponLinksBelow itm
| TwoHandUnder <- itemBaseStance itm = [(UnderBarrelSlotSF)]
| TwoHandUnder <- itemBaseStance itm = [UnderBarrelSlotSF]
| otherwise = []
getAmmoLinks :: Item -> [(ItemStructuralFunction)]
getAmmoLinks itm =
map
(\(i, a) -> (AmmoMagSF i a))
(IM.toList $ itemAmmoSlots itm)
getAmmoLinks :: Item -> [ItemStructuralFunction]
getAmmoLinks itm = map (uncurry AmmoMagSF) (IM.toList $ itemAmmoSlots itm)
itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of
+6 -6
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Orientation (
orientAttachment,
propagateOrientation,
-- propagateOrientation,
propagateOrientation',
) where
@@ -40,11 +40,11 @@ orientAttachment par (ch,chsf) = case (_itType par, chsf) of
(t1, q1) = orientByParentChSF par chsf
(t2, q2) = orientChild ch
propagateOrientation :: LDTree ItemLink CItem -> LDTree ItemLink OItem
propagateOrientation = ldtStartPropagate g f
where
g (x,y) = (x,y,(V3 0 0 0,Q.qID))
f (x,_,pq) _ (y,y1) = (y,y1,Q.comp pq $ orientAttachment x (y,y1))
--propagateOrientation :: LDTree ItemLink CItem -> LDTree ItemLink OItem
--propagateOrientation = ldtStartPropagate g f
-- where
-- g (x,y) = (x,y,(V3 0 0 0,Q.qID))
-- f (x,_,pq) _ (y,y1) = (y,y1,Q.comp pq $ orientAttachment x (y,y1))
propagateOrientation' :: DTree CItem -> DTree OItem
propagateOrientation' = dtStartPropagate g f