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

Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Server.MonadServer

Contents

Description

Basic server monads and related operations.

Synopsis

The server monad

class MonadStateRead m => MonadServer m where #

Methods

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

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

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

liftIO :: IO a -> m a #

class MonadServer m => MonadServerAtomic m where #

The monad for executing atomic game state transformations.

Methods

execUpdAtomic :: UpdAtomic -> m () #

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

execUpdAtomicSer :: UpdAtomic -> m Bool #

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

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

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

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

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 () #

Execute an atomic command that only displays special effects.

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

Assorted primitives

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

saveServer :: MonadServer m => m () #

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

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

restoreScore :: forall m. MonadServer m => COps -> m ScoreDict #

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

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

Generate a new score, register it and save.

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

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

getSetGen :: MonadServer m => Maybe StdGen -> m StdGen #

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