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

Safe HaskellNone




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




moveSer :: (MonadAtomic m, MonadServer m) => ActorId -> Vector -> Bool -> m BoolSource

Actor moves or attacks or searches or opens doors. Note that client can't determine which of these actions is chosen, because foes can be invisible, doors hidden, clients can move simultaneously during the same turn, 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.

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.

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

actorOpenDoor :: (MonadAtomic m, MonadServer m) => ActorId -> Vector -> Bool -> m BoolSource

An actor opens a door.


runSer :: (MonadAtomic m, MonadServer m) => ActorId -> Vector -> m BoolSource

Actor moves or swaps position with others or opens doors.

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

When an actor runs (not walks) into another, they switch positions.


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.






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

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

Create a projectile actor containing the given missile.




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

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