Safe Haskell | None |
---|
A huge pile of utility functions for building our dungeon.
- modifyRoomState :: MonadRoom m => (RoomState -> RoomState) -> m ()
- getRoomDesc :: (MonadRoom m, IsText t) => m t
- getRoomTitle :: (MonadRoom m, IsText t) => m t
- setRoomDesc :: (MonadRoom m, IsText t) => t -> m ()
- setRoomTitle :: (MonadRoom m, IsText t) => t -> m ()
- markRoom :: MonadDungeon m => m ()
- enterRoom :: NodeId -> ChattyDungeonM Bool
- reenterCurrentRoom :: ChattyDungeonM ()
- enterAndAnnounce :: NodeId -> ChattyDungeonM ()
- constructRoom :: (Monad m, MonadDungeon (t m), MonadTrans t) => RoomT m a -> t m NodeId
- withRoom :: MonadDungeon m => NodeId -> RoomT m a -> m a
- establishWay :: MonadDungeon m => NodeId -> NodeId -> Direction -> m ()
- changeRoom :: Direction -> ChattyDungeonM ()
- addRoomObject :: (Monad m, MonadCounter (t m), MonadRoom (t m), MonadTrans t) => ObjectT m a -> t m ObjectId
- removeRoomObject :: MonadRoom m => ObjectId -> m ObjectState
- insertRoomObject :: MonadRoom m => ObjectState -> m ()
- modifyObjectState :: MonadObject m => (ObjectState -> ObjectState) -> m ()
- getObjectTitle :: (MonadObject m, IsText t) => m t
- setObjectTitle :: (MonadObject m, IsText t) => t -> m ()
- getObjectDesc :: (MonadObject m, IsText t) => m t
- setObjectDesc :: (MonadObject m, IsText t) => t -> m ()
- getObjectNames :: MonadObject m => m [String]
- addObjectName :: MonadObject m => String -> m ()
- matchObjectName :: MonadObject m => String -> m Bool
- addObjectAttr :: MonadObject m => String -> 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 ()
- getObjectIsMob :: (MonadObject m, Functor m) => m Bool
- setObjectIsMob :: MonadObject m => Bool -> m ()
- getObjectIsAcquirable :: (MonadObject m, Functor m) => m Bool
- setObjectIsAcquirable :: MonadObject m => Bool -> m ()
- schedule :: (MonadDungeon m, MonadClock m) => Integer -> Trigger -> m ()
- setMobRoute :: MonadObject m => [NodeId] -> m ()
- continueMobRoute :: ObjectId -> Trigger
- guardVisible :: MonadDungeon m => NodeId -> m () -> m ()
- roomOfObject :: MonadDungeon m => ObjectId -> m [NodeId]
- acquireObject :: ObjectId -> ChattyDungeonM ()
- dropObject :: ObjectId -> ChattyDungeonM ()
Documentation
modifyRoomState :: MonadRoom m => (RoomState -> RoomState) -> m ()Source
Modify the room state.
getRoomDesc :: (MonadRoom m, IsText t) => m tSource
Get the current room's description
getRoomTitle :: (MonadRoom m, IsText t) => m tSource
Get the current room's title
setRoomDesc :: (MonadRoom m, IsText t) => t -> m ()Source
Set the current room's description
setRoomTitle :: (MonadRoom m, IsText t) => t -> m ()Source
Set the current room's title
markRoom :: MonadDungeon m => m ()Source
Mark the current room as visited
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.
constructRoom :: (Monad m, MonadDungeon (t m), MonadTrans t) => RoomT m a -> t m NodeIdSource
Construct a new room using the room monad.
withRoom :: MonadDungeon m => NodeId -> RoomT m a -> m aSource
Run a function in the context of the given room.
establishWay :: MonadDungeon m => NodeId -> NodeId -> Direction -> m ()Source
Establish a path from one room to another one (one-way only).
changeRoom :: Direction -> ChattyDungeonM ()Source
Enter a neighbouring room by its direction.
addRoomObject :: (Monad m, MonadCounter (t m), MonadRoom (t m), MonadTrans t) => ObjectT m a -> t 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.
modifyObjectState :: MonadObject m => (ObjectState -> ObjectState) -> m ()Source
Modify the object state
getObjectTitle :: (MonadObject m, IsText t) => m tSource
Get the object's title
setObjectTitle :: (MonadObject m, IsText t) => t -> m ()Source
Set the object's title
getObjectDesc :: (MonadObject m, IsText t) => m tSource
Get the object's description
setObjectDesc :: (MonadObject m, IsText t) => t -> m ()Source
Set the object's description
getObjectNames :: MonadObject m => m [String]Source
Get the object's description
addObjectName :: MonadObject m => String -> m ()Source
Add a name for the current object
matchObjectName :: MonadObject m => String -> m BoolSource
Check if the given name matches our current object
addObjectAttr :: MonadObject m => String -> m ()Source
Add an attribute for the current object
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.
getObjectIsMob :: (MonadObject m, Functor m) => m BoolSource
Check if the current object is a mob.
setObjectIsMob :: MonadObject m => Bool -> m ()Source
Set whether the current object is a mob.
getObjectIsAcquirable :: (MonadObject m, Functor m) => m BoolSource
Check if the current object is acquirable.
setObjectIsAcquirable :: MonadObject m => Bool -> m ()Source
Set whether the current object is acquirable.
schedule :: (MonadDungeon m, MonadClock m) => Integer -> Trigger -> m ()Source
Schedule an event for a given time offset (in milliseconds).
setMobRoute :: MonadObject m => [NodeId] -> m ()Source
Set the current mob's route
continueMobRoute :: ObjectId -> TriggerSource
The given object may continue its route
guardVisible :: MonadDungeon m => NodeId -> m () -> m ()Source
Only run the given function if the player is inside the also given room.
roomOfObject :: MonadDungeon m => ObjectId -> m [NodeId]Source
Determine which rooms contain the given object (won't be more than one, but we're careful)
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