Safe Haskell | None |
---|---|
Language | Haskell2010 |
Semantics of request. 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.
- handleRequestAI :: MonadAtomic m => ReqAI -> m (Maybe RequestAnyAbility)
- handleRequestUI :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> ReqUI -> m (Maybe RequestAnyAbility)
- switchLeader :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> m ()
- handleRequestTimed :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> RequestTimed a -> m Bool
- reqMove :: (MonadAtomic m, MonadServer m) => ActorId -> Vector -> m ()
- reqDisplace :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> m ()
- reqGameExit :: (MonadAtomic m, MonadServer m) => ActorId -> m ()
- setBWait :: MonadAtomic m => RequestTimed a -> ActorId -> m (Maybe Bool)
- handleRequestTimedCases :: (MonadAtomic m, MonadServer m) => ActorId -> RequestTimed a -> m ()
- affectSmell :: (MonadAtomic m, MonadServer m) => ActorId -> m ()
- reqMelee :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> ItemId -> CStore -> m ()
- reqAlter :: (MonadAtomic m, MonadServer m) => ActorId -> Point -> m ()
- reqWait :: MonadAtomic m => ActorId -> m ()
- reqMoveItems :: (MonadAtomic m, MonadServer m) => ActorId -> [(ItemId, Int, CStore, CStore)] -> m ()
- reqMoveItem :: (MonadAtomic m, MonadServer m) => ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m ()
- computeRndTimeout :: Time -> ItemId -> ItemFull -> Rnd (Maybe Time)
- reqProject :: (MonadAtomic m, MonadServer m) => ActorId -> Point -> Int -> ItemId -> CStore -> m ()
- reqApply :: (MonadAtomic m, MonadServer m) => ActorId -> ItemId -> CStore -> m ()
- reqGameRestart :: (MonadAtomic m, MonadServer m) => ActorId -> GroupName ModeKind -> Challenge -> m ()
- reqGameSave :: MonadServer m => m ()
- reqTactic :: MonadAtomic m => FactionId -> Tactic -> m ()
- reqAutomate :: MonadAtomic m => FactionId -> m ()
Documentation
handleRequestAI :: MonadAtomic m => ReqAI -> m (Maybe RequestAnyAbility) Source #
The semantics of server commands. AI always takes time and so doesn't loop.
handleRequestUI :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> ReqUI -> m (Maybe RequestAnyAbility) Source #
The semantics of server commands. Only the first two cases take time.
switchLeader :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> m () Source #
handleRequestTimed :: (MonadAtomic m, MonadServer m) => FactionId -> ActorId -> RequestTimed a -> m Bool Source #
reqMove :: (MonadAtomic m, MonadServer 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 :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> m () Source #
Actor tries to swap positions with another.
reqGameExit :: (MonadAtomic m, MonadServer m) => ActorId -> m () Source #
Internal operations
setBWait :: MonadAtomic m => RequestTimed a -> ActorId -> 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.
handleRequestTimedCases :: (MonadAtomic m, MonadServer m) => ActorId -> RequestTimed a -> m () Source #
affectSmell :: (MonadAtomic m, MonadServer 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 :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> ItemId -> CStore -> m () Source #
Resolves the result of an actor moving into another. Actors on blocked 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 :: (MonadAtomic m, MonadServer m) => ActorId -> Point -> m () Source #
Search and/or alter the tile.
Note that if serverTile /= freshClientTile
, freshClientTile
should not be alterable (but serverTile
may be).
reqWait :: MonadAtomic m => ActorId -> m () Source #
Do nothing.
Something is sometimes done in setBWait
.
reqMoveItems :: (MonadAtomic m, MonadServer m) => ActorId -> [(ItemId, Int, CStore, CStore)] -> m () Source #
reqMoveItem :: (MonadAtomic m, MonadServer m) => ActorId -> Bool -> (ItemId, Int, CStore, CStore) -> m () Source #
:: (MonadAtomic m, MonadServer 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 () |
:: (MonadAtomic m, MonadServer m) | |
=> ActorId | actor applying the item (is on current level) |
-> ItemId | the item to be applied |
-> CStore | the location of the item |
-> m () |
reqGameRestart :: (MonadAtomic m, MonadServer m) => ActorId -> GroupName ModeKind -> Challenge -> m () Source #
reqGameSave :: MonadServer m => m () Source #
reqAutomate :: MonadAtomic m => FactionId -> m () Source #