BaseMultiLoc class | objects.t[2436]

Base multi-location item with automatic initialization. This is the base class for various multi-located object classes.

We provide four ways of initializing a multi-located object's set of locations.

First, the object can simply enumerate the locations explicitly, by setting the 'locationList' property to the list of locations.

Second, the object can indicate that it's located in every object of a given class, by setting the 'initialLocationClass' property to the desired class.

Third, the object can define a rule that specifies which objects are its initial locations, by defining the 'isInitiallyIn(obj)' method to return true if 'obj' is an initial location, nil if not. This can be combined with the 'initialLocationClass' mechanism: if 'initialLocationClass' is non-nil, then only objects of the given class will be tested with 'isInitiallyIn()'; if 'initialLocationClass' is nil, then every object in the entire game will be tested.

Fourth, you can override the method buildLocationList() to build an return the initial list of locations. You can use this approach if you have a complex set of rules for determining the initial location list, and none of the above approaches are flexible enough to implement it. If you override buildLocationList(), simply compute and return the list of initial locations; the library will automatically call the method during pre-initialization.

If you don't define any of these, then the object simply has no initial locations by default.

`class BaseMultiLoc : object`

Superclass Tree (in declaration order)

`BaseMultiLoc`
`object`

Subclass Tree

`BaseMultiLoc`
`MultiInstance`
`MultiFaceted`
`MultiLoc`
`SenseConnector`
`DistanceConnector`

Global Objects

(none)

Summary of Properties

`initialLocationClass locationList`

Summary of Methods

`buildLocationList isDirectlyIn isIn isInitiallyIn isListedInContents isOrIsIn`

Properties

`initialLocationClass` | `objects.t[2451]`

The class of our initial locations. If this is nil, then our default buildLocationList() method will test every object in the entire game with our isInitiallyIn() method; otherwise, we'll test only objects of the given class.

`locationList` | `objects.t[2443]`

The location list. Instances can override this to manually enumerate our initial locations. By default, we'll call buildLocationList() the first time this is invoked, and store the result.

Methods

`buildLocationList ( )` | `objects.t[2471]`

Build my list of locations, and return the list. This default implementation looks for an 'initialLocationClass' property value, and if one is found, looks at every object of that class; otherwise, it looks at every object in the entire game. In either case, each object is then passed to our isInitiallyIn() method, and is included in our result list if isInitiallyIn() returns true.

`isDirectlyIn (obj)` | `objects.t[2533]`

determine if I'm directly in the given object

`isIn (obj)` | `objects.t[2518]`

determine if I'm in a given object, directly or indirectly

`isInitiallyIn (obj)` | `objects.t[2460]`

Test an object for inclusion in our initial location list. By default, we'll simply return true to include every object. We return true by default so that an instance can merely specify a value for initialLocationClass in order to place this object in every instance of the given class.

`isListedInContents (examinee, :?)` | `objects.t[2551]`

Determine if I'm to be listed within my immediate container. As a multi-location object, we have multiple immediate containers, so we need to know which direct container we're talking about. Thing.examineListContents() passes this down via "cont:", a named parameter. Other callers might not always provide this argument, though, so if it's not present simply base this on whether we have a special description in any context.

`isOrIsIn (obj)` | `objects.t[2559]`

Am I either inside 'obj', or equal to 'obj'?

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