LambdaHack-0.2.10.5: A roguelike game engine in early and active development

Safe HaskellNone

Game.LambdaHack.Server.ServerSem

Contents

Description

Semantics of CmdSer server commands. 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. TODO: document

Synopsis

Documentation

MoveSer

addSmell :: MonadAtomic m => ActorId -> m ()Source

Add a smell trace for the actor to the level. For now, all and only actors from non-spawning factions leave smell.

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

MeleeSer

meleeSer :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> 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.

DisplaceSer

displaceSer :: (MonadAtomic m, MonadServer m) => ActorId -> ActorId -> m ()Source

Actor tries to swap positions with another.

AlterSer

alterSer :: (MonadAtomic m, MonadServer m) => ActorId -> Point -> Maybe Feature -> m ()Source

Search and/or alter the tile.

Note that if serverTile /= freshClientTile, freshClientTile should not be alterable (but serverTile may be).

WaitSer

waitSer :: MonadAtomic m => ActorId -> m ()Source

Update the wait/block count. Uses local, per-level time, to remain correct even if the level is frozen for some global time turns.

PickupSer

DropSer

ProjectSer

projectSerSource

Arguments

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

-> Container

whether the items comes from floor or inventory

-> m () 

projectBlaSource

Arguments

:: (MonadAtomic m, MonadServer m) 
=> ActorId

actor projecting the item (is on current lvl)

-> Point

starting point of the projectile

-> [Point]

rest of the path of the projectile

-> ItemId

the item to be projected

-> Container

whether the items comes from floor or inventory

-> m () 

addProjectile :: (MonadAtomic m, MonadServer m) => Point -> [Point] -> ItemId -> LevelId -> FactionId -> Time -> m ActorIdSource

Create a projectile actor containing the given missile.

ApplySer

applySerSource

Arguments

:: (MonadAtomic m, MonadServer m) 
=> ActorId

actor applying the item (is on current level)

-> ItemId

the item to be applied

-> Container

the location of the item

-> m () 

TriggerSer

triggerSer :: (MonadAtomic m, MonadServer m) => ActorId -> Maybe Feature -> m ()Source

Perform the effect specified for the tile in case it's triggered.

SetPathSer

GameRestart

GameExit

GameSaveSer