LambdaHack- A roguelike game engine in early and active development

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 :: !(Maybe Point)

cursor coordinates

seps :: !Int

a parameter of the tgt digital line

stargetD :: !(EnumMap ActorId Target)

targets of our actors in the dungeon

srunning :: !(Maybe (Vector, Int))

direction and distance of running

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

_sleader :: !(Maybe ActorId)

selected actor

_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

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 selected actor within state. Verify actor's faction.

data TgtMode Source

Current targeting mode of a client.



the player requested targeting mode explicitly


tgtLevelId :: !LevelId

the mode was entered (and will be exited) automatically


tgtLevelId :: !LevelId

data Target Source

The type of na actor target.


TEnemy !ActorId !Point

target an actor with its last seen position

TPos !Point

target a given position