LambdaHack-0.11.0.0: A game engine library for tactical squad ASCII roguelike dungeon crawlers
Safe HaskellNone
LanguageHaskell2010

Game.LambdaHack.Server.HandleRequestM

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

handleRequestAI :: MonadServerAtomic m => ReqAI -> m (Maybe RequestTimed) Source #

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

handleRequestUI :: MonadServerAtomic m => FactionId -> ActorId -> ReqUI -> m (Maybe RequestTimed) Source #

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

Internal operations

processWatchfulness :: MonadServerAtomic m => Maybe Bool -> ActorId -> m () Source #

This is a shorthand. Instead of setting bwatch in ReqWait and unsetting in all other requests, we call this once after executing a request. In game state, we collect the number of server requests pertaining to the actor (the number of actor's "moves"), through which the actor was waiting.

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. 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. Smell trace is never left in water tiles.

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

Actor moves or attacks or alters by bumping. 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.

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.

reqMeleeChecked :: forall m. MonadServerAtomic m => Bool -> ActorId -> ActorId -> ItemId -> CStore -> m () Source #

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

Actor tries to swap positions with another.

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

Search and/or alter the tile.

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

Do nothing. Wait skill 1 required. Bracing requires 2, sleep 3, lurking 4.

Something is sometimes done in processWatchfulness.

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

Do nothing.

Something is sometimes done in processWatchfulness.

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

Yellyawnstretch/taunt. Wakes up (gradually) from sleep. Causes noise heard by enemies on the level even if out of their hearing range.

Governed by the waiting skill (because everyone is supposed to have it). unlike ReqWait, induces overhead.

This is similar to the effect Yell, but always voluntary.

reqProject Source #

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

which store the items comes from

-> m () 

reqApply Source #

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