74 lines
1.9 KiB
Haskell
74 lines
1.9 KiB
Haskell
{-# LANGUAGE DeriveAnyClass #-}
|
|
{-# LANGUAGE DeriveGeneric #-}
|
|
{-# LANGUAGE StrictData #-}
|
|
{-# LANGUAGE TemplateHaskell #-}
|
|
|
|
module Dodge.Data.ComposedItem where
|
|
|
|
import Control.Lens
|
|
import Data.Aeson
|
|
import Data.Aeson.TH
|
|
-- it would be nice not to have to import the following...
|
|
import Dodge.Data.Item
|
|
import Geometry.Data
|
|
import Linear.Quaternion (Quaternion (..))
|
|
|
|
data ComposeLinkType
|
|
= AmmoInLink Int AmmoType
|
|
| AmmoModLink
|
|
| AmmoTargetingLink
|
|
| AmmoPayloadLink
|
|
| AmmoEffectLink
|
|
| WeaponScopeLink
|
|
| WeaponTargetingLink
|
|
| RemoteScreenLink
|
|
| AugmentedHUDLink
|
|
| FunctionChangeLink
|
|
deriving (Eq, Ord, Show, Read)
|
|
|
|
data ItemStructuralFunction
|
|
= WeaponPlatformSF
|
|
| WeaponScopeSF
|
|
| WeaponTargetingSF
|
|
| AugmentedHUDSF
|
|
| AmmoMagSF AmmoType
|
|
| RemoteScreenSF
|
|
| UncomposableIsolateSF
|
|
| AmmoModifierSF AmmoType
|
|
| AmmoTargetingSF AmmoType
|
|
| AmmoPayloadSF AmmoType
|
|
| AmmoEffectSF AmmoType
|
|
| FunctionChangeSF
|
|
deriving (Eq, Ord, Show, Read)
|
|
|
|
type PartiallyComposedItem = (Item, ItemStructuralFunction, LinkTest)
|
|
|
|
data ComposedItem = CItem
|
|
{ _cItem :: Item
|
|
, _cItemFunction :: ItemStructuralFunction
|
|
}
|
|
|
|
data ItemLink = ILink
|
|
{ _iatType :: ComposeLinkType
|
|
, _iatOrient :: Item -> ComposeLinkType -> Item -> (Point3, Quaternion Float)
|
|
}
|
|
|
|
data LinkTest = LTest
|
|
{ _tryLeftLink :: PartiallyComposedItem -> Maybe LinkUpdate
|
|
, _tryRightLink :: PartiallyComposedItem -> Maybe LinkUpdate
|
|
}
|
|
|
|
data LinkUpdate = LUpdate
|
|
{ _luLinkType :: ItemLink
|
|
, _luParentUpdate :: PartiallyComposedItem -> PartiallyComposedItem
|
|
, _luChildUpdate :: PartiallyComposedItem -> PartiallyComposedItem
|
|
}
|
|
|
|
makeLenses ''ComposedItem
|
|
makeLenses ''ItemLink
|
|
makeLenses ''LinkTest
|
|
makeLenses ''LinkUpdate
|
|
deriveJSON defaultOptions ''ItemStructuralFunction
|
|
deriveJSON defaultOptions ''ComposedItem
|
|
deriveJSON defaultOptions ''ComposeLinkType
|