Add Read instances
This commit is contained in:
@@ -12,10 +12,10 @@ data ItemType = ItemType
|
||||
,_iyModules :: M.Map ModuleSlot ItemModuleType
|
||||
,_iyStack :: Stack
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
data Stack = NoStack | Stack IcAmount
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
data CraftType
|
||||
= PIPE
|
||||
@@ -200,8 +200,7 @@ data ItemModuleType
|
||||
| LAUNCHHOME
|
||||
| EXTRABATTERY
|
||||
| ATTACHTORCH
|
||||
deriving (Eq,Ord,Show)
|
||||
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
data Detector
|
||||
= ITEMDETECTOR
|
||||
| CREATUREDETECTOR
|
||||
@@ -220,7 +219,7 @@ data ModuleSlot
|
||||
| ModTeleport
|
||||
| ModDualBeam
|
||||
| ModHeldAttach
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
makeLenses ''ItemType
|
||||
makeLenses ''ItemBaseType
|
||||
|
||||
@@ -723,7 +723,6 @@ data InPlacement = InPlacement
|
||||
, _ipPlacementID :: Int
|
||||
}
|
||||
makeLenses ''World
|
||||
makeLenses ''Creature
|
||||
makeLenses ''FloorItem
|
||||
makeLenses ''Prop
|
||||
makeLenses ''Proj
|
||||
@@ -731,7 +730,6 @@ makeLenses ''Modification
|
||||
makeLenses ''Particle
|
||||
makeLenses ''PressPlate
|
||||
makeLenses ''CrGroupParams
|
||||
makeLenses ''Intention
|
||||
makeLenses ''Door
|
||||
makeLenses ''Terminal
|
||||
makeLenses ''Machine
|
||||
@@ -747,7 +745,6 @@ makeLenses ''WorldBeams
|
||||
makeLenses ''TerminalCommand
|
||||
makeLenses ''TerminalInput
|
||||
makeLenses ''GenParams
|
||||
makeLenses ''Corpse
|
||||
----- ROOM LENSES
|
||||
|
||||
makeLenses ''Room
|
||||
|
||||
@@ -19,7 +19,7 @@ data ActionPlan
|
||||
,_apStrategy :: Strategy
|
||||
,_apGoal :: [Goal]
|
||||
}
|
||||
data RandImpulse = RandImpulseList [Impulse]
|
||||
newtype RandImpulse = RandImpulseList [Impulse]
|
||||
data Impulse
|
||||
= Move Point2
|
||||
| MoveForward Float
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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,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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
--{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Gas where
|
||||
data GasCreate = CreatePoisonGas | CreateFlame
|
||||
deriving (Eq,Ord,Show,Enum,Bounded,Read)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -28,4 +28,5 @@ data ItemConsumption
|
||||
{ _icAmount :: IcAmount
|
||||
}
|
||||
| NoConsumption
|
||||
deriving (Show,Read)
|
||||
makeLenses ''ItemConsumption
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
module Dodge.Data.Item.HeldScroll where
|
||||
|
||||
data HeldScroll = HeldScrollDoNothing | HeldScrollZoom | HeldScrollCharMode
|
||||
deriving (Eq,Ord,Enum,Bounded,Show,Read)
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -18,4 +18,5 @@ data UseDelay -- should just be Delay
|
||||
{_warmTime :: Int
|
||||
,_warmMax :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
makeLenses ''UseDelay
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -2,3 +2,4 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Payload where
|
||||
data Payload = ExplosionPayload | DudPayload
|
||||
deriving (Show,Read,Eq,Ord,Enum,Bounded)
|
||||
|
||||
@@ -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,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
|
||||
|
||||
+4
-16
@@ -14,32 +14,20 @@ the simulation step; in particular see 'updatePressedButtons'.
|
||||
module Dodge.Event
|
||||
( handleEvent
|
||||
) where
|
||||
import Dodge.Tweak
|
||||
import Dodge.HeldScroll
|
||||
import Dodge.InputFocus
|
||||
import Dodge.Combine
|
||||
import Dodge.Event.Keyboard
|
||||
--import Dodge.Event.Menu
|
||||
import Dodge.Base
|
||||
--import Dodge.Item
|
||||
--import Dodge.Combine.Module
|
||||
import Dodge.Data
|
||||
--import Dodge.Base.Window
|
||||
import Dodge.PreloadData
|
||||
--import Dodge.Creature.Action
|
||||
import Dodge.Inventory
|
||||
import Dodge.SoundLogic
|
||||
--import Geometry
|
||||
--import Preload.Update
|
||||
--import Dodge.FloorItem
|
||||
import qualified IntMapHelp as IM
|
||||
|
||||
--import Data.Monoid
|
||||
import Control.Lens
|
||||
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.Set as S
|
||||
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 i w = w
|
||||
& creatures . ix (_yourID w) . crInv . ix (crSel (you w)) %~
|
||||
( (itTweaks . tweakParams . ix paramid . curTweak .~ x)
|
||||
. _doTweak params x)
|
||||
( (itTweaks . tweakParams . ix paramid . tweakVal .~ x)
|
||||
. doTweak (_tweakType params) x)
|
||||
where
|
||||
tweaks = _itTweaks . fromJust $ yourItem w
|
||||
params = _tweakParams tweaks IM.! paramid
|
||||
x = (_curTweak params + i) `mod` _maxTweak params
|
||||
x = (_tweakVal params + i) `mod` _tweakMax params
|
||||
paramid = _tweakSel tweaks
|
||||
|
||||
@@ -17,6 +17,7 @@ data ItAttachment
|
||||
| AttachFloat { _atFloat :: Float }
|
||||
| AttachBool { _atBool :: Bool }
|
||||
| NoItAttachment
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
data Scope = NoScope
|
||||
| RemoteScope
|
||||
@@ -31,6 +32,7 @@ data Scope = NoScope
|
||||
,_scopeDefaultZoom :: Float
|
||||
,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
makeLenses ''ItAttachment
|
||||
makeLenses ''Scope
|
||||
|
||||
@@ -6,3 +6,4 @@ data CurseStatus
|
||||
= Uncursed
|
||||
| UndroppableIdentified
|
||||
| UndroppableUnidentified
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
|
||||
@@ -248,33 +248,21 @@ lasGun = defaultAutoBatteryGun
|
||||
|
||||
lasGunTweak :: TweakParam
|
||||
lasGunTweak = TweakParam
|
||||
{ _doTweak = thetweak
|
||||
, _curTweak = 1
|
||||
, _maxTweak = 3
|
||||
, _showTweak = showPhaseV
|
||||
, _nameTweak = "PHASE VELOCITY"
|
||||
{ _tweakType = TweakPhaseV
|
||||
, _tweakVal = 1
|
||||
, _tweakMax = 3
|
||||
}
|
||||
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 = lasGun
|
||||
{ _itConsumption = defaultLoadable
|
||||
& laMax .~ 10000
|
||||
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60]
|
||||
, _itParams = Attracting {_attractionPower = 1}
|
||||
, _itTweaks = Tweakable
|
||||
& itConsumption .~
|
||||
( defaultLoadable
|
||||
& laMax .~ 10000
|
||||
& laCycle .~ [loadEject 10, loadInsert 10 , loadPrime 60] )
|
||||
& itParams .~ Attracting {_attractionPower = 1}
|
||||
& itTweaks .~ Tweakable
|
||||
{ _tweakParams = IM.fromList [(0,tractorGunTweak)]
|
||||
, _tweakSel = 0
|
||||
}
|
||||
}
|
||||
& itUse . rUse .~ HeldTractor --aTractorBeam
|
||||
& itUse . useDelay .~ NoDelay
|
||||
& itUse . useMods .~ AmmoCheckMod
|
||||
@@ -287,23 +275,10 @@ tractorGun = lasGun
|
||||
|
||||
tractorGunTweak :: TweakParam
|
||||
tractorGunTweak = TweakParam
|
||||
{ _doTweak = thetweak
|
||||
, _curTweak = 1
|
||||
, _maxTweak = 4
|
||||
, _showTweak = showPower
|
||||
, _nameTweak = "TRACTION POWER"
|
||||
{ _tweakType = TweakTractionPower
|
||||
, _tweakVal = 1
|
||||
, _tweakMax = 4
|
||||
}
|
||||
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
|
||||
shootTeslaArc :: Item -> Creature -> World -> World
|
||||
|
||||
@@ -68,30 +68,23 @@ basicAmPjMoves = IM.fromList . zip [0..] $
|
||||
]
|
||||
spinDrag :: TweakParam
|
||||
spinDrag = TweakParam
|
||||
{ _doTweak = \i -> itParams . shellSpinDrag .~ i
|
||||
, _curTweak = 1
|
||||
, _showTweak = show
|
||||
, _maxTweak = 5
|
||||
, _nameTweak = "SPIN SLOWDOWN"
|
||||
{ _tweakType = TweakSpinDrag
|
||||
, _tweakVal = 1
|
||||
, _tweakMax = 5
|
||||
}
|
||||
spinStart :: TweakParam
|
||||
spinStart = TweakParam
|
||||
{ _doTweak = \i -> itParams . shellSpinAmount .~ i
|
||||
, _curTweak = 2
|
||||
, _showTweak = show
|
||||
, _maxTweak = 5
|
||||
, _nameTweak = "SPIN AMOUNT"
|
||||
{ _tweakType = TweakSpinAmount
|
||||
, _tweakVal = 2
|
||||
, _tweakMax = 5
|
||||
}
|
||||
thrustParam :: TweakParam
|
||||
thrustParam = TweakParam
|
||||
{ _doTweak = \i -> itParams . shellThrustDelay .~ i
|
||||
, _curTweak = 1
|
||||
, _showTweak = show
|
||||
, _maxTweak = 5
|
||||
, _nameTweak = "THRUST DELAY"
|
||||
{ _tweakType = TweakThrustDelay
|
||||
, _tweakVal = 1
|
||||
, _tweakMax = 5
|
||||
}
|
||||
|
||||
|
||||
remoteLauncher :: Item
|
||||
remoteLauncher = launcher
|
||||
& itType . iyBase .~ HELD REMOTELAUNCHER
|
||||
|
||||
@@ -54,4 +54,4 @@ makeSwitch
|
||||
-> WorldEffect -- ^ Switch on effect
|
||||
-> WorldEffect -- ^ Switch off effect
|
||||
-> Button
|
||||
makeSwitch col1 col2 f1 = makeSwitchSPic (DefaultDrawSwitch col1 col2) f1
|
||||
makeSwitch col1 col2 = makeSwitchSPic (DefaultDrawSwitch col1 col2)
|
||||
|
||||
@@ -34,7 +34,7 @@ tlsTimeRadFunPos t rmax intensityF p = TLS
|
||||
, _tlsUpdate = IntensityTLS intensityF
|
||||
, _tlsTime = t
|
||||
}
|
||||
where
|
||||
-- where
|
||||
-- upF tls
|
||||
-- | _tlsTime tls <= 0 = Nothing
|
||||
-- | otherwise = Just $ tls
|
||||
|
||||
@@ -3,6 +3,7 @@ module Dodge.Render.HUD
|
||||
( hudDrawings
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Tweak.Show
|
||||
import Dodge.Item.Display
|
||||
import Dodge.Combine
|
||||
import Dodge.Clock
|
||||
@@ -79,11 +80,9 @@ subInventoryDisplay subinv cfig w = case subinv of
|
||||
, fromMaybe mempty $ do
|
||||
tweaki <- it ^? _Just . itTweaks . tweakSel
|
||||
-- consider moving this functionality out into a tweaks module
|
||||
showtweak <- it ^? _Just . itTweaks . tweakParams . ix tweaki . showTweak
|
||||
tweakname <- it ^? _Just . itTweaks . tweakParams . ix tweaki . nameTweak
|
||||
tweakstring <- showtweak <$> (it ^? _Just . itTweaks . tweakParams . ix tweaki . curTweak)
|
||||
tparam <- it ^? _Just . itTweaks . tweakParams . ix 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"
|
||||
, listPicturesAt subInvX 60 cfig $ map text (ammoTweakStrings it)
|
||||
]
|
||||
@@ -269,7 +268,7 @@ ammoTweakStrings it = case it ^? _Just . itTweaks . tweakParams of
|
||||
_ -> ["NOT TWEAKABLE"]
|
||||
|
||||
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 cfig s = winScale cfig
|
||||
|
||||
@@ -2,6 +2,7 @@ module Dodge.Render.Walls
|
||||
( wallsToDraw
|
||||
) where
|
||||
import Dodge.Data
|
||||
import Dodge.Wall.Draw
|
||||
import Dodge.Zone
|
||||
import Dodge.Base.Wall
|
||||
import Geometry
|
||||
@@ -36,7 +37,7 @@ wlSeeThroughDraw wl = wlIsSeeThrough wl && _wlHeight wl == 100
|
||||
getWallSPic :: Wall -> SPic
|
||||
getWallSPic wl = case wl ^? wlOpacity . opDraw of
|
||||
Nothing -> mempty
|
||||
Just f -> f wl
|
||||
Just f -> drawWall f wl
|
||||
|
||||
-- (wins,wls) = partition theTest . IM.elems . IM.filter _wlUnshadowed $ wallsDoubleScreen cfig w
|
||||
-- theTest wl = case _wlOpacity wl of
|
||||
|
||||
@@ -1 +1,25 @@
|
||||
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
|
||||
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -2,13 +2,11 @@ module Dodge.Wall.ForceField where
|
||||
import Dodge.Data
|
||||
import Dodge.Default.Wall
|
||||
import Color
|
||||
import Picture
|
||||
import ShapePicture
|
||||
|
||||
forceField :: Wall
|
||||
forceField = defaultWall
|
||||
{_wlColor = orange
|
||||
,_wlOpacity = DrawnWall drawForceField
|
||||
,_wlOpacity = DrawnWall DrawForceField
|
||||
,_wlPathable = True
|
||||
,_wlWalkable = True
|
||||
,_wlFireThrough = True
|
||||
@@ -18,12 +16,3 @@ forceField = defaultWall
|
||||
,_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
@@ -1,9 +1,11 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
module Picture.Data
|
||||
where
|
||||
import Geometry.Data
|
||||
|
||||
import GHC.Generics
|
||||
import Control.Lens
|
||||
import Streaming
|
||||
data Verx = Verx
|
||||
@@ -13,8 +15,7 @@ data Verx = Verx
|
||||
, _vxLayer :: !Layer
|
||||
, _vxShadNum :: !ShadNum
|
||||
}
|
||||
deriving (Eq,Ord,Show)
|
||||
--newtype LayNum = LayNum { _unLayNum :: Int }
|
||||
deriving (Eq,Ord,Show,Generic,Read)
|
||||
|
||||
data Layer
|
||||
= BottomLayer
|
||||
@@ -23,7 +24,7 @@ data Layer
|
||||
| BloomNoZWrite
|
||||
| DebugLayer
|
||||
| FixedCoordLayer
|
||||
deriving (Eq,Ord,Enum,Bounded,Show)
|
||||
deriving (Eq,Ord,Enum,Bounded,Show,Generic,Read)
|
||||
|
||||
layerNum :: Layer -> Int
|
||||
layerNum = fromEnum
|
||||
@@ -31,7 +32,7 @@ numLayers :: Int
|
||||
numLayers = length [minBound::Layer .. maxBound]
|
||||
--TODO use synonyms for layer numbers
|
||||
newtype ShadNum = ShadNum { _unShadNum :: Int }
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Generic,Read)
|
||||
polyNum, polyzNum, bezNum, textNum, arcNum, ellNum :: ShadNum
|
||||
{-# INLINE polyNum #-}
|
||||
{-# INLINE polyzNum #-}
|
||||
|
||||
+1
-1
@@ -22,7 +22,7 @@ data PlayStatus
|
||||
| ToStop
|
||||
deriving (Eq,Ord,Show)
|
||||
newtype SoundID = SoundID { _getSoundID :: Int }
|
||||
deriving (Eq,Ord,Show)
|
||||
deriving (Eq,Ord,Show,Read)
|
||||
newtype SoundData = SoundData
|
||||
{_loadedChunks :: IM.IntMap Mix.Chunk
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user