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

Safe HaskellNone

Game.LambdaHack.Common.State

Contents

Description

Server and client game state types and operations.

Synopsis

Basic game state, local or global

data State

View on game state. Remembered fields carry a subset of the info in the client copies of the state. Clients never directly change their State, but apply atomic actions sent by the server to do so.

Instances

Eq State 
Show State 
Binary State 

State components

State operations

defStateGlobal :: Dungeon -> Int -> FactionDict -> COps -> ScoreTable -> State

Initial complete global game state.

emptyState :: State

Initial empty state.

localFromGlobal :: State -> State

Local state created by removing secret information from global state components.

updateDungeon :: (Dungeon -> Dungeon) -> State -> State

Update dungeon data within state.

updateDepth :: (Int -> Int) -> State -> State

Update dungeon depth.

updateActorD :: (ActorDict -> ActorDict) -> State -> State

Update the actor dictionary.

updateItemD :: (ItemDict -> ItemDict) -> State -> State

Update the item dictionary.

updateFaction :: (FactionDict -> FactionDict) -> State -> State

Update faction data within state.

updateTime :: (Time -> Time) -> State -> State

Update global time within state.

updateCOps :: (COps -> COps) -> State -> State

Update content data within state.

getLocalTime :: LevelId -> State -> Time

Get current time from the dungeon data.

isSpawnFaction :: FactionId -> State -> Bool

Tell whether the faction can spawn actors.

isSummonFaction :: FactionId -> State -> Bool

Tell whether actors of the faction can be summoned by items, etc..