Cleanup
This commit is contained in:
@@ -18,7 +18,6 @@ import Dodge.Data.Hammer
|
||||
import Dodge.Creature.Perception.Data
|
||||
import Dodge.Creature.Memory.Data
|
||||
import Dodge.Creature.Stance.Data
|
||||
import Dodge.Creature.State.Data
|
||||
import Geometry.Data
|
||||
import qualified IntMapHelp as IM
|
||||
import qualified Data.Map.Strict as M
|
||||
|
||||
@@ -1,19 +1,81 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Creature.State where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Dodge.Data.Damage
|
||||
import Dodge.Creature.State.Data
|
||||
|
||||
import Color
|
||||
import Control.Lens
|
||||
data CreatureState = CrSt
|
||||
{ _csDamage :: [Damage]
|
||||
import Data.Aeson
|
||||
import qualified Data.IntSet as IS
|
||||
import Dodge.Data.Damage
|
||||
import GHC.Generics
|
||||
import Geometry.Data
|
||||
|
||||
data CreatureState = CrSt
|
||||
{ _csDamage :: [Damage]
|
||||
, _csSpState :: CrSpState
|
||||
, _csDropsOnDeath :: CreatureDropType
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON CreatureState where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON CreatureState where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON CreatureState
|
||||
|
||||
instance FromJSON CreatureState
|
||||
|
||||
data CreatureDropType
|
||||
= DropAll
|
||||
| DropAmount Int
|
||||
| DropSpecific [Int]
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON CreatureDropType where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON CreatureDropType
|
||||
|
||||
data CrSpState
|
||||
= Barrel {_piercedPoints :: [Point2]}
|
||||
| GenCr
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON CrSpState where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON CrSpState
|
||||
|
||||
data Faction
|
||||
= GenericFaction Int
|
||||
| ZombieFaction
|
||||
| EncircleFlock
|
||||
| ChaseCritters
|
||||
| SpawnedBy Int
|
||||
| NoFaction
|
||||
| ColorFaction Color
|
||||
| PlayerFaction
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON Faction where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON Faction
|
||||
|
||||
data CrGroup
|
||||
= LoneWolf
|
||||
| Swarm
|
||||
{ _swarm :: IS.IntSet
|
||||
, _crGroupID :: Int
|
||||
}
|
||||
| CrGroupID {_crGroupID :: Int}
|
||||
| ShieldGroup
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
|
||||
instance ToJSON CrGroup where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
|
||||
instance FromJSON CrGroup
|
||||
|
||||
makeLenses ''CreatureState
|
||||
makeLenses ''CrSpState
|
||||
makeLenses ''CrGroup
|
||||
|
||||
+5
-15
@@ -7,10 +7,14 @@ module Dodge.Data.Item
|
||||
, module Dodge.Data.Item.Tweak
|
||||
, module Dodge.Data.Item.Params
|
||||
, module Dodge.Data.Item.Use
|
||||
, module Dodge.Data.Item.Consumption
|
||||
, module Dodge.Data.Item.CurseStatus
|
||||
, module Dodge.Data.Item.Attachment
|
||||
) where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Control.Lens
|
||||
import Dodge.Data.Item.CurseStatus
|
||||
import Dodge.Data.Item.Misc
|
||||
import Dodge.Data.Item.Tweak
|
||||
import Dodge.Data.Item.Consumption
|
||||
@@ -18,12 +22,9 @@ import Dodge.Data.Item.Use
|
||||
import Dodge.Data.Item.Params
|
||||
import Dodge.Data.ItEffect
|
||||
import Dodge.Data.Targeting
|
||||
import Dodge.Item.Data
|
||||
import Dodge.Combine.Data
|
||||
import Dodge.Item.Attachment.Data
|
||||
import Dodge.Data.Item.Attachment
|
||||
import Color
|
||||
|
||||
import qualified IntMapHelp as IM
|
||||
data Item = Item
|
||||
{ _itConsumption :: ItemConsumption
|
||||
, _itUse :: ItemUse
|
||||
@@ -47,15 +48,4 @@ data Item = Item
|
||||
instance ToJSON Item where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Item
|
||||
data ItemTweaks
|
||||
= NoTweaks
|
||||
| Tweakable
|
||||
{ _tweakParams :: IM.IntMap TweakParam
|
||||
, _tweakSel :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON ItemTweaks where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ItemTweaks
|
||||
makeLenses ''Item
|
||||
makeLenses ''ItemTweaks
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Item.Attachment
|
||||
where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Geometry.Data
|
||||
import Control.Lens
|
||||
import qualified Data.Sequence as Seq
|
||||
data ItAttachment
|
||||
= AttachFuse {_atFuseTime :: Int}
|
||||
| AttachMode {_atMode :: Int}
|
||||
| AttachCharMode {_atCharMode :: Seq.Seq Char }
|
||||
| AttachTargetPos { _atTargetPos :: Point2 }
|
||||
| AttachInt { _atInt :: Int }
|
||||
| AttachMInt { _atMInt :: Maybe Int }
|
||||
| AttachFloat { _atFloat :: Float }
|
||||
| AttachBool { _atBool :: Bool }
|
||||
| NoItAttachment
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON ItAttachment where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ItAttachment
|
||||
data Scope = NoScope
|
||||
| RemoteScope
|
||||
{_scopePos :: Point2 -- ^ a camera offset
|
||||
,_scopeZoom :: Float
|
||||
,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision
|
||||
}
|
||||
| ZoomScope
|
||||
{_scopePos :: Point2 -- ^ a camera offset
|
||||
,_scopeZoomChange :: Int
|
||||
,_scopeZoom :: Float
|
||||
,_scopeDefaultZoom :: Float
|
||||
,_scopeIsCamera :: Bool -- ^ if the camera offset is also the center of vision
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Scope where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Scope
|
||||
makeLenses ''ItAttachment
|
||||
makeLenses ''Scope
|
||||
@@ -0,0 +1,15 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
--{-# LANGUAGE TemplateHaskell #-}
|
||||
module Dodge.Data.Item.CurseStatus
|
||||
where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
data CurseStatus
|
||||
= Uncursed
|
||||
| UndroppableIdentified
|
||||
| UndroppableUnidentified
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON CurseStatus where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON CurseStatus
|
||||
@@ -1,11 +1,15 @@
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
|
||||
module Dodge.Data.Item.HeldUse where
|
||||
import GHC.Generics
|
||||
|
||||
import Data.Aeson
|
||||
import Dodge.Combine.Data
|
||||
import Dodge.Data.CamouflageStatus
|
||||
data HeldUse = HeldDoNothing
|
||||
import GHC.Generics
|
||||
|
||||
data HeldUse
|
||||
= HeldDoNothing
|
||||
| HeldUseAmmoParams
|
||||
| HeldOverNozzlesUseGasParams
|
||||
| HeldPJCreation
|
||||
@@ -20,41 +24,43 @@ data HeldUse = HeldDoNothing
|
||||
| HeldTractor
|
||||
| HeldForceField
|
||||
| HeldShatter
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON HeldUse where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON HeldUse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON HeldUse
|
||||
data Cuse = CDoNothing
|
||||
instance FromJSON HeldUse
|
||||
data Cuse
|
||||
= CDoNothing
|
||||
| CHeal Int
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Cuse where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON Cuse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Cuse
|
||||
data Euse = EDoNothing
|
||||
instance FromJSON Cuse
|
||||
data Euse
|
||||
= EDoNothing
|
||||
| EDetector Detector
|
||||
| EMagShield
|
||||
| EWristShield
|
||||
| EHeadLamp
|
||||
| ECamouflage CamouflageStatus
|
||||
|
||||
| EonWristShield
|
||||
|
||||
| EoffWristShield
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Euse where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON Euse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Euse
|
||||
data Luse = LDoNothing
|
||||
instance FromJSON Euse
|
||||
data Luse
|
||||
= LDoNothing
|
||||
| LRewind
|
||||
| LShrink
|
||||
| LBlink
|
||||
| LUnsafeBlink
|
||||
| LBoost
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON Luse where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON Luse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON Luse
|
||||
data HeldMod = HeldModNothing
|
||||
instance FromJSON Luse
|
||||
data HeldMod
|
||||
= HeldModNothing
|
||||
| PoisonSprayerMod
|
||||
| FlameSpitterMod
|
||||
| FlameThrowerMod
|
||||
@@ -73,12 +79,12 @@ data HeldMod = HeldModNothing
|
||||
| VolleyGunMod
|
||||
| AutoRifleMod
|
||||
| BangRodMod
|
||||
| ElephantGunMod
|
||||
| AutoAmrMod
|
||||
| MachineGunMod
|
||||
| ElephantGunMod
|
||||
| AutoAmrMod
|
||||
| MachineGunMod
|
||||
| ModWithDirectedTeleport HeldMod
|
||||
| BangStickMod
|
||||
| PistolMod
|
||||
| BangStickMod
|
||||
| PistolMod
|
||||
| AutoPistolMod
|
||||
| MachinePistolMod
|
||||
| BurstRifleMod
|
||||
@@ -86,7 +92,7 @@ data HeldMod = HeldModNothing
|
||||
| SmgMod
|
||||
| RevolverXMod
|
||||
| BangConeMod
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON HeldMod where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON HeldMod where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON HeldMod
|
||||
instance FromJSON HeldMod
|
||||
|
||||
@@ -5,6 +5,17 @@ module Dodge.Data.Item.Tweak where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Control.Lens
|
||||
import qualified IntMapHelp as IM
|
||||
data ItemTweaks
|
||||
= NoTweaks
|
||||
| Tweakable
|
||||
{ _tweakParams :: IM.IntMap TweakParam
|
||||
, _tweakSel :: Int
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON ItemTweaks where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ItemTweaks
|
||||
data TweakType = TweakPhaseV
|
||||
| TweakTractionPower
|
||||
| TweakSpinDrag
|
||||
@@ -24,3 +35,4 @@ instance ToJSON TweakParam where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON TweakParam
|
||||
makeLenses ''TweakParam
|
||||
makeLenses ''ItemTweaks
|
||||
|
||||
+50
-45
@@ -1,75 +1,80 @@
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
module Dodge.Data.Item.Use
|
||||
( module Dodge.Data.Item.Use
|
||||
, module Dodge.Data.Equipment
|
||||
)
|
||||
where
|
||||
import GHC.Generics
|
||||
import Data.Aeson
|
||||
import Dodge.Data.Item.HeldUse
|
||||
import Dodge.Data.Item.HeldScroll
|
||||
import Dodge.Data.Item.UseDelay
|
||||
import Dodge.Data.Hammer
|
||||
import Dodge.Data.Equipment
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
|
||||
module Dodge.Data.Item.Use (
|
||||
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,
|
||||
) where
|
||||
|
||||
import Control.Lens
|
||||
import Data.Aeson
|
||||
import Dodge.Data.Hammer
|
||||
import Dodge.Data.Item.HeldScroll
|
||||
import Dodge.Data.Item.HeldUse
|
||||
import Dodge.Data.Item.Use.Equipment
|
||||
import Dodge.Data.Item.UseDelay
|
||||
import GHC.Generics
|
||||
|
||||
data ItemUse
|
||||
= RightUse
|
||||
{ _rUse :: HeldUse -- Item -> Creature -> World -> World
|
||||
, _useDelay :: UseDelay
|
||||
, _useMods :: HeldMod --[(Item -> Creature -> World -> World) -> Item -> Creature -> World -> World]
|
||||
, _useHammer :: HammerPosition
|
||||
, _useAim :: AimParams
|
||||
, _heldScroll :: HeldScroll --Float -> Creature -> Item -> Item
|
||||
= RightUse
|
||||
{ _rUse :: HeldUse
|
||||
, _useDelay :: UseDelay
|
||||
, _useMods :: HeldMod
|
||||
, _useHammer :: HammerPosition
|
||||
, _useAim :: AimParams
|
||||
, _heldScroll :: HeldScroll
|
||||
}
|
||||
| LeftUse
|
||||
{ _lUse :: Luse --Item -> Creature -> World -> World
|
||||
, _useDelay :: UseDelay
|
||||
, _useHammer :: HammerPosition
|
||||
, _eqEq :: Equipment
|
||||
| LeftUse
|
||||
{ _lUse :: Luse
|
||||
, _useDelay :: UseDelay
|
||||
, _useHammer :: HammerPosition
|
||||
, _eqEq :: Equipment
|
||||
}
|
||||
| ConsumeUse
|
||||
{ _cUse :: Cuse --Item -> Creature -> World -> World
|
||||
| ConsumeUse
|
||||
{ _cUse :: Cuse
|
||||
}
|
||||
| EquipUse
|
||||
| EquipUse
|
||||
{ _eqEq :: Equipment
|
||||
}
|
||||
| NoUse
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON ItemUse where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ItemUse
|
||||
data AimParams = AimParams
|
||||
{ _aimWeight :: Int
|
||||
, _aimRange :: Float
|
||||
, _aimZoom :: ItZoom
|
||||
, _aimStance :: AimStance
|
||||
{ _aimWeight :: Int
|
||||
, _aimRange :: Float
|
||||
, _aimZoom :: ItZoom
|
||||
, _aimStance :: AimStance
|
||||
, _aimHandlePos :: Float
|
||||
, _aimMuzPos :: Float
|
||||
, _aimMuzPos :: Float
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON AimParams where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON AimParams where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON AimParams
|
||||
instance FromJSON AimParams
|
||||
data AimStance
|
||||
= TwoHandTwist
|
||||
| TwoHandFlat
|
||||
| OneHand
|
||||
| LeaveHolstered
|
||||
deriving (Eq,Show,Ord,Enum,Read,Generic)
|
||||
deriving (Eq, Show, Ord, Enum, Read, Generic)
|
||||
instance ToJSON AimStance where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON AimStance
|
||||
data ItZoom = ItZoom
|
||||
{ _itZoomMax :: Float
|
||||
, _itZoomMin :: Float
|
||||
, _itZoomFac :: Float
|
||||
data ItZoom = ItZoom
|
||||
{ _itZoomMax :: Float
|
||||
, _itZoomMin :: Float
|
||||
, _itZoomFac :: Float
|
||||
}
|
||||
deriving (Eq,Ord,Show,Read,Generic)
|
||||
instance ToJSON ItZoom where
|
||||
deriving (Eq, Ord, Show, Read, Generic)
|
||||
instance ToJSON ItZoom where
|
||||
toEncoding = genericToEncoding defaultOptions
|
||||
instance FromJSON ItZoom
|
||||
instance FromJSON ItZoom
|
||||
makeLenses ''ItemUse
|
||||
makeLenses ''AimParams
|
||||
makeLenses ''ItZoom
|
||||
|
||||
@@ -1,9 +1,9 @@
|
||||
{-# LANGUAGE TemplateHaskell #-}
|
||||
{-# LANGUAGE StrictData #-}
|
||||
{-# LANGUAGE DeriveGeneric #-}
|
||||
module Dodge.Data.Equipment
|
||||
module Dodge.Data.Item.Use.Equipment
|
||||
( module Dodge.Data.Equipment.Misc
|
||||
, module Dodge.Data.Equipment
|
||||
, module Dodge.Data.Item.Use.Equipment
|
||||
)
|
||||
where
|
||||
import Dodge.Data.Item.HeldUse
|
||||
Reference in New Issue
Block a user