Refactor, try to limit dependencies

This commit is contained in:
2022-07-28 00:59:56 +01:00
parent 8aa5c17ab9
commit 160560af5f
418 changed files with 15104 additions and 13342 deletions
+5 -2
View File
@@ -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
+26 -27
View File
@@ -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