File: Response.hs

package info (click to toggle)
haskell-lambdahack 0.11.0.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 4,056 kB
  • sloc: haskell: 45,636; makefile: 219
file content (35 lines) | stat: -rw-r--r-- 1,248 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
-- | Abstract syntax of responses.
--
-- See
-- <https://github.com/LambdaHack/LambdaHack/wiki/Client-server-architecture>.
module Game.LambdaHack.Client.Response
  ( Response(..)
  ) where

import Prelude ()

import Game.LambdaHack.Core.Prelude

import Game.LambdaHack.Atomic
import Game.LambdaHack.Common.State
import Game.LambdaHack.Common.Types

-- | Abstract syntax of responses sent by server to an AI or UI client
-- (or a universal client that can handle both roles, which is why
-- this type is not separated into distinct AI and UI types).
-- A response tells a client how to update game state or what information
-- to send to the server.
data Response =
    RespUpdAtomicNoState UpdAtomic
    -- ^ change @State@ by performing this atomic update
  | RespUpdAtomic State UpdAtomic
    -- ^ put the given @State@, which results from performing the atomic update
  | RespQueryAI ActorId
    -- ^ compute an AI move for the actor and send (the semantics of) it
  | RespSfxAtomic SfxAtomic
    -- ^ perform special effects (animations, messages, etc.)
  | RespQueryUIunderAI
    -- ^ check if the UI client wants to regain control
  | RespQueryUI
    -- ^ prompt the human player for a command and send (the semantics of) it
  deriving Show