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

Game.LambdaHack.Server.HandleRequestM

Contents

Description

Semantics of requests . A couple of them do not take time, the rest does. Note that since the results are atomic commands, which are executed only later (on the server and some of the clients), all condition are checkd by the semantic functions in the context of the state before the server command. Even if one or more atomic actions are already issued by the point an expression is evaluated, they do not influence the outcome of the evaluation.

Synopsis

# Documentation

The semantics of server commands. AI always takes time and so doesn't loop.

The semantics of server commands. Only the first two cases affect time.

reqMove :: MonadServerAtomic m => ActorId -> Vector -> m () Source #

Actor moves or attacks. Note that client may not be able to see an invisible monster so it's the server that determines if melee took place, etc. Also, only the server is authorized to check if a move is legal and it needs full context for that, e.g., the initial actor position to check if melee attack does not try to reach to a distant tile.

reqDisplace :: MonadServerAtomic m => ActorId -> ActorId -> m () Source #

Actor tries to swap positions with another.

# Internal operations

setBWait :: MonadServerAtomic m => RequestTimed a -> ActorId -> Actor -> m (Maybe Bool) Source #

This is a shorthand. Instead of setting bwait in ReqWait and unsetting in all other requests, we call this once before executing a request.

managePerRequest :: MonadServerAtomic m => ActorId -> m () Source #

Clear deltas for Calm and HP for proper UI display and AI hints.

affectSmell :: MonadServerAtomic m => ActorId -> m () Source #

Add a smell trace for the actor to the level. For now, only actors with gender leave strong and unique enough smell. If smell already there and the actor can smell, remove smell. Projectiles are ignored. As long as an actor can smell, he doesn't leave any smell ever.

reqMelee :: MonadServerAtomic m => ActorId -> ActorId -> ItemId -> CStore -> m () Source #

Resolves the result of an actor moving into another. Actors on unwalkable positions can be attacked without any restrictions. For instance, an actor embedded in a wall can be attacked from an adjacent position. This function is analogous to projectGroupItem, but for melee and not using up the weapon. No problem if there are many projectiles at the spot. We just attack the one specified.

reqAlter :: MonadServerAtomic m => ActorId -> Point -> m () Source #

Search and/or alter the tile.

reqWait :: MonadServerAtomic m => ActorId -> m () Source #

Do nothing.

Something is sometimes done in setBWait.

Arguments

 :: MonadServerAtomic m => ActorId actor projecting the item (is on current lvl) -> Point target position of the projectile -> Int digital line parameter -> ItemId the item to be projected -> CStore whether the items comes from floor or inventory -> m ()

Arguments

 :: MonadServerAtomic m => ActorId actor applying the item (is on current level) -> ItemId the item to be applied -> CStore the location of the item -> m ()