LambdaHack-0.2.12: A roguelike game engine in early and active development

Safe HaskellNone

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

sundo :: ![Atomic]

atomic commands performed to date

sdisco :: !Discovery

remembered item discoveries

sfper :: !FactionPers

faction perception indexed by levels

srandom :: !StdGen

current random generator

sconfigUI :: ConfigUI

client config (including initial RNG)

slastKey :: !(Maybe KM)

last command key pressed

slastRecord :: !LastRecord

state of key sequence recording

slastPlay :: ![KM]

state of key sequence playback

slastCmd :: !(Maybe CmdTakeTimeSer)

last command sent to the server

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

sdebugCli :: !DebugModeCli

client debugging mode

defStateClient :: History -> ConfigUI -> FactionId -> Bool -> StateClientSource

Initial game client state.

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

Update target parameters within client state.

getTarget :: ActorId -> StateClient -> Maybe TargetSource

Get target parameters from client state.

updateLeader :: ActorId -> State -> StateClient -> StateClientSource

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