TADS 3 Library - point of view
This module provides definitions related to point of view and sensory context. When we generate output, we do so with respect to a particular point of view; different points of view can result in different output, because of the viewer's distance from an object, for example, or because of the presence of obscuring materials between the viewer and the viewed object. We also generate output in a particular sensory context, which controls whether or not a message that describes an object with respect to a particular sense should be generated at all; for example, if the viewer can't see an object because of darkness or an obscuring layer of material, messages about the object's visual appearance should not be generated.
The sensory context specifies the source of any messages generated in the course of the routine we invoke and the sense which those messages use to convey information. If the player character cannot sense the source object in the given sense, then we block all messages generated while calling this function.
If the source object is nil, this establishes a neutral sense context in which all messages are visible.
This can be used for processing events that are not directly initiated by the player character, such as non-player character activities or scheduled events (fuses and daemons). The idea is that anything described in the course of calling our routine is physically associated with the source object and relates to the given sense, so if the player character cannot sense the source object, then the player should not be aware of these happenings and thus should not see the messages.
Sense contexts are not nested in their effects - we will show or hide the messages that our callback routine generates regardless of whether or not messages are hidden by an enclosing sensory context. So, this routine effectively switches to the new sense context for the duration of the callback, eliminating the effect of any enclosing context. However, we do restore the enclosing sense context before returning, so there is no lasting net effect on the global sense context.