Safe Haskell | None |
---|
A huge pile of utility functions for building our dungeon.
- modifyRoomState :: MonadRoom m => (RoomState -> RoomState) -> m ()
- getRoomDesc :: (MonadRoom m, MonadAtoms m) => m String
- getRoomTitle :: (MonadRoom m, IsText t) => m t
- setRoomTitle :: (MonadRoom m, IsText t) => t -> m ()
- markRoom :: MonadDungeon m => m ()
- enterRoom :: NodeId -> ChattyDungeonM Bool
- reenterCurrentRoom :: ChattyDungeonM ()
- enterAndAnnounce :: NodeId -> ChattyDungeonM ()
- changeRoom :: Direction -> ChattyDungeonM ()
- constructRoom :: (Monad m, MonadDungeon (t m), MonadTrans t) => RoomT m a -> t m NodeId
- establishWay :: MonadDungeon m => NodeId -> NodeId -> Direction -> m ()
- addRoomObject :: (MonadCounter m, MonadRoom m) => ObjectT m a -> m ObjectId
- removeRoomObject :: MonadRoom m => ObjectId -> m ObjectState
- insertRoomObject :: MonadRoom m => ObjectState -> m ()
- modifyObjectState :: MonadObject m => (ObjectState -> ObjectState) -> m ()
- setObjectDesc :: (MonadObject m, IsText t) => t -> m ()
- setObjectTitle :: (MonadObject m, IsText t) => t -> m ()
- addObjectName :: MonadObject m => String -> m ()
- addObjectAttr :: MonadObject m => String -> m ()
- setObjectIsMob :: MonadObject m => Bool -> m ()
- setObjectIsAcquirable :: MonadObject m => Bool -> m ()
- addNearImplication :: MonadObject m => Implication -> m ()
- addCarryImplication :: MonadObject m => Implication -> m ()
- addWearImplication :: MonadObject m => Implication -> m ()
- addDescSeg :: (MonadObject m, MonadAtoms m) => String -> m ()
- registerForm :: MonadAtoms m => ObjectT m () -> m (Atom ObjectState)
- instanciateForm :: (MonadAtoms m, MonadRoom m, MonadCounter m) => Atom ObjectState -> m ObjectId
- getObjectTitle :: (MonadObject m, IsText t) => m t
- getObjectDesc :: (MonadObject m, IsText t) => m t
- getObjectNames :: MonadObject m => m [String]
- matchObjectName :: MonadObject m => String -> m Bool
- getObjectIsMob :: (MonadObject m, Functor m) => m Bool
- getObjectIsAcquirable :: (MonadObject m, Functor m) => m Bool
- roomOfObject :: MonadDungeon m => ObjectId -> m [NodeId]
- setMobRoute :: MonadObject m => [NodeId] -> m ()
- continueMobRoute :: ObjectId -> Trigger
- schedule :: (MonadDungeon m, MonadClock m) => Integer -> Trigger -> m ()
- subscribePlayer :: (MonadDungeon (t m), MonadTrans t, Monad m) => PlayerT m a -> t m ()
- modifyPlayerState :: MonadPlayer m => (PlayerState -> PlayerState) -> m ()
- setPlayerRoom :: MonadPlayer m => NodeId -> m ()
- acquireObject :: ObjectId -> ChattyDungeonM ()
- dropObject :: ObjectId -> ChattyDungeonM ()
- withRoom :: MonadDungeon m => NodeId -> RoomT m a -> m a
- guardVisible :: MonadDungeon m => NodeId -> m () -> m ()
Room modification
modifyRoomState :: MonadRoom m => (RoomState -> RoomState) -> m ()Source
Modify the room state.
getRoomDesc :: (MonadRoom m, MonadAtoms m) => m StringSource
Get the current room's description
getRoomTitle :: (MonadRoom m, IsText t) => m tSource
Get the current room's title
setRoomTitle :: (MonadRoom m, IsText t) => t -> m ()Source
Set the current room's description setRoomDesc :: (MonadRoom m,IsText t) => t -> m () setRoomDesc t = modifyRoomState $ s -> s{roomDescOf=toText t}
Set the current room's title
markRoom :: MonadDungeon m => m ()Source
Mark the current room as visited
Moving around
enterRoom :: NodeId -> ChattyDungeonM BoolSource
Enter the given room and trigger most events, but don't announce it. Result tells whether this room is visited the first time.
reenterCurrentRoom :: ChattyDungeonM ()Source
Reenter the current room and trigger all events (but don't announce it).
enterAndAnnounce :: NodeId -> ChattyDungeonM ()Source
Enter the given room, trigger all events and announce it. On the first visit, look around.
changeRoom :: Direction -> ChattyDungeonM ()Source
Enter a neighbouring room by its direction.
Room construction
constructRoom :: (Monad m, MonadDungeon (t m), MonadTrans t) => RoomT m a -> t m NodeIdSource
Construct a new room using the room monad.
establishWay :: MonadDungeon m => NodeId -> NodeId -> Direction -> m ()Source
Establish a path from one room to another one (one-way only).
addRoomObject :: (MonadCounter m, MonadRoom m) => ObjectT m a -> m ObjectIdSource
Add a new object to the current room. It is contructed using the object monad.
removeRoomObject :: MonadRoom m => ObjectId -> m ObjectStateSource
Remove an object from the current room and return its state.
insertRoomObject :: MonadRoom m => ObjectState -> m ()Source
Insert an already constructed object to the current room.
Object construction
modifyObjectState :: MonadObject m => (ObjectState -> ObjectState) -> m ()Source
Modify the object state
setObjectDesc :: (MonadObject m, IsText t) => t -> m ()Source
Set the object's description
setObjectTitle :: (MonadObject m, IsText t) => t -> m ()Source
Set the object's title
addObjectName :: MonadObject m => String -> m ()Source
Add a name for the current object
addObjectAttr :: MonadObject m => String -> m ()Source
Add an attribute for the current object
setObjectIsMob :: MonadObject m => Bool -> m ()Source
Set whether the current object is a mob.
setObjectIsAcquirable :: MonadObject m => Bool -> m ()Source
Set whether the current object is acquirable.
addNearImplication :: MonadObject m => Implication -> m ()Source
Add an implication to the current object that is valid for all players in the room
addCarryImplication :: MonadObject m => Implication -> m ()Source
Add an implication to the current object that is valid for all carrying players
addWearImplication :: MonadObject m => Implication -> m ()Source
Add an implication to the current object that is valid for all wearing players
addDescSeg :: (MonadObject m, MonadAtoms m) => String -> m ()Source
Add a room description segment to the current object
Object forms
registerForm :: MonadAtoms m => ObjectT m () -> m (Atom ObjectState)Source
Register an object form and return its atom
instanciateForm :: (MonadAtoms m, MonadRoom m, MonadCounter m) => Atom ObjectState -> m ObjectIdSource
Instanciate a registered form
Object investigation
getObjectTitle :: (MonadObject m, IsText t) => m tSource
Get the object's title
getObjectDesc :: (MonadObject m, IsText t) => m tSource
Get the object's description
getObjectNames :: MonadObject m => m [String]Source
Get the object's names
matchObjectName :: MonadObject m => String -> m BoolSource
Check if the given name matches our current object
getObjectIsMob :: (MonadObject m, Functor m) => m BoolSource
Check if the current object is a mob.
getObjectIsAcquirable :: (MonadObject m, Functor m) => m BoolSource
Check if the current object is acquirable.
roomOfObject :: MonadDungeon m => ObjectId -> m [NodeId]Source
Determine which rooms contain the given object (won't be more than one, but we're careful)
Object actions
setMobRoute :: MonadObject m => [NodeId] -> m ()Source
Set the current mob's route
continueMobRoute :: ObjectId -> TriggerSource
The given object may continue its route
Scheduling
schedule :: (MonadDungeon m, MonadClock m) => Integer -> Trigger -> m ()Source
Schedule an event for a given time offset (in milliseconds).
Players
subscribePlayer :: (MonadDungeon (t m), MonadTrans t, Monad m) => PlayerT m a -> t m ()Source
Create a new player using the player monad
modifyPlayerState :: MonadPlayer m => (PlayerState -> PlayerState) -> m ()Source
Modify the player state
setPlayerRoom :: MonadPlayer m => NodeId -> m ()Source
Move the current player to the given room, but don't trigger anything.
acquireObject :: ObjectId -> ChattyDungeonM ()Source
Acquire the given object and put it in the player's inventory
dropObject :: ObjectId -> ChattyDungeonM ()Source
Drop the given object and remove it from the player's inventory
Masquerades
withRoom :: MonadDungeon m => NodeId -> RoomT m a -> m aSource
Run a function in the context of the given room.
guardVisible :: MonadDungeon m => NodeId -> m () -> m ()Source
Only run the given function if the player is inside the also given room.