Cleanup, split CWorld into separate file

This commit is contained in:
2022-07-26 21:19:12 +01:00
parent c2707719fb
commit 6554d219dc
27 changed files with 1049 additions and 911 deletions
+50
View File
@@ -0,0 +1,50 @@
{-# LANGUAGE DeriveGeneric #-}
{-# LANGUAGE TemplateHaskell #-}
{-# LANGUAGE StrictData #-}
module Dodge.Data.Creature.Stance
where
import GHC.Generics
import Data.Aeson
import Geometry.Data
import Control.Lens
data Stance = Stance
{_carriage :: Carriage
,_posture :: Posture
,_strideLength :: Int
}
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Stance where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Stance
data Carriage
= Walking
{ _strideAmount :: Int
, _currentFoot :: FootForward
}
| Standing
| Floating
| Flying
| Boosting Point2
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Carriage where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Carriage
data FootForward
= LeftForward
| RightForward
| WasLeftForward
| WasRightForward
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON FootForward where
toEncoding = genericToEncoding defaultOptions
instance FromJSON FootForward
data Posture = Aiming
| AtEase
deriving (Eq,Ord,Show,Read,Generic)
instance ToJSON Posture where
toEncoding = genericToEncoding defaultOptions
instance FromJSON Posture
makeLenses ''Stance
makeLenses ''Carriage
makeLenses ''Posture