Add Read instances

This commit is contained in:
2022-07-22 01:06:35 +01:00
parent d4e5b02874
commit 4c5218c633
44 changed files with 209 additions and 126 deletions
+1 -1
View File
@@ -19,7 +19,7 @@ data ActionPlan
,_apStrategy :: Strategy
,_apGoal :: [Goal]
}
data RandImpulse = RandImpulseList [Impulse]
newtype RandImpulse = RandImpulseList [Impulse]
data Impulse
= Move Point2
| MoveForward Float
+4
View File
@@ -7,7 +7,9 @@ import Dodge.Data.Gas
import Dodge.Data.Wall
import Control.Lens
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
| PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
@@ -16,6 +18,7 @@ data ProjectileUpdate
| PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int}
| PJSetScope {_pjuITID :: Int}
| PJRetireRemote {_pjuITID :: Int, _pjuTimer :: Int, _pjuPJID :: Int}
deriving (Show,Read,Eq,Ord)
data AmmoType
= ProjectileAmmo
@@ -38,5 +41,6 @@ data AmmoType
{ _amForceFieldType :: Wall
}
| GenericAmmo
deriving (Show,Read)
makeLenses ''ProjectileUpdate
makeLenses ''AmmoType
+2
View File
@@ -9,6 +9,8 @@ data ArcStep = ArcStep
, _asDir :: Float
, _asObject :: CrWlID --Maybe (Either Creature Wall)
}
deriving (Eq,Ord,Show,Read)
data NextArcStep = EndArc
| DefaultArcStep
deriving (Eq,Ord,Show,Read)
makeLenses ''ArcStep
+4
View File
@@ -22,18 +22,22 @@ data Beam = Beam
, _bmOrigin :: Maybe Int
, _bmType :: BeamType
}
deriving (Eq,Ord,Show,Read)
data BeamDraw = BasicBeamDraw
| BeamDrawColor Color
deriving (Eq,Ord,Show,Read)
data BeamCombineType = FlameBeamCombine
| LasBeamCombine
| TeslaBeamCombine
| SplitBeamCombine
| NoBeamCombine
deriving (Eq,Ord,Show,Read)
data BeamType
= BeamCombine
{ _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World
}
| BeamSimple
deriving (Eq,Ord,Show,Read)
makeLenses ''BeamType
makeLenses ''Beam
+6
View File
@@ -18,19 +18,25 @@ data Bullet = Bullet
, _buTimer :: Int
, _buDamages :: [Damage]
}
deriving (Show,Read,Eq,Ord)
data EnergyBallType = IncBall | TeslaBall | ConcBall
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data BulletState = NormalBulletState
| DelayedBullet Float
deriving (Show,Read,Eq,Ord)
data BulletUpdateMod = NoBulletUpdateMod
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data BulletEffect
= DestroyBullet
| BounceBullet
| PenetrateBullet
deriving (Eq,Ord,Show,Read,Enum,Bounded)
data BulletSpawn = BulBall EnergyBallType | BulSpark
deriving (Show,Read,Eq,Ord)
data BulletTrajectory
= BasicBulletTrajectory
| BezierTrajectory Point2 Point2 Point2
| FlechetteTrajectory Point2
| MagnetTrajectory Point2
deriving (Show,Read,Eq,Ord)
makeLenses ''Bullet
+1 -1
View File
@@ -2,4 +2,4 @@ module Dodge.Data.CamouflageStatus where
data CamouflageStatus
= FullyVisible
| Invisible
deriving (Eq,Ord,Enum)
deriving (Eq,Ord,Enum,Read,Show,Bounded)
+2 -1
View File
@@ -2,5 +2,6 @@
{-# LANGUAGE StrictData #-}
module Dodge.Data.CrWlID where
import Control.Lens
data CrWlID = CrID Int | WlID Int | NothingID
data CrWlID = CrID Int | WlID Int | NothingID -- TODO rewrite/remove this
deriving (Eq,Ord,Show,Read)
makeLenses ''CrWlID
+5
View File
@@ -21,6 +21,8 @@ import ShapePicture
import Geometry.Data
import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M
import Control.Lens
data Creature = Creature
{ _crPos :: Point2
, _crOldPos :: Point2
@@ -73,3 +75,6 @@ data Intention = Intention
, _mvToPoint :: Maybe Point2
, _viewPoint :: Maybe Point2
}
makeLenses ''Creature
makeLenses ''Intention
makeLenses ''Corpse
+2 -2
View File
@@ -20,14 +20,14 @@ data DamageEffect
| TorqueDamage { _deTorque :: Float }
| PushBackDamage {_dePushBack :: Float }
| NoDamageEffect
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
data Damage = Damage
{ _dmType :: DamageType
, _dmAmount :: Int , _dmFrom :: Point2 , _dmAt :: Point2 , _dmTo :: Point2
, _dmEffect :: DamageEffect
}
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of
ELECTRICAL -> True
+1
View File
@@ -2,3 +2,4 @@
--{-# LANGUAGE StrictData #-}
module Dodge.Data.Gas where
data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq,Ord,Show,Enum,Bounded,Read)
+2 -2
View File
@@ -6,11 +6,11 @@ data HammerType
= NoHammer
| HasHammer {_hammerPosition :: HammerPosition}
deriving
(Eq, Ord, Show)
(Eq, Ord, Show,Read)
data HammerPosition
= HammerDown
| HammerReleased
| HammerUp
deriving
(Eq, Ord, Show)
(Eq, Ord, Show,Read)
makeLenses ''HammerType
+4
View File
@@ -27,6 +27,7 @@ data ItEffect
, _ieDrop :: ItDropEffect --Item -> Creature -> World -> World
, _ieMID :: Maybe Int
}
deriving (Eq,Ord,Show,Read)
data ItInvEffect = NoInvEffect
| RewindEffect
@@ -35,6 +36,9 @@ data ItInvEffect = NoInvEffect
| CreateHeldLight
| CreateShieldWall
| RemoveShieldWall
deriving (Eq,Ord,Show,Read)
data ItFloorEffect = NoFloorEffect
deriving (Eq,Ord,Show,Read)
data ItDropEffect = NoDropEffect
deriving (Eq,Ord,Show,Read)
makeLenses ''ItEffect
+6 -8
View File
@@ -3,9 +3,13 @@
module Dodge.Data.Item
( module Dodge.Data.Item
, module Dodge.Data.Item.Misc
, module Dodge.Data.Item.Tweak
, module Dodge.Data.Item.Params
, module Dodge.Data.Item.Use
) where
import Control.Lens
import Dodge.Data.Item.Misc
import Dodge.Data.Item.Tweak
import Dodge.Data.Item.Consumption
import Dodge.Data.Item.Use
import Dodge.Data.Item.Params
@@ -36,19 +40,13 @@ data Item = Item
, _itValue :: ItemValue
, _itParams :: ItemParams
}
deriving (Show,Read)
data ItemTweaks
= NoTweaks
| Tweakable
{ _tweakParams :: IM.IntMap TweakParam
, _tweakSel :: Int
}
data TweakParam = TweakParam
{ _doTweak :: Int -> Item -> Item
, _curTweak :: Int
, _maxTweak :: Int
, _showTweak :: Int -> String
, _nameTweak :: String
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Item
makeLenses ''ItemTweaks
makeLenses ''TweakParam
+1
View File
@@ -28,4 +28,5 @@ data ItemConsumption
{ _icAmount :: IcAmount
}
| NoConsumption
deriving (Show,Read)
makeLenses ''ItemConsumption
+1
View File
@@ -2,3 +2,4 @@
module Dodge.Data.Item.HeldScroll where
data HeldScroll = HeldScrollDoNothing | HeldScrollZoom | HeldScrollCharMode
deriving (Eq,Ord,Enum,Bounded,Show,Read)
+5 -1
View File
@@ -18,9 +18,11 @@ data HeldUse = HeldDoNothing
| HeldSonicWave
| HeldForceField
| HeldShatter
deriving (Eq,Ord,Show,Read)
data Cuse = CDoNothing
| CHeal Int
deriving (Eq,Ord,Show,Read)
data Euse = EDoNothing
| EDetector Detector
@@ -32,13 +34,14 @@ data Euse = EDoNothing
| EonWristShield
| EoffWristShield
deriving (Eq,Ord,Show,Read)
data Luse = LDoNothing
| LRewind
| LShrink
| LBlink
| LUnsafeBlink
| LBoost
deriving (Eq,Ord,Show,Read)
data HeldMod = HeldModNothing
| PoisonSprayerMod
@@ -72,3 +75,4 @@ data HeldMod = HeldModNothing
| SmgMod
| RevolverXMod
| BangConeMod
deriving (Eq,Ord,Show,Read)
+5
View File
@@ -9,6 +9,7 @@ data ItemDimension = ItemDimension
, _dimCenter :: Point3
, _dimAttachPos :: Point3
}
deriving (Eq,Ord,Show,Read)
data ItemPortage
= HeldItem
{ _handlePos :: Float
@@ -16,16 +17,20 @@ data ItemPortage
}
| WornItem
| NoPortage
deriving (Eq,Ord,Show,Read)
data ItemValue = ItemValue
{ _ivInt :: Int
, _ivType :: ItemValueType
}
deriving (Eq,Ord,Show,Read)
data ItemValueType = MundaneItem | ArtefactItem
deriving (Eq,Ord,Show,Read)
data ItemPos
= InInv { _ipCrID :: Int , _ipInvID :: Int }
| OnFloor { _ipFlID :: Int }
| VoidItm
deriving (Eq,Ord,Show,Read)
makeLenses ''ItemDimension
makeLenses ''ItemPortage
makeLenses ''ItemValue
+5
View File
@@ -55,7 +55,9 @@ data ItemParams
, _previousArcEffect :: PreviousArcEffect
}
| ParamMID {_paramMID :: Maybe Int}
deriving (Eq,Ord,Show,Read)
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
deriving (Eq,Ord,Show,Read)
data GunBarrels
= MultiBarrel
{ _brlSpread :: BarrelSpread
@@ -67,6 +69,7 @@ data GunBarrels
, _brlInaccuracy :: Float
}
| SingleBarrel {_brlInaccuracy :: Float}
deriving (Eq,Ord,Show,Read)
data Nozzle = Nozzle
{ _nzPressure :: Float
, _nzDir :: Float
@@ -75,10 +78,12 @@ data Nozzle = Nozzle
, _nzWalkSpeed :: Float
, _nzLength :: Float
}
deriving (Eq,Ord,Show,Read)
data BarrelSpread
= AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
deriving (Eq,Ord,Show,Read)
makeLenses ''BarrelSpread
makeLenses ''ItemParams
+17
View File
@@ -0,0 +1,17 @@
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Item.Tweak where
import Control.Lens
data TweakType = TweakPhaseV
| TweakTractionPower
| TweakSpinDrag
| TweakSpinAmount
| TweakThrustDelay
deriving (Eq,Ord,Show,Read)
data TweakParam = TweakParam
{ _tweakType :: TweakType -- Int -> Item -> Item
, _tweakVal :: Int
, _tweakMax :: Int
}
deriving (Eq,Ord,Show,Read)
makeLenses ''TweakParam
+6 -1
View File
@@ -30,6 +30,7 @@ data ItemUse
{ _eqEq :: Equipment
}
| NoUse
deriving (Eq,Ord,Show,Read)
data Equipment = Equipment
{ _eqUse :: Euse --Item -> Creature -> World -> World
, _eqOnEquip :: Euse --Item -> Creature -> World -> World
@@ -38,6 +39,7 @@ data Equipment = Equipment
, _eqParams :: EquipParams
, _eqViewDist :: Maybe Float
}
deriving (Eq,Ord,Show,Read)
data AimParams = AimParams
{ _aimWeight :: Int
, _aimRange :: Float
@@ -46,23 +48,26 @@ data AimParams = AimParams
, _aimHandlePos :: Float
, _aimMuzPos :: Float
}
deriving (Eq,Ord,Show,Read)
data AimStance
= TwoHandTwist
| TwoHandFlat
| OneHand
| LeaveHolstered
deriving
(Eq,Show,Ord,Enum)
(Eq,Show,Ord,Enum,Read)
data EquipParams
= NoEquipParams
| EquipID {_eparamID :: Int}
| EquipCounter {_eparamInt :: Int}
deriving (Eq,Ord,Show,Read)
data ItZoom = ItZoom
{ _itZoomMax :: Float
, _itZoomMin :: Float
, _itZoomFac :: Float
}
deriving (Eq,Ord,Show,Read)
makeLenses ''ItemUse
makeLenses ''AimParams
makeLenses ''EquipParams
+1
View File
@@ -18,4 +18,5 @@ data UseDelay -- should just be Delay
{_warmTime :: Int
,_warmMax :: Int
}
deriving (Eq,Ord,Show,Read)
makeLenses ''UseDelay
+1 -1
View File
@@ -2,6 +2,6 @@
module Dodge.Data.ItemAmount where
newtype IcAmount = IcAmount {_toInt :: Int}
deriving (Eq,Ord,Num,Integral,Real,Enum)
deriving (Eq,Ord,Num,Integral,Real,Enum,Read)
instance Show IcAmount where
show (IcAmount i) = 'x':show i
+2 -2
View File
@@ -9,12 +9,12 @@ data LoadAction
| LoadInsert {_actionTime :: Int, _actionSound :: SoundID}
| LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int }
| LoadPrime {_actionTime :: Int, _actionSound :: SoundID}
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction }
data InvSelAction
= NoInvSelAction
| ReloadAction { _actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
deriving (Eq,Ord,Show)
deriving (Eq,Ord,Show,Read)
makeLenses ''LoadAction
makeLenses ''InvSel
makeLenses ''InvSelAction
+1 -1
View File
@@ -4,4 +4,4 @@
--{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Material where
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics
deriving (Eq,Ord,Show,Bounded,Enum)
deriving (Eq,Ord,Show,Bounded,Enum,Read)
+1
View File
@@ -2,3 +2,4 @@
{-# LANGUAGE StrictData #-}
module Dodge.Data.Payload where
data Payload = ExplosionPayload | DudPayload
deriving (Show,Read,Eq,Ord,Enum,Bounded)
+3
View File
@@ -12,13 +12,16 @@ data Targeting
, _tgID :: Maybe Int
, _tgActive :: Bool
}
deriving (Eq,Ord,Show,Read)
data TargetUpdate = NoTargetUpdate
| TargetLaserUpdate
| TargetRBPressUpdate
| TargetRBCreatureUpdate
| TargetCursorUpdate
deriving (Eq,Ord,Show,Read)
data TargetDraw = NoTargetDraw
| TargetDistanceDraw
| SimpleDrawTarget
| TargetRBCreatureDraw
deriving (Eq,Ord,Show,Read)
makeLenses ''Targeting
+6 -3
View File
@@ -6,7 +6,6 @@ module Dodge.Data.Wall where
import Dodge.Data.Material
import Geometry
import Color
import ShapePicture
import Control.Lens
data Wall = Wall
{ _wlLine :: (Point2,Point2)
@@ -25,14 +24,17 @@ data Wall = Wall
, _wlRotateTo :: Bool
, _wlStructure :: WallStructure
, _wlHeight :: Float
-- , _wlDamageEff :: Damage -> Wall -> World -> World
, _wlMaterial :: Material
}
deriving (Eq,Ord,Show,Read)
data Opacity
= SeeThrough
| SeeAbove
| DrawnWall {_opDraw :: Wall -> SPic}
| DrawnWall {_opDraw :: WallDraw } -- Wall -> SPic
| Opaque
deriving (Eq,Ord,Show,Read)
data WallDraw = DrawForceField
deriving (Eq,Ord,Show,Read,Enum,Bounded)
data WallStructure
= StandaloneWall
| DoorPart { _wsDoor :: Int }
@@ -42,6 +44,7 @@ data WallStructure
{ _wlStCreature :: Int
-- , _wlStDamCreature :: Damage -> Wall -> Int -> World -> World
}
deriving (Eq,Ord,Show,Read)
makeLenses ''Wall
makeLenses ''WallStructure
makeLenses ''Opacity