LambdaHack-0.11.0.1: A game engine library for tactical squad ASCII roguelike dungeon crawlers

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Server.MonadServer

Contents

- The server monad
- Assorted primitives

Description

Basic server monads and related operations.

Synopsis

- class MonadStateRead m => MonadServer (m :: Type -> Type) where
  - getsServer :: (StateServer -> a) -> m a
  - modifyServer :: (StateServer -> StateServer) -> m ()
  - chanSaveServer :: m (ChanSave (State, StateServer))
  - liftIO :: IO a -> m a
- class MonadServer m => MonadServerAtomic (m :: Type -> Type) where
  - execUpdAtomic :: UpdAtomic -> m ()
  - execUpdAtomicSer :: UpdAtomic -> m Bool
  - execUpdAtomicFid :: FactionId -> UpdAtomic -> m ()
  - execUpdAtomicFidCatch :: FactionId -> UpdAtomic -> m Bool
  - execSfxAtomic :: SfxAtomic -> m ()
  - execSendPer :: FactionId -> LevelId -> Perception -> Perception -> Perception -> m ()
- getServer :: MonadServer m => m StateServer
- putServer :: MonadServer m => StateServer -> m ()
- debugPossiblyPrint :: MonadServer m => Text -> m ()
- debugPossiblyPrintAndExit :: MonadServer m => Text -> m ()
- serverPrint :: MonadServer m => Text -> m ()
- saveServer :: MonadServer m => m ()
- dumpRngs :: MonadServer m => RNGs -> m ()
- restoreScore :: MonadServer m => COps -> m ScoreDict
- registerScore :: MonadServer m => Status -> FactionId -> m ()
- rndToAction :: MonadServer m => Rnd a -> m a
- getSetGen :: MonadServer m => Maybe SMGen -> m SMGen

# The server monad

class MonadStateRead m => MonadServer (m :: Type -> Type) where Source #

Methods

getsServer :: (StateServer -> a) -> m a Source #

modifyServer :: (StateServer -> StateServer) -> m () Source #

chanSaveServer :: m (ChanSave (State, StateServer)) Source #

liftIO :: IO a -> m a Source #

#### Instances

Instances details

MonadServer SerImplementation Source # |
Instance details Defined in Implementation.MonadServerImplementation Methods getsServer :: (StateServer -> a) -> SerImplementation a Source # modifyServer :: (StateServer -> StateServer) -> SerImplementation () Source # chanSaveServer :: SerImplementation (ChanSave (State, StateServer)) Source # liftIO :: IO a -> SerImplementation a Source #

class MonadServer m => MonadServerAtomic (m :: Type -> Type) where Source #

The monad for executing atomic game state transformations.

Methods

execUpdAtomic :: UpdAtomic -> m () Source #

Execute an atomic command that changes the state on the server and on all clients that can notice it.

execUpdAtomicSer :: UpdAtomic -> m Bool Source #

Execute an atomic command that changes the state on the server only.

execUpdAtomicFid :: FactionId -> UpdAtomic -> m () Source #

Execute an atomic command that changes the state on the given single client only.

execUpdAtomicFidCatch :: FactionId -> UpdAtomic -> m Bool Source #

Execute an atomic command that changes the state on the given single client only. Catch `AtomicFail` and indicate if it was in fact raised.

execSfxAtomic :: SfxAtomic -> m () Source #

Execute an atomic command that only displays special effects.

execSendPer :: FactionId -> LevelId -> Perception -> Perception -> Perception -> m () Source #

#### Instances

Instances details

MonadServerAtomic SerImplementation Source # |

Instance details

Defined in Implementation.MonadServerImplementation

Methods

execUpdAtomic :: UpdAtomic -> SerImplementation () Source #

execUpdAtomicSer :: UpdAtomic -> SerImplementation Bool Source #

execUpdAtomicFid :: FactionId -> UpdAtomic -> SerImplementation () Source #

execUpdAtomicFidCatch :: FactionId -> UpdAtomic -> SerImplementation Bool Source #

execSfxAtomic :: SfxAtomic -> SerImplementation () Source #

execSendPer :: FactionId -> LevelId -> Perception -> Perception -> Perception -> SerImplementation () Source #

# Assorted primitives

getServer :: MonadServer m => m StateServer Source #

putServer :: MonadServer m => StateServer -> m () Source #

debugPossiblyPrint :: MonadServer m => Text -> m () Source #

debugPossiblyPrintAndExit :: MonadServer m => Text -> m () Source #

serverPrint :: MonadServer m => Text -> m () Source #

saveServer :: MonadServer m => m () Source #

dumpRngs :: MonadServer m => RNGs -> m () Source #

Dumps to stdout the RNG states from the start of the game.

restoreScore :: MonadServer m => COps -> m ScoreDict Source #

Read the high scores dictionary. Return the empty table if no file.

registerScore :: MonadServer m => Status -> FactionId -> m () Source #

Generate a new score, register it and save.

rndToAction :: MonadServer m => Rnd a -> m a Source #

Invoke pseudo-random computation with the generator kept in the state.

getSetGen :: MonadServer m => Maybe SMGen -> m SMGen Source #

Gets a random generator from the user-submitted options or, if not present, generates one.