add comments to messages
This commit is contained in:
parent
98214fdb38
commit
4ef186dba2
1 changed files with 19 additions and 13 deletions
|
@ -13,16 +13,20 @@ import Library.Types.Player
|
||||||
import Library.Types.Map
|
import Library.Types.Map
|
||||||
|
|
||||||
data ServerMessage
|
data ServerMessage
|
||||||
= ServerQuit
|
= ServerQuit -- ^ Message notifying a client that the server is about to shut down.
|
||||||
| AcceptClient
|
| Ping -- ^ A servers's heartbeat request
|
||||||
|
{ pingID :: UUID -- ^ The random ID of the heartbeat request. NOT THE CLIENT'S 'UUID'!
|
||||||
|
}
|
||||||
|
| AcceptClient -- ^ Message notifying the client of being accepted and providing it's
|
||||||
|
-- newly registered 'UUID'
|
||||||
{ acClientUUID :: UUID
|
{ acClientUUID :: UUID
|
||||||
}
|
}
|
||||||
| ProvideInitialWizard
|
| ProvideInitialWizard -- ^ Message containing a newly created player character
|
||||||
{ initWizard :: Wizard
|
{ initWizard :: Wizard
|
||||||
}
|
}
|
||||||
| TickUpdate
|
| TickUpdate -- ^ The Server's state update to the clients
|
||||||
{ tuMapSlice :: MapSlice
|
{ tuMapSlice :: MapSlice -- ^ The player's field of vision
|
||||||
, tuWizard :: Wizard
|
, tuWizard :: Wizard -- ^ the player's updated character
|
||||||
}
|
}
|
||||||
deriving (Eq, Show, Generic)
|
deriving (Eq, Show, Generic)
|
||||||
|
|
||||||
|
@ -31,17 +35,19 @@ instance FromJSON ServerMessage
|
||||||
instance ToJSON ServerMessage
|
instance ToJSON ServerMessage
|
||||||
|
|
||||||
data ClientMessagePayload
|
data ClientMessagePayload
|
||||||
= ClientQuit
|
= ClientQuit -- ^ Message notifying the server of a client about to shut down
|
||||||
| ClientRequestWizard
|
| ClientRequestWizard -- ^ Message for requesting a new player character
|
||||||
| ClientReady
|
| ClientReady -- ^ Message requesting the server to position the client's character on the
|
||||||
|
-- map
|
||||||
deriving (Eq, Show, Generic)
|
deriving (Eq, Show, Generic)
|
||||||
|
|
||||||
data ClientMessage
|
data ClientMessage
|
||||||
= ClientMessage
|
= ClientMessage -- ^ A general client message to pass to the serve
|
||||||
{ cmClientID :: UUID
|
{ cmClientID :: UUID -- ^ The client's 'UUID' for identification
|
||||||
, cmPayload :: ClientMessagePayload
|
, cmPayload :: ClientMessagePayload -- ^ The actual message payload
|
||||||
}
|
}
|
||||||
| IdRequest
|
| IdRequest -- ^ A special message to the server for requesting a new
|
||||||
|
-- 'UUID' ad startup
|
||||||
deriving (Eq, Show, Generic)
|
deriving (Eq, Show, Generic)
|
||||||
|
|
||||||
instance FromJSON ClientMessagePayload
|
instance FromJSON ClientMessagePayload
|
||||||
|
|
Loading…
Reference in a new issue