| Safe Haskell | None |
|---|
Game.LambdaHack.Common.State
Description
Server and client game state types and operations.
- data State
- sdungeon :: State -> Dungeon
- sdepth :: State -> Int
- sactorD :: State -> ActorDict
- sitemD :: State -> ItemDict
- sfactionD :: State -> FactionDict
- stime :: State -> Time
- scops :: State -> COps
- shigh :: State -> ScoreTable
- defStateGlobal :: Dungeon -> Int -> FactionDict -> COps -> ScoreTable -> State
- emptyState :: State
- localFromGlobal :: State -> State
- updateDungeon :: (Dungeon -> Dungeon) -> State -> State
- updateDepth :: (Int -> Int) -> State -> State
- updateActorD :: (ActorDict -> ActorDict) -> State -> State
- updateItemD :: (ItemDict -> ItemDict) -> State -> State
- updateFaction :: (FactionDict -> FactionDict) -> State -> State
- updateTime :: (Time -> Time) -> State -> State
- updateCOps :: (COps -> COps) -> State -> State
- getLocalTime :: LevelId -> State -> Time
- isSpawnFaction :: FactionId -> State -> Bool
- isSummonFaction :: FactionId -> State -> Bool
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.
State components
sfactionD :: State -> FactionDict
shigh :: State -> ScoreTable
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..