From cab125a1e9f780035e19f980544a6fbb85102c34 Mon Sep 17 00:00:00 2001 From: justin Date: Sat, 12 Jul 2025 21:41:49 +0100 Subject: [PATCH] Remove ItemLink --- src/Dodge/Data/ComposedItem.hs | 27 +------------------------ src/Dodge/Item/Grammar.hs | 37 ++++++++++++++++------------------ src/Dodge/Item/Orientation.hs | 12 +++++------ 3 files changed, 24 insertions(+), 52 deletions(-) diff --git a/src/Dodge/Data/ComposedItem.hs b/src/Dodge/Data/ComposedItem.hs index c99c24b6b..f45db98fa 100644 --- a/src/Dodge/Data/ComposedItem.hs +++ b/src/Dodge/Data/ComposedItem.hs @@ -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 diff --git a/src/Dodge/Item/Grammar.hs b/src/Dodge/Item/Grammar.hs index e2ef43f91..20fe39e83 100644 --- a/src/Dodge/Item/Grammar.hs +++ b/src/Dodge/Item/Grammar.hs @@ -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 diff --git a/src/Dodge/Item/Orientation.hs b/src/Dodge/Item/Orientation.hs index 80a2a1325..604ace822 100644 --- a/src/Dodge/Item/Orientation.hs +++ b/src/Dodge/Item/Orientation.hs @@ -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