Safe Haskell | None |
---|
Game.LambdaHack.Server.Action
Description
Game action monads and basic building blocks for human and computer
player actions. Has no access to the the main action type.
Does not export the liftIO
operation nor a few other implementation
details.
- class MonadActionRO m => MonadServer m where
- getServer :: m StateServer
- getsServer :: (StateServer -> a) -> m a
- modifyServer :: (StateServer -> StateServer) -> m ()
- putServer :: StateServer -> m ()
- saveServer :: m ()
- class MonadServer m => MonadConnServer m
- tryRestore :: MonadServer m => COps -> DebugModeSer -> m (Maybe (State, StateServer))
- updateConn :: (MonadAtomic m, MonadConnServer m) => (FactionId -> ChanFrontend -> ChanServer CmdClientUI CmdSer -> IO ()) -> (FactionId -> ChanServer CmdClientAI CmdTakeTimeSer -> IO ()) -> m ()
- killAllClients :: (MonadAtomic m, MonadConnServer m) => m ()
- speedupCOps :: Bool -> COps -> COps
- sendUpdateAI :: MonadConnServer m => FactionId -> CmdClientAI -> m ()
- sendQueryAI :: MonadConnServer m => FactionId -> ActorId -> m CmdTakeTimeSer
- sendPingAI :: MonadConnServer m => FactionId -> m ()
- sendUpdateUI :: MonadConnServer m => FactionId -> CmdClientUI -> m ()
- sendQueryUI :: MonadConnServer m => FactionId -> ActorId -> m CmdSer
- sendPingUI :: MonadConnServer m => FactionId -> m ()
- debugPrint :: MonadServer m => Text -> m ()
- dumpRngs :: MonadServer m => m ()
- getSetGen :: MonadServer m => Maybe StdGen -> m StdGen
- restoreScore :: MonadServer m => COps -> m ScoreTable
- revealItems :: (MonadAtomic m, MonadServer m) => Maybe FactionId -> Maybe Actor -> m ()
- deduceQuits :: (MonadAtomic m, MonadServer m) => Actor -> Status -> m ()
- rndToAction :: MonadServer m => Rnd a -> m a
- resetSessionStart :: MonadServer m => m ()
- resetGameStart :: MonadServer m => m ()
- elapsedSessionTimeGT :: MonadServer m => Int -> m Bool
- tellAllClipPS :: MonadServer m => m ()
- tellGameClipPS :: MonadServer m => m ()
- resetFidPerception :: MonadServer m => FactionId -> LevelId -> m ()
- getPerFid :: MonadServer m => FactionId -> LevelId -> m Perception
- childrenServer :: MVar [MVar ()]
Action monads
class MonadActionRO m => MonadServer m whereSource
Methods
getServer :: m StateServerSource
getsServer :: (StateServer -> a) -> m aSource
modifyServer :: (StateServer -> StateServer) -> m ()Source
putServer :: StateServer -> m ()Source
saveServer :: m ()Source
Instances
class MonadServer m => MonadConnServer m Source
Instances
tryRestore :: MonadServer m => COps -> DebugModeSer -> m (Maybe (State, StateServer))Source
updateConn :: (MonadAtomic m, MonadConnServer m) => (FactionId -> ChanFrontend -> ChanServer CmdClientUI CmdSer -> IO ()) -> (FactionId -> ChanServer CmdClientAI CmdTakeTimeSer -> IO ()) -> m ()Source
Update connections to the new definition of factions. Connect to clients in old or newly spawned threads that read and write directly to the channels.
killAllClients :: (MonadAtomic m, MonadConnServer m) => m ()Source
speedupCOps :: Bool -> COps -> COpsSource
Compute and insert auxiliary optimized components into game content, to be used in time-critical sections of the code.
Communication
sendUpdateAI :: MonadConnServer m => FactionId -> CmdClientAI -> m ()Source
sendQueryAI :: MonadConnServer m => FactionId -> ActorId -> m CmdTakeTimeSerSource
sendPingAI :: MonadConnServer m => FactionId -> m ()Source
sendUpdateUI :: MonadConnServer m => FactionId -> CmdClientUI -> m ()Source
sendQueryUI :: MonadConnServer m => FactionId -> ActorId -> m CmdSerSource
sendPingUI :: MonadConnServer m => FactionId -> m ()Source
Assorted primitives
debugPrint :: MonadServer m => Text -> m ()Source
dumpRngs :: MonadServer m => m ()Source
Dumps RNG states from the start of the game to a file.
getSetGen :: MonadServer m => Maybe StdGen -> m StdGenSource
Gets a random generator from the arguments or, if not present, generates one.
restoreScore :: MonadServer m => COps -> m ScoreTableSource
Read the high scores table. Return the empty table if no file.
revealItems :: (MonadAtomic m, MonadServer m) => Maybe FactionId -> Maybe Actor -> m ()Source
deduceQuits :: (MonadAtomic m, MonadServer m) => Actor -> Status -> m ()Source
rndToAction :: MonadServer m => Rnd a -> m aSource
Invoke pseudo-random computation with the generator kept in the state.
resetSessionStart :: MonadServer m => m ()Source
resetGameStart :: MonadServer m => m ()Source
elapsedSessionTimeGT :: MonadServer m => Int -> m BoolSource
tellAllClipPS :: MonadServer m => m ()Source
tellGameClipPS :: MonadServer m => m ()Source
resetFidPerception :: MonadServer m => FactionId -> LevelId -> m ()Source
Update the cached perception for the selected level, for a faction. The assumption is the level, and only the level, has changed since the previous perception calculation.
getPerFid :: MonadServer m => FactionId -> LevelId -> m PerceptionSource
childrenServer :: MVar [MVar ()]Source