Traveler class | travel.t[273], en_us.t[2769]

A Traveler is an object that can travel. The two main kinds of travelers are Actors and Vehicles. A vehicle can contain multiple actors, so a single vehicle travel operation could move several actors.

This class is intended to be multiply inherited, since it is not based on any simulation object class.

Modified in en_us.t[2769]:
English-specific Traveler changes

`class Traveler : TravelMessageHandler`

Superclass Tree (in declaration order)

`Traveler`
`TravelMessageHandler`
`object`

Subclass Tree

`Traveler`
`Actor`
`UntakeableActor`
`Person`
`Vehicle`

Global Objects

(none)

Summary of Properties

`getTravelerActors getTravelerMotiveActors`

``

Summary of Methods

`canTravelVia checkDirectlyInRoom checkMovingTravelerInto describeArrival describeDeparture describeNpcArrival describeNpcDeparture explainNoTravelVia forEachTravelingActor getNotifyTable isActorTraveling isTravelerCarrying travelerLocName travelerPreCond travelerRemoteLocName travelerSeenBy travelerTravelTo travelerTravelWithin`

Inherited from `TravelMessageHandler` :
`getNominalTraveler sayArriving sayArrivingDir sayArrivingDownStairs sayArrivingLocally sayArrivingThroughPassage sayArrivingUpStairs sayArrivingViaPath sayDeparting sayDepartingDir sayDepartingDownStairs sayDepartingLocally sayDepartingThroughPassage sayDepartingUpStairs sayDepartingViaPath sayTravelingRemotely`

Properties

`getTravelerActors` | `travel.t[723]`

Get the list of actors taking part in the travel. When an actor is the traveler, this list simply contains the actor itself; for a vehicle or other composite traveler that moves more than one actor at a time, this should return the list of all of the actors involved in the travel.

`getTravelerMotiveActors` | `travel.t[734]`

Get the list of actors traveling undo their own power. In the case of an actor traveling directly, this is just the actor; in the case of an actor pushing something, this is likewise the actor; in the case of a group of actors traveling together, this is the list of traveling actors; in the case of a vehicle, this is an empty list, since anyone traveling with the vehicle is traveling under the vehicle's power.

Methods

`canTravelVia (connector, dest)` | `travel.t[308]`

Can the traveler travel via the given connector to the given destination? Returns true if the travel is permitted, nil if not.

By default, this simply returns true to indicate that the travel is allowed. Individual instances can override this to enforce limitations on what kind of travel the traveler can perform.

`checkDirectlyInRoom (dest, allowImplicit)` | `travel.t[279]`

Check, using pre-condition rules, that the traveler is directly in the given room. We'll attempt to implicitly remove the actor from any nested rooms within the given room.

`checkMovingTravelerInto (room, allowImplicit)` | `travel.t[289]`

Check, using pre-condition rules, that the traveler is in the given room, moving the traveler to the room if possible.

`describeArrival (origin, backConnector)` | `travel.t[415]`

Show my arrival message - this is shown when I'm entering a room in view of the player character from a location where the player character could not see me. 'backConnector' is the connector in the destination location from which we appear to be emerging.

`describeDeparture (dest, connector)` | `travel.t[327]`

Show my departure message - this is shown when I'm leaving a room where the player character can see me for another room where the player character cannot see me.

`describeNpcArrival (origin, backConnector)` | `travel.t[462]`

Describe the arrival of a non-player character or any other traveler that doesn't involve the player character.

`describeNpcDeparture (dest, connector)` | `travel.t[355]`

Describe the departure of a non-player character, or any traveler not involving the player character.

`explainNoTravelVia (connector, dest)` | `travel.t[320]`

Explain why the given travel is not possible. This is called when canTravelVia() returns nil, to display a report to the player explaining why the travel was disallowed.

By default, we do nothing, since our default canTravelVia() never disallows any travel. If canTravelVia() is overridden to disallow travel under some conditions, this must be overridden to generate an appropriate explanatory report.

`forEachTravelingActor (func)` | `travel.t[710]`

invoke a callback function for each traveling actor

`getNotifyTable ( )` | `travel.t[665]`

Get a lookup table giving the set of objects to be notified of a beforeTravel/afterTravel event. By default, we return a table including every object connected to the traveler by containment.

`isActorTraveling (actor)` | `travel.t[681]`

Is the given actor traveling with this traveler? Returns true if the actor is in my getTravelerActors list.

`isTravelerCarrying (obj)` | `travel.t[692]`

Is the given object being carried by the traveler? Returns true if the object is inside the traveler itself, or is inside any of the actors traveling.

`travelerLocName ( )` | `en_us.t[2776]`

Get my location's name, from the PC's perspective, for describing my arrival to or departure from my current location. We'll simply return our location's destName, or "the area" if it doesn't have one.

`travelerPreCond (conn)` | `travel.t[298]`

Get the travel preconditions specific to the traveler, for the given connector. By default, we return no extra conditions.

`travelerRemoteLocName ( )` | `en_us.t[2792]`

Get my "remote" location name, from the PC's perspective. This returns my location name, but only if my location is remote from the PC's perspective - that is, my location has to be outside of the PC's top-level room. If we're within the PC's top-level room, we'll simply return an empty string.

`travelerSeenBy (actor)` | `travel.t[675]`

Determine if the given actor can see this traveler. By default, we'll simply check to see if the actor can see 'self'.

`travelerTravelTo (dest, connector, backConnector)` | `travel.t[555]`

Travel to a new location. Moves the traveler to a new location via the given connector, triggering any side effects of the travel.

Note that this routine is not normally called directly; in most cases, the actor's travelTo is called, and it in turn invokes this method in the appropriate traveler.

'dest' is the new location to which we're traveling. 'connector' is the TravelConnector we're traversing from the source location to reach the new destination; the connector is normally the invoker of this routine. 'backConnector' is the connector in the destination from which the actor will appear to emerge on the other end of the travel.

`travelerTravelWithin (actor, dest)` | `travel.t[655]`

Perform "local" travel - that is, travel between nested rooms within a single top-level location. By default, we simply defer to the actor to let it perform the local travel.

TADS 3 Library Manual
Generated on 5/16/2013 from TADS version 3.1.3