| Safe Haskell | None |
|---|---|
| Language | Haskell2010 |
Game.LambdaHack.Common.State
Contents
Description
The common server and client basic game state type and its operations.
Synopsis
- data State
- sdungeon :: State -> Dungeon
- stotalDepth :: State -> AbsDepth
- sactorD :: State -> ActorDict
- sitemD :: State -> ItemDict
- sitemIxMap :: State -> ItemIxMap
- sfactionD :: State -> FactionDict
- stime :: State -> Time
- scops :: State -> COps
- sgold :: State -> Int
- shigh :: State -> ScoreDict
- sgameModeId :: State -> ContentId ModeKind
- sdiscoKind :: State -> DiscoveryKind
- sdiscoAspect :: State -> DiscoveryAspect
- sactorAspect :: State -> ActorAspect
- defStateGlobal :: Dungeon -> AbsDepth -> FactionDict -> COps -> ScoreDict -> ContentId ModeKind -> DiscoveryKind -> State
- emptyState :: State
- localFromGlobal :: State -> State
- updateDungeon :: (Dungeon -> Dungeon) -> State -> State
- updateDepth :: (AbsDepth -> AbsDepth) -> State -> State
- updateActorD :: (ActorDict -> ActorDict) -> State -> State
- updateItemD :: (ItemDict -> ItemDict) -> State -> State
- updateItemIxMap :: (ItemIxMap -> ItemIxMap) -> State -> State
- updateFactionD :: (FactionDict -> FactionDict) -> State -> State
- updateTime :: (Time -> Time) -> State -> State
- updateCOpsAndCachedData :: (COps -> COps) -> State -> State
- updateGold :: (Int -> Int) -> State -> State
- updateDiscoKind :: (DiscoveryKind -> DiscoveryKind) -> State -> State
- updateDiscoAspect :: (DiscoveryAspect -> DiscoveryAspect) -> State -> State
- updateActorAspect :: (ActorAspect -> ActorAspect) -> State -> State
- getItemBody :: ItemId -> State -> Item
- aspectRecordFromItem :: ItemId -> Item -> State -> AspectRecord
- aspectRecordFromIid :: ItemId -> State -> AspectRecord
- aspectRecordFromActor :: Actor -> State -> AspectRecord
- actorAspectInDungeon :: State -> ActorAspect
- unknownLevel :: COps -> ContentId CaveKind -> AbsDepth -> X -> Y -> ([Point], [Point]) -> [Point] -> Int -> Bool -> Level
- unknownTileMap :: ContentId TileKind -> Int -> Int -> TileMap
Basic game state, local or global
View on the basic game state.
The remembered fields, in client copies of the state, carry only
a subset of the full information that the server keeps.
Clients never directly change their State, but apply
atomic actions sent by the server to do so (and/or the server applies
the actions to each client state in turn).
State components
stotalDepth :: State -> AbsDepth #
sitemIxMap :: State -> ItemIxMap #
sfactionD :: State -> FactionDict #
sgameModeId :: State -> ContentId ModeKind #
sdiscoKind :: State -> DiscoveryKind #
sdiscoAspect :: State -> DiscoveryAspect #
sactorAspect :: State -> ActorAspect #
State construction
defStateGlobal :: Dungeon -> AbsDepth -> FactionDict -> COps -> ScoreDict -> ContentId ModeKind -> DiscoveryKind -> 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.
State update
updateFactionD :: (FactionDict -> FactionDict) -> State -> State #
Update faction data within state.
updateCOpsAndCachedData :: (COps -> COps) -> State -> State #
Update content data within state and recompute the cached data.
updateDiscoKind :: (DiscoveryKind -> DiscoveryKind) -> State -> State #
updateDiscoAspect :: (DiscoveryAspect -> DiscoveryAspect) -> State -> State #
updateActorAspect :: (ActorAspect -> ActorAspect) -> State -> State #
State operations
getItemBody :: ItemId -> State -> Item #
aspectRecordFromItem :: ItemId -> Item -> State -> AspectRecord #
aspectRecordFromIid :: ItemId -> State -> AspectRecord #
aspectRecordFromActor :: Actor -> State -> AspectRecord #