Safe Haskell | None |
---|---|
Language | Haskell2010 |
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 RequestAnyAbility)
- handleRequestUI :: MonadServerAtomic m => FactionId -> ActorId -> ReqUI -> m (Maybe RequestAnyAbility)
- handleRequestTimed :: MonadServerAtomic m => FactionId -> ActorId -> RequestTimed a -> m Bool
- switchLeader :: MonadServerAtomic m => FactionId -> ActorId -> m ()
- reqMove :: MonadServerAtomic m => ActorId -> Vector -> m ()
- reqDisplace :: MonadServerAtomic m => ActorId -> ActorId -> m ()
- reqAlterFail :: MonadServerAtomic m => ActorId -> Point -> m (Maybe ReqFailure)
- reqGameDropAndExit :: MonadServerAtomic m => ActorId -> m ()
- reqGameSaveAndExit :: MonadServerAtomic m => ActorId -> m ()
- setBWait :: MonadServerAtomic m => RequestTimed a -> ActorId -> Actor -> m (Maybe Bool)
- managePerRequest :: MonadServerAtomic m => ActorId -> m ()
- handleRequestTimedCases :: MonadServerAtomic m => ActorId -> RequestTimed a -> m ()
- affectSmell :: MonadServerAtomic m => ActorId -> m ()
- reqMelee :: MonadServerAtomic m => ActorId -> ActorId -> ItemId -> CStore -> m ()
- reqAlter :: MonadServerAtomic m => ActorId -> Point -> m ()
- reqWait :: MonadServerAtomic m => ActorId -> m ()
- reqMoveItems :: MonadServerAtomic m => ActorId -> [(ItemId, Int, CStore, CStore)] -> m ()
- reqMoveItem :: MonadServerAtomic m => ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m ()
- computeRndTimeout :: Time -> ItemFull -> Rnd (Maybe Time)
- 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 ()
- reqTactic :: MonadServerAtomic m => FactionId -> Tactic -> m ()
- reqAutomate :: MonadServerAtomic m => FactionId -> m ()
Documentation
handleRequestAI :: MonadServerAtomic m => ReqAI -> m (Maybe RequestAnyAbility) Source #
The semantics of server commands. AI always takes time and so doesn't loop.
handleRequestUI :: MonadServerAtomic m => FactionId -> ActorId -> ReqUI -> m (Maybe RequestAnyAbility) Source #
The semantics of server commands. Only the first two cases affect time.
handleRequestTimed :: MonadServerAtomic m => FactionId -> ActorId -> RequestTimed a -> m Bool Source #
switchLeader :: MonadServerAtomic m => FactionId -> ActorId -> m () Source #
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.
reqAlterFail :: MonadServerAtomic m => ActorId -> Point -> m (Maybe ReqFailure) Source #
reqGameDropAndExit :: MonadServerAtomic m => ActorId -> m () Source #
reqGameSaveAndExit :: MonadServerAtomic m => ActorId -> m () Source #
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.
handleRequestTimedCases :: MonadServerAtomic m => ActorId -> RequestTimed a -> m () Source #
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.
reqWait :: MonadServerAtomic m => ActorId -> m () Source #
Do nothing.
Something is sometimes done in setBWait
.
reqMoveItems :: MonadServerAtomic m => ActorId -> [(ItemId, Int, CStore, CStore)] -> m () Source #
reqMoveItem :: MonadServerAtomic m => ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m () Source #
:: 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 #
reqAutomate :: MonadServerAtomic m => FactionId -> m () Source #