LambdaHack-0.2.14: A roguelike game engine in early development

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Client.State

Description

Server and client game state types and operations.

Synopsis

Documentation

data StateClient Source

Client state, belonging to a single faction. Some of the data, e.g, the history, carries over from game to game, even across playing sessions. Data invariant: if _sleader is Nothing then so is srunning.

Constructors

StateClient 

Fields

stgtMode :: !(Maybe TgtMode)

targeting mode

scursor :: !Target

the common, cursor target

seps :: !Int

a parameter of the tgt digital line

stargetD :: !(EnumMap ActorId (Target, Maybe PathEtc))

targets of our actors in the dungeon

sexplored :: !(EnumSet LevelId)

the set of fully explored levels

sbfsD :: !(EnumMap ActorId (Array BfsDistance, Point, Int, Maybe [Point]))

pathfinding distances for our actors and paths to their targets, if any

sselected :: !(EnumSet ActorId)

the set of currently selected actors

srunning :: !(Maybe RunParams)

parameters of the current run, if any

sreport :: !Report

current messages

shistory :: !History

history of messages

sdisplayed :: !(EnumMap LevelId Time)

moves are displayed up to this time

sundo :: ![CmdAtomic]

atomic commands performed to date

sdisco :: !Discovery

remembered item discoveries

sdiscoAE :: !DiscoAE

remembered aspects and effects of items

sfper :: !FactionPers

faction perception indexed by levels

srandom :: !StdGen

current random generator

slastRecord :: !LastRecord

state of key sequence recording

slastPlay :: ![KM]

state of key sequence playback

swaitTimes :: !Int

player just waited this many times

_sleader :: !(Maybe ActorId)

current picked party leader

_sside :: !FactionId

faction controlled by the client

squit :: !Bool

exit the game loop

sisAI :: !Bool

whether it's an AI client

smarkVision :: !Bool

mark leader and party FOV

smarkSmell :: !Bool

mark smell, if the leader can smell

smarkSuspect :: !Bool

mark suspect features

scurDifficulty :: !Int

current game difficulty level

sslots :: !ItemSlots

map from slots to items

slastSlot :: !SlotChar

last used slot

sgameMode :: !Text

current game mode

sdebugCli :: !DebugModeCli

client debugging mode

defStateClient :: History -> Report -> FactionId -> Bool -> StateClient Source

Initial game client state.

updateTarget :: ActorId -> (Maybe Target -> Maybe Target) -> StateClient -> StateClient Source

Update target parameters within client state.

getTarget :: ActorId -> StateClient -> Maybe Target Source

Get target parameters from client state.

updateLeader :: ActorId -> State -> StateClient -> StateClient Source

Update picked leader within state. Verify actor's faction.

type PathEtc = ([Point], (Point, Int)) Source

newtype TgtMode Source

Current targeting mode of a client.

Constructors

TgtMode 

Fields

tgtLevelId :: LevelId
 

data Target Source

The type of na actor target.

Constructors

TEnemy !ActorId !Bool

target an actor; cycle only trough seen foes, unless the flag is set

TEnemyPos !ActorId !LevelId !Point !Bool

last seen position of the targeted actor

TPoint !LevelId !Point

target a concrete spot

TVector !Vector

target position relative to actor

data RunParams Source

Parameters of the current run.

Constructors

RunParams 

Fields

runLeader :: !ActorId

the original leader from run start

runMembers :: ![ActorId]

the list of actors that take part

runDist :: !Int

distance of the run so far (plus one, if multiple runners)

runStopMsg :: !(Maybe Text)

message with the next stop reason

runInitDir :: !(Maybe Vector)

the direction of the initial step

type LastRecord = ([KM], [KM], Int) Source