wizard-wipeout/src-lib/Library/Types.hs

49 lines
1.2 KiB
Haskell
Raw Normal View History

2023-12-10 16:00:50 +00:00
module Library.Types
( module T
, module Library.Types
2023-12-10 16:00:50 +00:00
) where
2023-12-05 04:41:16 +00:00
import Data.Matrix
import Graphics.Vty
2023-12-10 16:00:50 +00:00
import Library.Types.Communication as T
import Library.Types.Player as T
2023-12-05 04:41:16 +00:00
-- | Data object for storing the client's state
data ClientState = ClientState
{ clientVty :: Vty -- ^ Context object for graphics
, clientGameOver :: Bool -- ^ client game over (contestant died)
, clientStop :: Bool -- ^ client shutdown
}
-- | Type synonym for the Map. Translates to a Matrix of 'Tile's
2023-12-07 17:20:28 +00:00
type ServerMap = Matrix Tile
-- | Type synonym for the Map. Translates to a Matrix of 'Maybe Tile's
type ClientMap = Matrix (Maybe Tile)
2023-12-05 04:41:16 +00:00
data Tile
= Air -- ^ walkable area
| Wall -- ^ obstacle
2023-12-07 16:31:28 +00:00
deriving (Show, Eq)
2023-12-05 04:41:16 +00:00
data Arena = Arena
2023-12-07 17:20:28 +00:00
{ arenaMap :: ServerMap
2023-12-05 04:41:16 +00:00
, arenaSpawners :: [Spawner]
}
2023-12-07 16:31:28 +00:00
deriving (Show, Eq)
2023-12-05 04:41:16 +00:00
data Spawner = Spawner
{ spawnerPowerup :: Wand -- ^ Which 'Powerup' is being spawned
, spawnerReloadTime :: Int -- ^ How long does it take for the 'Powerup' to reappear
2023-12-07 21:17:03 +00:00
, spawnerState :: SpawnerState
, spawnerReloadTTL :: Float
2023-12-05 04:41:16 +00:00
, spawnerPosition :: Position -- ^ Position of the `Spawner` on the map
}
2023-12-07 16:31:28 +00:00
deriving (Show, Eq)
2023-12-05 04:41:16 +00:00
2023-12-07 21:17:03 +00:00
data SpawnerState
= SpawnerFull
| SpawnerEmpty
deriving (Eq, Show)