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 module Dodge.Data.ComposedItem where
import Dodge.Data.AmmoType import Dodge.Data.AmmoType
import Control.Lens --import Control.Lens
import Dodge.Data.Item import Dodge.Data.Item
import Linear import Linear
import qualified Linear.Quaternion as Q 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 data ItemStructuralFunction
= UnloadedWeaponSF = UnloadedWeaponSF
| HeldPlatformSF | HeldPlatformSF
@@ -68,5 +45,3 @@ data ItemStructuralFunction
type CItem = (Item, ItemStructuralFunction) type CItem = (Item, ItemStructuralFunction)
type OItem = (Item, ItemStructuralFunction, (V3 Float,Q.Quaternion Float)) 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 return
( [ (AmmoModifierSF atype) ( [ AmmoModifierSF atype
, (AmmoTargetingSF atype) , AmmoTargetingSF atype
, (AmmoPayloadSF atype) , AmmoPayloadSF atype
, (AmmoEffectSF atype) , AmmoEffectSF atype
, (SmokeReducerSF) , SmokeReducerSF
] ]
<> screenanddet <> screenanddet
, [] , []
) )
(_, RemoteScreenSF) -> (_, RemoteScreenSF) ->
( [(JoystickSF)] ( [JoystickSF]
, [] , []
) )
(_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [(ARHUDSF)], []) (_, WeaponTargetingSF) -> (getAmmoLinks itm ++ [ARHUDSF], [])
(ATTACH BULLETSYNTH, _) -> (ATTACH BULLETSYNTH, _) ->
([(AmmoMagSF 0 ElectricalAmmo)], []) ([AmmoMagSF 0 ElectricalAmmo], [])
_ -> ([], []) _ -> ([], [])
getAutoSpringLinks :: Item -> [(ItemStructuralFunction)] getAutoSpringLinks :: Item -> [ItemStructuralFunction]
getAutoSpringLinks itm = case baseItemTriggerType itm of getAutoSpringLinks itm = case baseItemTriggerType itm of
HammerTrigger _ -> [(MakeAutoSF)] HammerTrigger _ -> [MakeAutoSF]
_ -> [] _ -> []
extraWeaponLinks :: Item -> [(ItemStructuralFunction)] extraWeaponLinks :: Item -> [ItemStructuralFunction]
extraWeaponLinks itm = case itm ^. itType of extraWeaponLinks itm = case itm ^. itType of
HELD GLAUNCHER -> launcherlinks <> [(GrenadeHitEffectSF)] HELD GLAUNCHER -> launcherlinks <> [GrenadeHitEffectSF]
HELD RLAUNCHER -> launcherlinks HELD RLAUNCHER -> launcherlinks
HELD RLAUNCHERX{} -> launcherlinks HELD RLAUNCHERX{} -> launcherlinks
_ -> [] _ -> []
where where
launcherlinks = [(ProjectileStabiliserSF)] launcherlinks = [ProjectileStabiliserSF]
extraWeaponLinksBelow :: Item -> [(ItemStructuralFunction)] extraWeaponLinksBelow :: Item -> [ItemStructuralFunction]
extraWeaponLinksBelow itm extraWeaponLinksBelow itm
| TwoHandUnder <- itemBaseStance itm = [(UnderBarrelSlotSF)] | TwoHandUnder <- itemBaseStance itm = [UnderBarrelSlotSF]
| otherwise = [] | otherwise = []
getAmmoLinks :: Item -> [(ItemStructuralFunction)] getAmmoLinks :: Item -> [ItemStructuralFunction]
getAmmoLinks itm = getAmmoLinks itm = map (uncurry AmmoMagSF) (IM.toList $ itemAmmoSlots itm)
map
(\(i, a) -> (AmmoMagSF i a))
(IM.toList $ itemAmmoSlots itm)
itemToFunction :: Item -> ItemStructuralFunction itemToFunction :: Item -> ItemStructuralFunction
itemToFunction itm = case itm ^. itType of itemToFunction itm = case itm ^. itType of
+6 -6
View File
@@ -1,6 +1,6 @@
module Dodge.Item.Orientation ( module Dodge.Item.Orientation (
orientAttachment, orientAttachment,
propagateOrientation, -- propagateOrientation,
propagateOrientation', propagateOrientation',
) where ) where
@@ -40,11 +40,11 @@ orientAttachment par (ch,chsf) = case (_itType par, chsf) of
(t1, q1) = orientByParentChSF par chsf (t1, q1) = orientByParentChSF par chsf
(t2, q2) = orientChild ch (t2, q2) = orientChild ch
propagateOrientation :: LDTree ItemLink CItem -> LDTree ItemLink OItem --propagateOrientation :: LDTree ItemLink CItem -> LDTree ItemLink OItem
propagateOrientation = ldtStartPropagate g f --propagateOrientation = ldtStartPropagate g f
where -- where
g (x,y) = (x,y,(V3 0 0 0,Q.qID)) -- 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)) -- f (x,_,pq) _ (y,y1) = (y,y1,Q.comp pq $ orientAttachment x (y,y1))
propagateOrientation' :: DTree CItem -> DTree OItem propagateOrientation' :: DTree CItem -> DTree OItem
propagateOrientation' = dtStartPropagate g f propagateOrientation' = dtStartPropagate g f