Refactor, try to limit dependencies
This commit is contained in:
@@ -70,7 +70,8 @@ data CraftType
|
||||
deriving (Eq, Ord, Show, Enum, Read)
|
||||
|
||||
data ItemBaseType
|
||||
= HELD {_ibtHeld :: HeldItemType}
|
||||
= NoItemType
|
||||
| HELD {_ibtHeld :: HeldItemType}
|
||||
| LEFT {_ibtLeft :: LeftItemType}
|
||||
| EQUIP {_ibtEquip :: EquipItemType}
|
||||
| Consumable {_ibtConsumable :: ConsumableItemType}
|
||||
|
||||
@@ -1,15 +1,15 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
module Dodge.Data.Item.CurseStatus
|
||||
where
|
||||
import GHC.Generics
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.CurseStatus where
|
||||
|
||||
import Data.Aeson
|
||||
data CurseStatus
|
||||
= Uncursed
|
||||
| UndroppableIdentified
|
||||
import Data.Aeson.TH
|
||||
|
||||
data CurseStatus
|
||||
= Uncursed
|
||||
| UndroppableIdentified
|
||||
| UndroppableUnidentified
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON CurseStatus where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON CurseStatus
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
deriveJSON defaultOptions ''CurseStatus
|
||||
|
||||
@@ -0,0 +1,29 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.HeldDelay where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
|
||||
data UseDelay -- should just be Delay
|
||||
= NoDelay
|
||||
| FixedRate
|
||||
{ _rateMax :: Int
|
||||
, _rateTime :: Int
|
||||
}
|
||||
| VariableRate
|
||||
{ _rateMax :: Int
|
||||
, _rateTime :: Int
|
||||
, _rateMaxMax :: Int
|
||||
, _rateMinMax :: Int
|
||||
}
|
||||
| WarmUpNoDelay
|
||||
{ _warmTime :: Int
|
||||
, _warmMax :: Int
|
||||
}
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
makeLenses ''UseDelay
|
||||
deriveJSON defaultOptions ''UseDelay
|
||||
+14
-13
@@ -6,8 +6,9 @@ module Dodge.Data.Item.Use (
|
||||
module Dodge.Data.Item.Use.Equipment,
|
||||
module Dodge.Data.Item.HeldUse,
|
||||
module Dodge.Data.Item.HeldScroll,
|
||||
module Dodge.Data.Item.UseDelay,
|
||||
module Dodge.Data.Item.HeldDelay,
|
||||
module Dodge.Data.Item.Use.Consumption,
|
||||
module Dodge.Data.Hammer,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
@@ -18,23 +19,23 @@ import Dodge.Data.Item.HeldScroll
|
||||
import Dodge.Data.Item.HeldUse
|
||||
import Dodge.Data.Item.Use.Consumption
|
||||
import Dodge.Data.Item.Use.Equipment
|
||||
import Dodge.Data.Item.UseDelay
|
||||
import Dodge.Data.Item.HeldDelay
|
||||
|
||||
data ItemUse
|
||||
= RightUse
|
||||
{ _rUse :: HeldUse
|
||||
, _useDelay :: UseDelay
|
||||
, _useMods :: HeldMod
|
||||
, _useHammer :: HammerPosition
|
||||
, _useAim :: AimParams
|
||||
= HeldUse
|
||||
{ _heldUse :: HeldUse
|
||||
, _heldDelay :: UseDelay
|
||||
, _heldMods :: HeldMod
|
||||
, _heldHammer :: HammerPosition
|
||||
, _heldAim :: AimParams
|
||||
, _heldScroll :: HeldScroll
|
||||
, _heldConsumption :: HeldConsumption
|
||||
}
|
||||
| LeftUse
|
||||
{ _lUse :: Luse
|
||||
, _useDelay :: UseDelay
|
||||
, _useHammer :: HammerPosition
|
||||
, _eqEq :: Equipment
|
||||
{ _leftUse :: Luse
|
||||
, _leftDelay :: UseDelay
|
||||
, _leftHammer :: HammerPosition
|
||||
, _equipEffect :: EquipEffect
|
||||
, _leftConsumption :: LeftConsumption
|
||||
}
|
||||
| ConsumeUse
|
||||
@@ -42,7 +43,7 @@ data ItemUse
|
||||
, _useAmount :: ItAmount
|
||||
}
|
||||
| EquipUse
|
||||
{ _eqEq :: Equipment
|
||||
{ _equipEffect :: EquipEffect
|
||||
}
|
||||
| CraftUse
|
||||
{_useAmount :: ItAmount}
|
||||
|
||||
@@ -12,7 +12,6 @@ import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Bullet
|
||||
import Dodge.Data.Payload
|
||||
import Dodge.Data.Wall
|
||||
|
||||
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
|
||||
deriving (Show, Read, Eq, Ord, Enum, Bounded)
|
||||
@@ -48,11 +47,14 @@ data AmmoType
|
||||
, _amCreateGas :: GasCreate
|
||||
}
|
||||
| ForceFieldAmmo
|
||||
{ _amForceFieldType :: Wall
|
||||
{ _amForceFieldType :: ForceFieldType
|
||||
}
|
||||
| GenericAmmo
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data ForceFieldType = DefaultForceField
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data GasCreate = CreatePoisonGas | CreateFlame
|
||||
deriving (Eq, Ord, Show, Enum, Bounded, Read)
|
||||
|
||||
@@ -63,3 +65,4 @@ deriveJSON defaultOptions ''ProjectileCreate
|
||||
deriveJSON defaultOptions ''ProjectileUpdate
|
||||
deriveJSON defaultOptions ''AmmoType
|
||||
deriveJSON defaultOptions ''GasCreate
|
||||
deriveJSON defaultOptions ''ForceFieldType
|
||||
|
||||
@@ -1,35 +1,34 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Dodge.Data.Item.Use.Equipment
|
||||
( module Dodge.Data.Equipment.Misc
|
||||
, module Dodge.Data.Item.Use.Equipment
|
||||
)
|
||||
where
|
||||
import Dodge.Data.Item.HeldUse
|
||||
import Dodge.Data.Equipment.Misc
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Use.Equipment (
|
||||
module Dodge.Data.Equipment.Misc,
|
||||
module Dodge.Data.Item.Use.Equipment,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
data Equipment = Equipment
|
||||
{ _eqUse :: Euse --Item -> Creature -> World -> World
|
||||
, _eqOnEquip :: Euse --Item -> Creature -> World -> World
|
||||
, _eqOnRemove :: Euse --Item -> Creature -> World -> World
|
||||
, _eqSite :: EquipSite
|
||||
, _eqParams :: EquipParams
|
||||
, _eqViewDist :: Maybe Float
|
||||
import Data.Aeson
|
||||
import Data.Aeson.TH
|
||||
import Dodge.Data.Equipment.Misc
|
||||
import Dodge.Data.Item.HeldUse
|
||||
|
||||
data EquipEffect = EquipEffect
|
||||
{ _eeUse :: Euse --Item -> Creature -> World -> World
|
||||
, _eeOnEquip :: Euse --Item -> Creature -> World -> World
|
||||
, _eeOnRemove :: Euse --Item -> Creature -> World -> World
|
||||
, _eeSite :: EquipSite
|
||||
, _eeParams :: EquipParams
|
||||
, _eeViewDist :: Maybe Float
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Equipment where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Equipment
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
data EquipParams
|
||||
= NoEquipParams
|
||||
| EquipID {_eparamID :: Int}
|
||||
| EquipCounter {_eparamInt :: Int}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON EquipParams where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON EquipParams
|
||||
makeLenses ''Equipment
|
||||
deriving (Eq, Ord, Show, Read)
|
||||
|
||||
makeLenses ''EquipEffect
|
||||
makeLenses ''EquipParams
|
||||
deriveJSON defaultOptions ''EquipEffect
|
||||
deriveJSON defaultOptions ''EquipParams
|
||||
|
||||
@@ -1,28 +0,0 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Dodge.Data.Item.UseDelay where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Control.Lens
|
||||
data UseDelay -- should just be Delay
|
||||
= NoDelay
|
||||
| FixedRate
|
||||
{_rateMax :: Int
|
||||
,_rateTime :: Int
|
||||
}
|
||||
| VariableRate
|
||||
{_rateMax :: Int
|
||||
,_rateTime :: Int
|
||||
,_rateMaxMax :: Int
|
||||
,_rateMinMax :: Int
|
||||
}
|
||||
| WarmUpNoDelay
|
||||
{_warmTime :: Int
|
||||
,_warmMax :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON UseDelay where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON UseDelay
|
||||
makeLenses ''UseDelay
|
||||
Reference in New Issue
Block a user