{-# LANGUAGE DeriveAnyClass #-} {-# LANGUAGE DeriveGeneric #-} {-# LANGUAGE StrictData #-} {-# LANGUAGE TemplateHaskell #-} module Dodge.Data.ComposedItem where import Dodge.Data.AmmoType import Dodge.Data.DoubleTree import Control.Lens import Dodge.Data.Item import Geometry.Data import Linear.Quaternion (Quaternion (..)) data CLinkType = AmmoInLink Int AmmoType | TriggerLink | 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 | UnderBarrelSlotSF | UnderBarrelPlatformSF | EquipmentPlatformSF | GadgetPlatformSF | WeaponScopeSF | WeaponTargetingSF | IntroScanSF | TriggerSF | ARHUDSF | AmmoMagSF AmmoType | RemoteScreenSF | JoystickSF | RemoteDetonatorSF | SmokeReducerSF | NoSF | AmmoModifierSF AmmoType | AmmoTargetingSF AmmoType | AmmoPayloadSF AmmoType | AmmoEffectSF AmmoType | FunctionChangeSF | MakeAutoSF | ProjectileStabiliserSF | GrenadeHitEffectSF | ToggleSF | MapperSF deriving (Eq, Ord, Show, Read) type CItem = (Item, ItemStructuralFunction, LinkTest) data ItemLink = ILink { _iatType :: CLinkType , _iatOrient :: Item -> CLinkType -> Item -> (Point3, Quaternion Float) } -- this should possibly use a full item structure tree rather than a -- CItem as arguments data LinkTest = LTest { _tryLeftLink :: LabelDoubleTree ItemLink CItem -> Maybe LinkUpdate , _tryRightLink :: LabelDoubleTree ItemLink CItem -> Maybe LinkUpdate } data LinkUpdate = LUpdate { _luLinkType :: ItemLink , _luParentUpdate :: CItem -> CItem , _luChildUpdate :: CItem -> CItem } makeLenses ''ItemLink makeLenses ''LinkTest makeLenses ''LinkUpdate makeLenses ''CLinkType --deriveJSON defaultOptions ''ItemStructuralFunction --deriveJSON defaultOptions ''ComposeLinkType