5.14 class Exit
The Exit class connects two locations. Each Exit is a one-way
pointer to the destination
. An Exit object in a room will
respond to verbs such as 'go' and its own name, and put players
through to the destination location.
Since it is both an important operation and one that exemplifies a lot
of issues, here's what happens when the player wants to move from one
location to another:
- The player's command is parsed and, eventually, a 'go' method (or
whatever) is called on the exit.
- The exit asks the current location to give the player to the
destination location. The process goes something like this:
- Updates the player object's location information with a given
argument.
- Gives capabilities on the player to the remote location.
- Removes the player from itself.
- The exit decides if it wants to allow the operation. This may
include examining the player's inventory for a key object of some kind.
- Note, however, that the exit itself does not have the
capabilities on the player required to do the movement; those belong
to the location itself.