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

Safe Haskell | None
Language | Haskell2010

Game.LambdaHack.Server.HandleRequestM

Contents

- Internal operations

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

- handleRequestAI :: MonadServerAtomic m => ReqAI -> m (Maybe RequestTimed)
- handleRequestUI :: MonadServerAtomic m => FactionId -> ActorId -> ReqUI -> m (Maybe RequestTimed)
- handleRequestTimed :: MonadServerAtomic m => FactionId -> ActorId -> RequestTimed -> m Bool
- switchLeader :: MonadServerAtomic m => FactionId -> ActorId -> m ()
- reqMoveGeneric :: MonadServerAtomic m => Bool -> Bool -> ActorId -> Vector -> m ()
- reqDisplaceGeneric :: MonadServerAtomic m => Bool -> ActorId -> ActorId -> m ()
- reqAlterFail :: MonadServerAtomic m => Bool -> EffToUse -> Bool -> ActorId -> Point -> m (Maybe ReqFailure)
- reqGameDropAndExit :: MonadServerAtomic m => ActorId -> m ()
- reqGameSaveAndExit :: MonadServerAtomic m => ActorId -> m ()
- execFailure :: MonadServerAtomic m => ActorId -> RequestTimed -> ReqFailure -> m ()
- checkWaiting :: RequestTimed -> Maybe Bool
- processWatchfulness :: MonadServerAtomic m => Maybe Bool -> ActorId -> m ()
- affectStash :: MonadServerAtomic m => Actor -> m ()
- managePerRequest :: MonadServerAtomic m => ActorId -> m ()
- handleRequestTimedCases :: MonadServerAtomic m => ActorId -> RequestTimed -> m ()
- affectSmell :: MonadServerAtomic m => ActorId -> m ()
- reqMove :: MonadServerAtomic m => ActorId -> Vector -> m ()
- reqMelee :: MonadServerAtomic m => ActorId -> ActorId -> ItemId -> CStore -> m ()
- reqMeleeChecked :: MonadServerAtomic m => Bool -> ActorId -> ActorId -> ItemId -> CStore -> m ()
- reqDisplace :: MonadServerAtomic m => ActorId -> ActorId -> m ()
- reqAlter :: MonadServerAtomic m => ActorId -> Point -> m ()
- reqWait :: MonadServerAtomic m => ActorId -> m ()
- reqWait10 :: MonadServerAtomic m => ActorId -> m ()
- reqYell :: MonadServerAtomic m => ActorId -> m ()
- reqMoveItems :: MonadServerAtomic m => ActorId -> [(ItemId, Int, CStore, CStore)] -> m ()
- reqMoveItem :: MonadServerAtomic m => Bool -> ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m ()
- reqProject :: MonadServerAtomic m => ActorId -> Point -> Int -> ItemId -> CStore -> m ()
- reqApply :: MonadServerAtomic m => ActorId -> ItemId -> CStore -> m ()
- reqGameRestart :: MonadServerAtomic m => ActorId -> GroupName ModeKind -> Challenge -> m ()
- reqGameSave :: MonadServer m => m ()
- reqDoctrine :: MonadServerAtomic m => FactionId -> Doctrine -> m ()
- reqAutomate :: MonadServerAtomic m => FactionId -> m ()

# 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.

handleRequestTimed :: MonadServerAtomic m => FactionId -> ActorId -> RequestTimed -> m Bool Source #

switchLeader :: MonadServerAtomic m => FactionId -> ActorId -> m () Source #

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

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

reqAlterFail :: MonadServerAtomic m => Bool -> EffToUse -> Bool -> ActorId -> Point -> m (Maybe ReqFailure) Source #

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

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

# Internal operations

execFailure :: MonadServerAtomic m => ActorId -> RequestTimed -> ReqFailure -> m () Source #

checkWaiting :: RequestTimed -> Maybe Bool Source #

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.

affectStash :: MonadServerAtomic m => Actor -> m () Source #

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

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

handleRequestTimedCases :: MonadServerAtomic m => ActorId -> RequestTimed -> m () Source #

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 :: 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.

reqMoveItems :: MonadServerAtomic m => ActorId -> [(ItemId, Int, CStore, CStore)] -> m () Source #

reqMoveItem :: MonadServerAtomic m => Bool -> ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m () Source #

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

reqGameRestart :: MonadServerAtomic m => ActorId -> GroupName ModeKind -> Challenge -> m () Source #

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

reqDoctrine :: MonadServerAtomic m => FactionId -> Doctrine -> m () Source #

reqAutomate :: MonadServerAtomic m => FactionId -> m () Source #