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
+4 -5
View File
@@ -12,10 +12,10 @@ data ItemType = ItemType
,_iyModules :: M.Map ModuleSlot ItemModuleType ,_iyModules :: M.Map ModuleSlot ItemModuleType
,_iyStack :: Stack ,_iyStack :: Stack
} }
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
data Stack = NoStack | Stack IcAmount data Stack = NoStack | Stack IcAmount
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
data CraftType data CraftType
= PIPE = PIPE
@@ -200,8 +200,7 @@ data ItemModuleType
| LAUNCHHOME | LAUNCHHOME
| EXTRABATTERY | EXTRABATTERY
| ATTACHTORCH | ATTACHTORCH
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
data Detector data Detector
= ITEMDETECTOR = ITEMDETECTOR
| CREATUREDETECTOR | CREATUREDETECTOR
@@ -220,7 +219,7 @@ data ModuleSlot
| ModTeleport | ModTeleport
| ModDualBeam | ModDualBeam
| ModHeldAttach | ModHeldAttach
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
makeLenses ''ItemType makeLenses ''ItemType
makeLenses ''ItemBaseType makeLenses ''ItemBaseType
-3
View File
@@ -723,7 +723,6 @@ data InPlacement = InPlacement
, _ipPlacementID :: Int , _ipPlacementID :: Int
} }
makeLenses ''World makeLenses ''World
makeLenses ''Creature
makeLenses ''FloorItem makeLenses ''FloorItem
makeLenses ''Prop makeLenses ''Prop
makeLenses ''Proj makeLenses ''Proj
@@ -731,7 +730,6 @@ makeLenses ''Modification
makeLenses ''Particle makeLenses ''Particle
makeLenses ''PressPlate makeLenses ''PressPlate
makeLenses ''CrGroupParams makeLenses ''CrGroupParams
makeLenses ''Intention
makeLenses ''Door makeLenses ''Door
makeLenses ''Terminal makeLenses ''Terminal
makeLenses ''Machine makeLenses ''Machine
@@ -747,7 +745,6 @@ makeLenses ''WorldBeams
makeLenses ''TerminalCommand makeLenses ''TerminalCommand
makeLenses ''TerminalInput makeLenses ''TerminalInput
makeLenses ''GenParams makeLenses ''GenParams
makeLenses ''Corpse
----- ROOM LENSES ----- ROOM LENSES
makeLenses ''Room makeLenses ''Room
+1 -1
View File
@@ -19,7 +19,7 @@ data ActionPlan
,_apStrategy :: Strategy ,_apStrategy :: Strategy
,_apGoal :: [Goal] ,_apGoal :: [Goal]
} }
data RandImpulse = RandImpulseList [Impulse] newtype RandImpulse = RandImpulseList [Impulse]
data Impulse data Impulse
= Move Point2 = Move Point2
| MoveForward Float | MoveForward Float
+4
View File
@@ -7,7 +7,9 @@ import Dodge.Data.Gas
import Dodge.Data.Wall import Dodge.Data.Wall
import Control.Lens import Control.Lens
data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile data ProjectileDraw = DrawShell | DrawRemoteShell | DrawDrone | DrawBlankProjectile
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data ProjectileCreate = CreateShell | CreateTrackingShell data ProjectileCreate = CreateShell | CreateTrackingShell
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data ProjectileUpdate data ProjectileUpdate
= PJThrust {_pjuStart :: Int, _pjuEnd :: Int} = PJThrust {_pjuStart :: Int, _pjuEnd :: Int}
| PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int} | PJSpin {_pjuTime :: Int, _pjuCID :: Int, _pjuSpinAmound :: Int}
@@ -16,6 +18,7 @@ data ProjectileUpdate
| PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int} | PJRemoteDirection {_pjuStart :: Int, _pjuEnd :: Int, _pjuCID :: Int, _pjuITID :: Int}
| PJSetScope {_pjuITID :: Int} | PJSetScope {_pjuITID :: Int}
| PJRetireRemote {_pjuITID :: Int, _pjuTimer :: Int, _pjuPJID :: Int} | PJRetireRemote {_pjuITID :: Int, _pjuTimer :: Int, _pjuPJID :: Int}
deriving (Show,Read,Eq,Ord)
data AmmoType data AmmoType
= ProjectileAmmo = ProjectileAmmo
@@ -38,5 +41,6 @@ data AmmoType
{ _amForceFieldType :: Wall { _amForceFieldType :: Wall
} }
| GenericAmmo | GenericAmmo
deriving (Show,Read)
makeLenses ''ProjectileUpdate makeLenses ''ProjectileUpdate
makeLenses ''AmmoType makeLenses ''AmmoType
+2
View File
@@ -9,6 +9,8 @@ data ArcStep = ArcStep
, _asDir :: Float , _asDir :: Float
, _asObject :: CrWlID --Maybe (Either Creature Wall) , _asObject :: CrWlID --Maybe (Either Creature Wall)
} }
deriving (Eq,Ord,Show,Read)
data NextArcStep = EndArc data NextArcStep = EndArc
| DefaultArcStep | DefaultArcStep
deriving (Eq,Ord,Show,Read)
makeLenses ''ArcStep makeLenses ''ArcStep
+4
View File
@@ -22,18 +22,22 @@ data Beam = Beam
, _bmOrigin :: Maybe Int , _bmOrigin :: Maybe Int
, _bmType :: BeamType , _bmType :: BeamType
} }
deriving (Eq,Ord,Show,Read)
data BeamDraw = BasicBeamDraw data BeamDraw = BasicBeamDraw
| BeamDrawColor Color | BeamDrawColor Color
deriving (Eq,Ord,Show,Read)
data BeamCombineType = FlameBeamCombine data BeamCombineType = FlameBeamCombine
| LasBeamCombine | LasBeamCombine
| TeslaBeamCombine | TeslaBeamCombine
| SplitBeamCombine | SplitBeamCombine
| NoBeamCombine | NoBeamCombine
deriving (Eq,Ord,Show,Read)
data BeamType data BeamType
= BeamCombine = BeamCombine
{ _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World { _beamCombine :: BeamCombineType -- (Point2 , (Point2,Point2,Beam) , (Point2,Point2,Beam)) -> World -> World
} }
| BeamSimple | BeamSimple
deriving (Eq,Ord,Show,Read)
makeLenses ''BeamType makeLenses ''BeamType
makeLenses ''Beam makeLenses ''Beam
+6
View File
@@ -18,19 +18,25 @@ data Bullet = Bullet
, _buTimer :: Int , _buTimer :: Int
, _buDamages :: [Damage] , _buDamages :: [Damage]
} }
deriving (Show,Read,Eq,Ord)
data EnergyBallType = IncBall | TeslaBall | ConcBall data EnergyBallType = IncBall | TeslaBall | ConcBall
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data BulletState = NormalBulletState data BulletState = NormalBulletState
| DelayedBullet Float | DelayedBullet Float
deriving (Show,Read,Eq,Ord)
data BulletUpdateMod = NoBulletUpdateMod data BulletUpdateMod = NoBulletUpdateMod
deriving (Show,Read,Eq,Ord,Enum,Bounded)
data BulletEffect data BulletEffect
= DestroyBullet = DestroyBullet
| BounceBullet | BounceBullet
| PenetrateBullet | PenetrateBullet
deriving (Eq,Ord,Show,Read,Enum,Bounded) deriving (Eq,Ord,Show,Read,Enum,Bounded)
data BulletSpawn = BulBall EnergyBallType | BulSpark data BulletSpawn = BulBall EnergyBallType | BulSpark
deriving (Show,Read,Eq,Ord)
data BulletTrajectory data BulletTrajectory
= BasicBulletTrajectory = BasicBulletTrajectory
| BezierTrajectory Point2 Point2 Point2 | BezierTrajectory Point2 Point2 Point2
| FlechetteTrajectory Point2 | FlechetteTrajectory Point2
| MagnetTrajectory Point2 | MagnetTrajectory Point2
deriving (Show,Read,Eq,Ord)
makeLenses ''Bullet makeLenses ''Bullet
+1 -1
View File
@@ -2,4 +2,4 @@ module Dodge.Data.CamouflageStatus where
data CamouflageStatus data CamouflageStatus
= FullyVisible = FullyVisible
| Invisible | Invisible
deriving (Eq,Ord,Enum) deriving (Eq,Ord,Enum,Read,Show,Bounded)
+2 -1
View File
@@ -2,5 +2,6 @@
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
module Dodge.Data.CrWlID where module Dodge.Data.CrWlID where
import Control.Lens 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 makeLenses ''CrWlID
+5
View File
@@ -21,6 +21,8 @@ import ShapePicture
import Geometry.Data import Geometry.Data
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import Control.Lens
data Creature = Creature data Creature = Creature
{ _crPos :: Point2 { _crPos :: Point2
, _crOldPos :: Point2 , _crOldPos :: Point2
@@ -73,3 +75,6 @@ data Intention = Intention
, _mvToPoint :: Maybe Point2 , _mvToPoint :: Maybe Point2
, _viewPoint :: Maybe Point2 , _viewPoint :: Maybe Point2
} }
makeLenses ''Creature
makeLenses ''Intention
makeLenses ''Corpse
+2 -2
View File
@@ -20,14 +20,14 @@ data DamageEffect
| TorqueDamage { _deTorque :: Float } | TorqueDamage { _deTorque :: Float }
| PushBackDamage {_dePushBack :: Float } | PushBackDamage {_dePushBack :: Float }
| NoDamageEffect | NoDamageEffect
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
data Damage = Damage data Damage = Damage
{ _dmType :: DamageType { _dmType :: DamageType
, _dmAmount :: Int , _dmFrom :: Point2 , _dmAt :: Point2 , _dmTo :: Point2 , _dmAmount :: Int , _dmFrom :: Point2 , _dmAt :: Point2 , _dmTo :: Point2
, _dmEffect :: DamageEffect , _dmEffect :: DamageEffect
} }
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
isElectrical :: Damage -> Bool isElectrical :: Damage -> Bool
isElectrical dm = case _dmType dm of isElectrical dm = case _dmType dm of
ELECTRICAL -> True ELECTRICAL -> True
+1
View File
@@ -2,3 +2,4 @@
--{-# LANGUAGE StrictData #-} --{-# LANGUAGE StrictData #-}
module Dodge.Data.Gas where module Dodge.Data.Gas where
data GasCreate = CreatePoisonGas | CreateFlame data GasCreate = CreatePoisonGas | CreateFlame
deriving (Eq,Ord,Show,Enum,Bounded,Read)
+2 -2
View File
@@ -6,11 +6,11 @@ data HammerType
= NoHammer = NoHammer
| HasHammer {_hammerPosition :: HammerPosition} | HasHammer {_hammerPosition :: HammerPosition}
deriving deriving
(Eq, Ord, Show) (Eq, Ord, Show,Read)
data HammerPosition data HammerPosition
= HammerDown = HammerDown
| HammerReleased | HammerReleased
| HammerUp | HammerUp
deriving deriving
(Eq, Ord, Show) (Eq, Ord, Show,Read)
makeLenses ''HammerType makeLenses ''HammerType
+4
View File
@@ -27,6 +27,7 @@ data ItEffect
, _ieDrop :: ItDropEffect --Item -> Creature -> World -> World , _ieDrop :: ItDropEffect --Item -> Creature -> World -> World
, _ieMID :: Maybe Int , _ieMID :: Maybe Int
} }
deriving (Eq,Ord,Show,Read)
data ItInvEffect = NoInvEffect data ItInvEffect = NoInvEffect
| RewindEffect | RewindEffect
@@ -35,6 +36,9 @@ data ItInvEffect = NoInvEffect
| CreateHeldLight | CreateHeldLight
| CreateShieldWall | CreateShieldWall
| RemoveShieldWall | RemoveShieldWall
deriving (Eq,Ord,Show,Read)
data ItFloorEffect = NoFloorEffect data ItFloorEffect = NoFloorEffect
deriving (Eq,Ord,Show,Read)
data ItDropEffect = NoDropEffect data ItDropEffect = NoDropEffect
deriving (Eq,Ord,Show,Read)
makeLenses ''ItEffect makeLenses ''ItEffect
+6 -8
View File
@@ -3,9 +3,13 @@
module Dodge.Data.Item module Dodge.Data.Item
( module Dodge.Data.Item ( module Dodge.Data.Item
, module Dodge.Data.Item.Misc , module Dodge.Data.Item.Misc
, module Dodge.Data.Item.Tweak
, module Dodge.Data.Item.Params
, module Dodge.Data.Item.Use
) where ) where
import Control.Lens import Control.Lens
import Dodge.Data.Item.Misc import Dodge.Data.Item.Misc
import Dodge.Data.Item.Tweak
import Dodge.Data.Item.Consumption import Dodge.Data.Item.Consumption
import Dodge.Data.Item.Use import Dodge.Data.Item.Use
import Dodge.Data.Item.Params import Dodge.Data.Item.Params
@@ -36,19 +40,13 @@ data Item = Item
, _itValue :: ItemValue , _itValue :: ItemValue
, _itParams :: ItemParams , _itParams :: ItemParams
} }
deriving (Show,Read)
data ItemTweaks data ItemTweaks
= NoTweaks = NoTweaks
| Tweakable | Tweakable
{ _tweakParams :: IM.IntMap TweakParam { _tweakParams :: IM.IntMap TweakParam
, _tweakSel :: Int , _tweakSel :: Int
} }
data TweakParam = TweakParam deriving (Eq,Ord,Show,Read)
{ _doTweak :: Int -> Item -> Item
, _curTweak :: Int
, _maxTweak :: Int
, _showTweak :: Int -> String
, _nameTweak :: String
}
makeLenses ''Item makeLenses ''Item
makeLenses ''ItemTweaks makeLenses ''ItemTweaks
makeLenses ''TweakParam
+1
View File
@@ -28,4 +28,5 @@ data ItemConsumption
{ _icAmount :: IcAmount { _icAmount :: IcAmount
} }
| NoConsumption | NoConsumption
deriving (Show,Read)
makeLenses ''ItemConsumption makeLenses ''ItemConsumption
+1
View File
@@ -2,3 +2,4 @@
module Dodge.Data.Item.HeldScroll where module Dodge.Data.Item.HeldScroll where
data HeldScroll = HeldScrollDoNothing | HeldScrollZoom | HeldScrollCharMode data HeldScroll = HeldScrollDoNothing | HeldScrollZoom | HeldScrollCharMode
deriving (Eq,Ord,Enum,Bounded,Show,Read)
+5 -1
View File
@@ -18,9 +18,11 @@ data HeldUse = HeldDoNothing
| HeldSonicWave | HeldSonicWave
| HeldForceField | HeldForceField
| HeldShatter | HeldShatter
deriving (Eq,Ord,Show,Read)
data Cuse = CDoNothing data Cuse = CDoNothing
| CHeal Int | CHeal Int
deriving (Eq,Ord,Show,Read)
data Euse = EDoNothing data Euse = EDoNothing
| EDetector Detector | EDetector Detector
@@ -32,13 +34,14 @@ data Euse = EDoNothing
| EonWristShield | EonWristShield
| EoffWristShield | EoffWristShield
deriving (Eq,Ord,Show,Read)
data Luse = LDoNothing data Luse = LDoNothing
| LRewind | LRewind
| LShrink | LShrink
| LBlink | LBlink
| LUnsafeBlink | LUnsafeBlink
| LBoost | LBoost
deriving (Eq,Ord,Show,Read)
data HeldMod = HeldModNothing data HeldMod = HeldModNothing
| PoisonSprayerMod | PoisonSprayerMod
@@ -72,3 +75,4 @@ data HeldMod = HeldModNothing
| SmgMod | SmgMod
| RevolverXMod | RevolverXMod
| BangConeMod | BangConeMod
deriving (Eq,Ord,Show,Read)
+5
View File
@@ -9,6 +9,7 @@ data ItemDimension = ItemDimension
, _dimCenter :: Point3 , _dimCenter :: Point3
, _dimAttachPos :: Point3 , _dimAttachPos :: Point3
} }
deriving (Eq,Ord,Show,Read)
data ItemPortage data ItemPortage
= HeldItem = HeldItem
{ _handlePos :: Float { _handlePos :: Float
@@ -16,16 +17,20 @@ data ItemPortage
} }
| WornItem | WornItem
| NoPortage | NoPortage
deriving (Eq,Ord,Show,Read)
data ItemValue = ItemValue data ItemValue = ItemValue
{ _ivInt :: Int { _ivInt :: Int
, _ivType :: ItemValueType , _ivType :: ItemValueType
} }
deriving (Eq,Ord,Show,Read)
data ItemValueType = MundaneItem | ArtefactItem data ItemValueType = MundaneItem | ArtefactItem
deriving (Eq,Ord,Show,Read)
data ItemPos data ItemPos
= InInv { _ipCrID :: Int , _ipInvID :: Int } = InInv { _ipCrID :: Int , _ipInvID :: Int }
| OnFloor { _ipFlID :: Int } | OnFloor { _ipFlID :: Int }
| VoidItm | VoidItm
deriving (Eq,Ord,Show,Read)
makeLenses ''ItemDimension makeLenses ''ItemDimension
makeLenses ''ItemPortage makeLenses ''ItemPortage
makeLenses ''ItemValue makeLenses ''ItemValue
+5
View File
@@ -55,7 +55,9 @@ data ItemParams
, _previousArcEffect :: PreviousArcEffect , _previousArcEffect :: PreviousArcEffect
} }
| ParamMID {_paramMID :: Maybe Int} | ParamMID {_paramMID :: Maybe Int}
deriving (Eq,Ord,Show,Read)
data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc data PreviousArcEffect = NoPreviousArcEffect | PerturbTillBreakPreviousArc
deriving (Eq,Ord,Show,Read)
data GunBarrels data GunBarrels
= MultiBarrel = MultiBarrel
{ _brlSpread :: BarrelSpread { _brlSpread :: BarrelSpread
@@ -67,6 +69,7 @@ data GunBarrels
, _brlInaccuracy :: Float , _brlInaccuracy :: Float
} }
| SingleBarrel {_brlInaccuracy :: Float} | SingleBarrel {_brlInaccuracy :: Float}
deriving (Eq,Ord,Show,Read)
data Nozzle = Nozzle data Nozzle = Nozzle
{ _nzPressure :: Float { _nzPressure :: Float
, _nzDir :: Float , _nzDir :: Float
@@ -75,10 +78,12 @@ data Nozzle = Nozzle
, _nzWalkSpeed :: Float , _nzWalkSpeed :: Float
, _nzLength :: Float , _nzLength :: Float
} }
deriving (Eq,Ord,Show,Read)
data BarrelSpread data BarrelSpread
= AlignedBarrels = AlignedBarrels
| SpreadBarrels {_spreadAngle :: Float} | SpreadBarrels {_spreadAngle :: Float}
| RotatingBarrels {_rotatingBarrelInaccuracy :: Float} | RotatingBarrels {_rotatingBarrelInaccuracy :: Float}
deriving (Eq,Ord,Show,Read)
makeLenses ''BarrelSpread makeLenses ''BarrelSpread
makeLenses ''ItemParams 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 { _eqEq :: Equipment
} }
| NoUse | NoUse
deriving (Eq,Ord,Show,Read)
data Equipment = Equipment data Equipment = Equipment
{ _eqUse :: Euse --Item -> Creature -> World -> World { _eqUse :: Euse --Item -> Creature -> World -> World
, _eqOnEquip :: Euse --Item -> Creature -> World -> World , _eqOnEquip :: Euse --Item -> Creature -> World -> World
@@ -38,6 +39,7 @@ data Equipment = Equipment
, _eqParams :: EquipParams , _eqParams :: EquipParams
, _eqViewDist :: Maybe Float , _eqViewDist :: Maybe Float
} }
deriving (Eq,Ord,Show,Read)
data AimParams = AimParams data AimParams = AimParams
{ _aimWeight :: Int { _aimWeight :: Int
, _aimRange :: Float , _aimRange :: Float
@@ -46,23 +48,26 @@ data AimParams = AimParams
, _aimHandlePos :: Float , _aimHandlePos :: Float
, _aimMuzPos :: Float , _aimMuzPos :: Float
} }
deriving (Eq,Ord,Show,Read)
data AimStance data AimStance
= TwoHandTwist = TwoHandTwist
| TwoHandFlat | TwoHandFlat
| OneHand | OneHand
| LeaveHolstered | LeaveHolstered
deriving deriving
(Eq,Show,Ord,Enum) (Eq,Show,Ord,Enum,Read)
data EquipParams data EquipParams
= NoEquipParams = NoEquipParams
| EquipID {_eparamID :: Int} | EquipID {_eparamID :: Int}
| EquipCounter {_eparamInt :: Int} | EquipCounter {_eparamInt :: Int}
deriving (Eq,Ord,Show,Read)
data ItZoom = ItZoom data ItZoom = ItZoom
{ _itZoomMax :: Float { _itZoomMax :: Float
, _itZoomMin :: Float , _itZoomMin :: Float
, _itZoomFac :: Float , _itZoomFac :: Float
} }
deriving (Eq,Ord,Show,Read)
makeLenses ''ItemUse makeLenses ''ItemUse
makeLenses ''AimParams makeLenses ''AimParams
makeLenses ''EquipParams makeLenses ''EquipParams
+1
View File
@@ -18,4 +18,5 @@ data UseDelay -- should just be Delay
{_warmTime :: Int {_warmTime :: Int
,_warmMax :: Int ,_warmMax :: Int
} }
deriving (Eq,Ord,Show,Read)
makeLenses ''UseDelay makeLenses ''UseDelay
+1 -1
View File
@@ -2,6 +2,6 @@
module Dodge.Data.ItemAmount where module Dodge.Data.ItemAmount where
newtype IcAmount = IcAmount {_toInt :: Int} newtype IcAmount = IcAmount {_toInt :: Int}
deriving (Eq,Ord,Num,Integral,Real,Enum) deriving (Eq,Ord,Num,Integral,Real,Enum,Read)
instance Show IcAmount where instance Show IcAmount where
show (IcAmount i) = 'x':show i show (IcAmount i) = 'x':show i
+2 -2
View File
@@ -9,12 +9,12 @@ data LoadAction
| LoadInsert {_actionTime :: Int, _actionSound :: SoundID} | LoadInsert {_actionTime :: Int, _actionSound :: SoundID}
| LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int } | LoadAdd {_actionTime :: Int, _actionSound :: SoundID, _insertMax :: Int }
| LoadPrime {_actionTime :: Int, _actionSound :: SoundID} | LoadPrime {_actionTime :: Int, _actionSound :: SoundID}
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction } data InvSel = InvSel {_iselPos :: Int, _iselAction :: InvSelAction }
data InvSelAction data InvSelAction
= NoInvSelAction = NoInvSelAction
| ReloadAction { _actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType} | ReloadAction { _actionProgress :: Int, _reloadAction :: LoadAction, _actionHammer :: HammerType}
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
makeLenses ''LoadAction makeLenses ''LoadAction
makeLenses ''InvSel makeLenses ''InvSel
makeLenses ''InvSelAction makeLenses ''InvSelAction
+1 -1
View File
@@ -4,4 +4,4 @@
--{-# LANGUAGE DeriveGeneric #-} --{-# LANGUAGE DeriveGeneric #-}
module Dodge.Data.Material where module Dodge.Data.Material where
data Material = Wood | Dirt | Stone | Glass | Metal | Crystal | Flesh | Electronics 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 #-} {-# LANGUAGE StrictData #-}
module Dodge.Data.Payload where module Dodge.Data.Payload where
data Payload = ExplosionPayload | DudPayload data Payload = ExplosionPayload | DudPayload
deriving (Show,Read,Eq,Ord,Enum,Bounded)
+3
View File
@@ -12,13 +12,16 @@ data Targeting
, _tgID :: Maybe Int , _tgID :: Maybe Int
, _tgActive :: Bool , _tgActive :: Bool
} }
deriving (Eq,Ord,Show,Read)
data TargetUpdate = NoTargetUpdate data TargetUpdate = NoTargetUpdate
| TargetLaserUpdate | TargetLaserUpdate
| TargetRBPressUpdate | TargetRBPressUpdate
| TargetRBCreatureUpdate | TargetRBCreatureUpdate
| TargetCursorUpdate | TargetCursorUpdate
deriving (Eq,Ord,Show,Read)
data TargetDraw = NoTargetDraw data TargetDraw = NoTargetDraw
| TargetDistanceDraw | TargetDistanceDraw
| SimpleDrawTarget | SimpleDrawTarget
| TargetRBCreatureDraw | TargetRBCreatureDraw
deriving (Eq,Ord,Show,Read)
makeLenses ''Targeting makeLenses ''Targeting
+6 -3
View File
@@ -6,7 +6,6 @@ module Dodge.Data.Wall where
import Dodge.Data.Material import Dodge.Data.Material
import Geometry import Geometry
import Color import Color
import ShapePicture
import Control.Lens import Control.Lens
data Wall = Wall data Wall = Wall
{ _wlLine :: (Point2,Point2) { _wlLine :: (Point2,Point2)
@@ -25,14 +24,17 @@ data Wall = Wall
, _wlRotateTo :: Bool , _wlRotateTo :: Bool
, _wlStructure :: WallStructure , _wlStructure :: WallStructure
, _wlHeight :: Float , _wlHeight :: Float
-- , _wlDamageEff :: Damage -> Wall -> World -> World
, _wlMaterial :: Material , _wlMaterial :: Material
} }
deriving (Eq,Ord,Show,Read)
data Opacity data Opacity
= SeeThrough = SeeThrough
| SeeAbove | SeeAbove
| DrawnWall {_opDraw :: Wall -> SPic} | DrawnWall {_opDraw :: WallDraw } -- Wall -> SPic
| Opaque | Opaque
deriving (Eq,Ord,Show,Read)
data WallDraw = DrawForceField
deriving (Eq,Ord,Show,Read,Enum,Bounded)
data WallStructure data WallStructure
= StandaloneWall = StandaloneWall
| DoorPart { _wsDoor :: Int } | DoorPart { _wsDoor :: Int }
@@ -42,6 +44,7 @@ data WallStructure
{ _wlStCreature :: Int { _wlStCreature :: Int
-- , _wlStDamCreature :: Damage -> Wall -> Int -> World -> World -- , _wlStDamCreature :: Damage -> Wall -> Int -> World -> World
} }
deriving (Eq,Ord,Show,Read)
makeLenses ''Wall makeLenses ''Wall
makeLenses ''WallStructure makeLenses ''WallStructure
makeLenses ''Opacity makeLenses ''Opacity
+4 -16
View File
@@ -14,32 +14,20 @@ the simulation step; in particular see 'updatePressedButtons'.
module Dodge.Event module Dodge.Event
( handleEvent ( handleEvent
) where ) where
import Dodge.Tweak
import Dodge.HeldScroll import Dodge.HeldScroll
import Dodge.InputFocus import Dodge.InputFocus
import Dodge.Combine import Dodge.Combine
import Dodge.Event.Keyboard import Dodge.Event.Keyboard
--import Dodge.Event.Menu
import Dodge.Base import Dodge.Base
--import Dodge.Item
--import Dodge.Combine.Module
import Dodge.Data import Dodge.Data
--import Dodge.Base.Window
import Dodge.PreloadData import Dodge.PreloadData
--import Dodge.Creature.Action
import Dodge.Inventory import Dodge.Inventory
import Dodge.SoundLogic import Dodge.SoundLogic
--import Geometry
--import Preload.Update
--import Dodge.FloorItem
import qualified IntMapHelp as IM import qualified IntMapHelp as IM
--import Data.Monoid
import Control.Lens import Control.Lens
import Data.Maybe import Data.Maybe
--import Data.Maybe
--import Data.Char
--import Data.List
--import Data.Function (on)
import qualified Data.Map.Strict as M import qualified Data.Map.Strict as M
import qualified Data.Set as S import qualified Data.Set as S
import qualified Data.Text as T import qualified Data.Text as T
@@ -194,10 +182,10 @@ moveTweakSel i w = case yourItem w ^? _Just . itTweaks . tweakParams of
changeTweakParam :: Int -> World -> World changeTweakParam :: Int -> World -> World
changeTweakParam i w = w changeTweakParam i w = w
& creatures . ix (_yourID w) . crInv . ix (crSel (you w)) %~ & creatures . ix (_yourID w) . crInv . ix (crSel (you w)) %~
( (itTweaks . tweakParams . ix paramid . curTweak .~ x) ( (itTweaks . tweakParams . ix paramid . tweakVal .~ x)
. _doTweak params x) . doTweak (_tweakType params) x)
where where
tweaks = _itTweaks . fromJust $ yourItem w tweaks = _itTweaks . fromJust $ yourItem w
params = _tweakParams tweaks IM.! paramid params = _tweakParams tweaks IM.! paramid
x = (_curTweak params + i) `mod` _maxTweak params x = (_tweakVal params + i) `mod` _tweakMax params
paramid = _tweakSel tweaks paramid = _tweakSel tweaks
+2
View File
@@ -17,6 +17,7 @@ data ItAttachment
| AttachFloat { _atFloat :: Float } | AttachFloat { _atFloat :: Float }
| AttachBool { _atBool :: Bool } | AttachBool { _atBool :: Bool }
| NoItAttachment | NoItAttachment
deriving (Eq,Ord,Show,Read)
data Scope = NoScope data Scope = NoScope
| RemoteScope | RemoteScope
@@ -31,6 +32,7 @@ data Scope = NoScope
,_scopeDefaultZoom :: Float ,_scopeDefaultZoom :: Float
,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision ,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision
} }
deriving (Eq,Ord,Show,Read)
makeLenses ''ItAttachment makeLenses ''ItAttachment
makeLenses ''Scope makeLenses ''Scope
+1
View File
@@ -6,3 +6,4 @@ data CurseStatus
= Uncursed = Uncursed
| UndroppableIdentified | UndroppableIdentified
| UndroppableUnidentified | UndroppableUnidentified
deriving (Eq,Ord,Show,Read)
+11 -36
View File
@@ -248,33 +248,21 @@ lasGun = defaultAutoBatteryGun
lasGunTweak :: TweakParam lasGunTweak :: TweakParam
lasGunTweak = TweakParam lasGunTweak = TweakParam
{ _doTweak = thetweak { _tweakType = TweakPhaseV
, _curTweak = 1 , _tweakVal = 1
, _maxTweak = 3 , _tweakMax = 3
, _showTweak = showPhaseV
, _nameTweak = "PHASE VELOCITY"
} }
where
thetweak 0 = itParams . phaseV .~ 0.2
thetweak 1 = itParams . phaseV .~ 1
thetweak 2 = itParams . phaseV .~ 5
thetweak _ = id
showPhaseV 0 = "V"
showPhaseV 1 = "/"
showPhaseV 2 = "Z"
showPhaseV i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
tractorGun :: Item tractorGun :: Item
tractorGun = lasGun tractorGun = lasGun
{ _itConsumption = defaultLoadable & itConsumption .~
( defaultLoadable
& laMax .~ 10000 & laMax .~ 10000
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60] & laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60] )
, _itParams = Attracting {_attractionPower = 1} & itParams .~ Attracting {_attractionPower = 1}
, _itTweaks = Tweakable & itTweaks .~ Tweakable
{ _tweakParams = IM.fromList [(0,tractorGunTweak)] { _tweakParams = IM.fromList [(0,tractorGunTweak)]
, _tweakSel = 0 , _tweakSel = 0
} }
}
& itUse . rUse .~ HeldTractor --aTractorBeam & itUse . rUse .~ HeldTractor --aTractorBeam
& itUse . useDelay .~ NoDelay & itUse . useDelay .~ NoDelay
& itUse . useMods .~ AmmoCheckMod & itUse . useMods .~ AmmoCheckMod
@@ -287,23 +275,10 @@ tractorGun = lasGun
tractorGunTweak :: TweakParam tractorGunTweak :: TweakParam
tractorGunTweak = TweakParam tractorGunTweak = TweakParam
{ _doTweak = thetweak { _tweakType = TweakTractionPower
, _curTweak = 1 , _tweakVal = 1
, _maxTweak = 4 , _tweakMax = 4
, _showTweak = showPower
, _nameTweak = "TRACTION POWER"
} }
where
thetweak 0 = itParams . attractionPower .~ 1
thetweak 1 = itParams . attractionPower .~ -1
thetweak 2 = itParams . attractionPower .~ -10
thetweak 3 = itParams . attractionPower .~ 0
thetweak _ = id
showPower 0 = "+"
showPower 1 = "-"
showPower 2 = "#"
showPower 3 = "0" -- object should stay in the center of the beam
showPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
-- | assumes that the item is held -- | assumes that the item is held
shootTeslaArc :: Item -> Creature -> World -> World shootTeslaArc :: Item -> Creature -> World -> World
+9 -16
View File
@@ -68,30 +68,23 @@ basicAmPjMoves = IM.fromList . zip [0..] $
] ]
spinDrag :: TweakParam spinDrag :: TweakParam
spinDrag = TweakParam spinDrag = TweakParam
{ _doTweak = \i -> itParams . shellSpinDrag .~ i { _tweakType = TweakSpinDrag
, _curTweak = 1 , _tweakVal = 1
, _showTweak = show , _tweakMax = 5
, _maxTweak = 5
, _nameTweak = "SPIN SLOWDOWN"
} }
spinStart :: TweakParam spinStart :: TweakParam
spinStart = TweakParam spinStart = TweakParam
{ _doTweak = \i -> itParams . shellSpinAmount .~ i { _tweakType = TweakSpinAmount
, _curTweak = 2 , _tweakVal = 2
, _showTweak = show , _tweakMax = 5
, _maxTweak = 5
, _nameTweak = "SPIN AMOUNT"
} }
thrustParam :: TweakParam thrustParam :: TweakParam
thrustParam = TweakParam thrustParam = TweakParam
{ _doTweak = \i -> itParams . shellThrustDelay .~ i { _tweakType = TweakThrustDelay
, _curTweak = 1 , _tweakVal = 1
, _showTweak = show , _tweakMax = 5
, _maxTweak = 5
, _nameTweak = "THRUST DELAY"
} }
remoteLauncher :: Item remoteLauncher :: Item
remoteLauncher = launcher remoteLauncher = launcher
& itType . iyBase .~ HELD REMOTELAUNCHER & itType . iyBase .~ HELD REMOTELAUNCHER
+1 -1
View File
@@ -54,4 +54,4 @@ makeSwitch
-> WorldEffect -- ^ Switch on effect -> WorldEffect -- ^ Switch on effect
-> WorldEffect -- ^ Switch off effect -> WorldEffect -- ^ Switch off effect
-> Button -> Button
makeSwitch col1 col2 f1 = makeSwitchSPic (DefaultDrawSwitch col1 col2) f1 makeSwitch col1 col2 = makeSwitchSPic (DefaultDrawSwitch col1 col2)
+1 -1
View File
@@ -34,7 +34,7 @@ tlsTimeRadFunPos t rmax intensityF p = TLS
, _tlsUpdate = IntensityTLS intensityF , _tlsUpdate = IntensityTLS intensityF
, _tlsTime = t , _tlsTime = t
} }
where -- where
-- upF tls -- upF tls
-- | _tlsTime tls <= 0 = Nothing -- | _tlsTime tls <= 0 = Nothing
-- | otherwise = Just $ tls -- | otherwise = Just $ tls
+4 -5
View File
@@ -3,6 +3,7 @@ module Dodge.Render.HUD
( hudDrawings ( hudDrawings
) where ) where
import Dodge.Data import Dodge.Data
import Dodge.Tweak.Show
import Dodge.Item.Display import Dodge.Item.Display
import Dodge.Combine import Dodge.Combine
import Dodge.Clock import Dodge.Clock
@@ -79,11 +80,9 @@ subInventoryDisplay subinv cfig w = case subinv of
, fromMaybe mempty $ do , fromMaybe mempty $ do
tweaki <- it ^? _Just . itTweaks . tweakSel tweaki <- it ^? _Just . itTweaks . tweakSel
-- consider moving this functionality out into a tweaks module -- consider moving this functionality out into a tweaks module
showtweak <- it ^? _Just . itTweaks . tweakParams . ix tweaki . showTweak tparam <- it ^? _Just . itTweaks . tweakParams . ix tweaki
tweakname <- it ^? _Just . itTweaks . tweakParams . ix tweaki . nameTweak
tweakstring <- showtweak <$> (it ^? _Just . itTweaks . tweakParams . ix tweaki . curTweak)
return $ lnkMidInvSel cfig w curpos tweaki return $ lnkMidInvSel cfig w curpos tweaki
<> listCursorNSW subInvX 60 cfig tweaki white (length $ tweakstring ++ tweakname) 1 <> listCursorNSW subInvX 60 cfig tweaki white (length $ showTweak tparam) 1
, invHead cfig "TWEAK" , invHead cfig "TWEAK"
, listPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it) , listPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
] ]
@@ -269,7 +268,7 @@ ammoTweakStrings it = case it ^? _Just . itTweaks . tweakParams of
_ -> ["NOT TWEAKABLE"] _ -> ["NOT TWEAKABLE"]
tweakString :: TweakParam -> String tweakString :: TweakParam -> String
tweakString tp = rightPad 12 ' ' (_nameTweak tp) ++ " " ++ _showTweak tp (_curTweak tp) tweakString tp = rightPad 12 ' ' (show $ _tweakType tp) ++ " " ++ showTweak tp
invHead :: Configuration -> String -> Picture invHead :: Configuration -> String -> Picture
invHead cfig s = winScale cfig invHead cfig s = winScale cfig
+2 -1
View File
@@ -2,6 +2,7 @@ module Dodge.Render.Walls
( wallsToDraw ( wallsToDraw
) where ) where
import Dodge.Data import Dodge.Data
import Dodge.Wall.Draw
import Dodge.Zone import Dodge.Zone
import Dodge.Base.Wall import Dodge.Base.Wall
import Geometry import Geometry
@@ -36,7 +37,7 @@ wlSeeThroughDraw wl = wlIsSeeThrough wl && _wlHeight wl == 100
getWallSPic :: Wall -> SPic getWallSPic :: Wall -> SPic
getWallSPic wl = case wl ^? wlOpacity . opDraw of getWallSPic wl = case wl ^? wlOpacity . opDraw of
Nothing -> mempty Nothing -> mempty
Just f -> f wl Just f -> drawWall f wl
-- (wins,wls) = partition theTest . IM.elems . IM.filter _wlUnshadowed $ wallsDoubleScreen cfig w -- (wins,wls) = partition theTest . IM.elems . IM.filter _wlUnshadowed $ wallsDoubleScreen cfig w
-- theTest wl = case _wlOpacity wl of -- theTest wl = case _wlOpacity wl of
+24
View File
@@ -1 +1,25 @@
module Dodge.Tweak where module Dodge.Tweak where
import Dodge.Data.Item
import Control.Lens
doTweak :: TweakType -> Int -> Item -> Item
doTweak tt = case tt of
TweakPhaseV -> tweakPhaseV
TweakTractionPower -> tweakTractionPower
TweakSpinDrag -> \i -> itParams . shellSpinDrag .~ i
TweakSpinAmount -> \i -> itParams . shellSpinAmount .~ i
TweakThrustDelay -> \i -> itParams . shellThrustDelay .~ i
tweakTractionPower :: Int -> Item -> Item
tweakTractionPower 0 = itParams . attractionPower .~ 1
tweakTractionPower 1 = itParams . attractionPower .~ -1
tweakTractionPower 2 = itParams . attractionPower .~ -10
tweakTractionPower 3 = itParams . attractionPower .~ 0
tweakTractionPower _ = id
tweakPhaseV :: Int -> Item -> Item
tweakPhaseV 0 = itParams . phaseV .~ 0.2
tweakPhaseV 1 = itParams . phaseV .~ 1
tweakPhaseV 2 = itParams . phaseV .~ 5
tweakPhaseV _ = id
+25
View File
@@ -0,0 +1,25 @@
module Dodge.Tweak.Show where
import Dodge.Data.Item
showTweak :: TweakParam -> String
showTweak tp = case tt of
TweakPhaseV -> showPhaseV ct
TweakTractionPower -> showTractionPower ct
TweakSpinDrag -> show ct
TweakSpinAmount -> show ct
TweakThrustDelay -> show ct
where
tt = _tweakType tp
ct = _tweakVal tp
showPhaseV :: Int -> String
showPhaseV 0 = "V"
showPhaseV 1 = "/"
showPhaseV 2 = "Z"
showPhaseV i = show i ++ " should not be possible"
showTractionPower :: Int -> String
showTractionPower 0 = "+"
showTractionPower 1 = "-"
showTractionPower 2 = "#"
showTractionPower 3 = "0" -- object should stay in the center of the beam
showTractionPower i = "THIS SHOULD NOT BE POSSIBLE" ++ show i
+18
View File
@@ -0,0 +1,18 @@
module Dodge.Wall.Draw where
import Dodge.Data.Wall
import ShapePicture
import Picture.Base
drawWall :: WallDraw -> Wall -> SPic
drawWall wd = case wd of
DrawForceField -> drawForceField
drawForceField :: Wall -> SPic
drawForceField wl = (mempty
, setLayer BloomLayer
. setDepth 20
. color (_wlColor wl)
$ thickLine 5 [a,b]
)
where
(a,b) = _wlLine wl
+1 -12
View File
@@ -2,13 +2,11 @@ module Dodge.Wall.ForceField where
import Dodge.Data import Dodge.Data
import Dodge.Default.Wall import Dodge.Default.Wall
import Color import Color
import Picture
import ShapePicture
forceField :: Wall forceField :: Wall
forceField = defaultWall forceField = defaultWall
{_wlColor = orange {_wlColor = orange
,_wlOpacity = DrawnWall drawForceField ,_wlOpacity = DrawnWall DrawForceField
,_wlPathable = True ,_wlPathable = True
,_wlWalkable = True ,_wlWalkable = True
,_wlFireThrough = True ,_wlFireThrough = True
@@ -18,12 +16,3 @@ forceField = defaultWall
,_wlStructure = StandaloneWall ,_wlStructure = StandaloneWall
} }
drawForceField :: Wall -> SPic
drawForceField wl = (mempty
, setLayer BloomLayer
. setDepth 20
. color (_wlColor wl)
$ thickLine 5 [a,b]
)
where
(a,b) = _wlLine wl
+5 -4
View File
@@ -1,9 +1,11 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE StrictData #-} {-# LANGUAGE StrictData #-}
{-# LANGUAGE TemplateHaskell #-} {-# LANGUAGE TemplateHaskell #-}
module Picture.Data module Picture.Data
where where
import Geometry.Data import Geometry.Data
import GHC.Generics
import Control.Lens import Control.Lens
import Streaming import Streaming
data Verx = Verx data Verx = Verx
@@ -13,8 +15,7 @@ data Verx = Verx
, _vxLayer :: !Layer , _vxLayer :: !Layer
, _vxShadNum :: !ShadNum , _vxShadNum :: !ShadNum
} }
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Generic,Read)
--newtype LayNum = LayNum { _unLayNum :: Int }
data Layer data Layer
= BottomLayer = BottomLayer
@@ -23,7 +24,7 @@ data Layer
| BloomNoZWrite | BloomNoZWrite
| DebugLayer | DebugLayer
| FixedCoordLayer | FixedCoordLayer
deriving (Eq,Ord,Enum,Bounded,Show) deriving (Eq,Ord,Enum,Bounded,Show,Generic,Read)
layerNum :: Layer -> Int layerNum :: Layer -> Int
layerNum = fromEnum layerNum = fromEnum
@@ -31,7 +32,7 @@ numLayers :: Int
numLayers = length [minBound::Layer .. maxBound] numLayers = length [minBound::Layer .. maxBound]
--TODO use synonyms for layer numbers --TODO use synonyms for layer numbers
newtype ShadNum = ShadNum { _unShadNum :: Int } newtype ShadNum = ShadNum { _unShadNum :: Int }
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Generic,Read)
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
{-# INLINE polyNum #-} {-# INLINE polyNum #-}
{-# INLINE polyzNum #-} {-# INLINE polyzNum #-}
+1 -1
View File
@@ -22,7 +22,7 @@ data PlayStatus
| ToStop | ToStop
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show)
newtype SoundID = SoundID { _getSoundID :: Int } newtype SoundID = SoundID { _getSoundID :: Int }
deriving (Eq,Ord,Show) deriving (Eq,Ord,Show,Read)
newtype SoundData = SoundData newtype SoundData = SoundData
{_loadedChunks :: IM.IntMap Mix.Chunk {_loadedChunks :: IM.IntMap Mix.Chunk
} }