LambdaHack- A game engine library for roguelike dungeon crawlers

Safe HaskellNone



Server and client game state types and operations.



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.




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 (Bool, 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

sdiscoKind :: !DiscoveryKind

remembered item discoveries

sdiscoEffect :: !DiscoveryEffect

remembered effects&Co of items

sfper :: !FactionPers

faction perception indexed by levels

srandom :: !StdGen

current random generator

slastKM :: !KM

last issued key command

slastRecord :: !LastRecord

state of key sequence recording

slastPlay :: ![KM]

state of key sequence playback

slastLost :: !(EnumSet ActorId)

actors that just got out of sight

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

scurDiff :: !Int

current game difficulty level

snxtDiff :: !Int

next game difficulty level

sslots :: !ItemSlots

map from slots to items

slastSlot :: !SlotChar

last used slot

slastStore :: !CStore

last used store

sescAI :: !EscAI

just canceled AI control with ESC

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.




tgtLevelId :: LevelId

data RunParams Source

Parameters of the current run.




runLeader :: !ActorId

the original leader from run start

runMembers :: ![ActorId]

the list of actors that take part

runInitial :: !Bool

initial run continuation by any run participant, including run leader

runStopMsg :: !(Maybe Text)

message with the next stop reason

runWaiting :: !Int

waiting for others to move out of the way

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