Stateclass | thing.t[805] |
Superclass Tree | Subclass Tree | Global Objects | Property Summary | Method Summary | Property Details | Method Details |
The actual current condition of a given object is given by a property of the Mentionable, which we define as part of the State object. So testing whether an object is lit or unlit is just a matter of checking the corresponding property of the object.
The parser considers an object to have the state, for parsing purposes, if the object defines any value for the state property.
Most of the State object's definition is its vocabulary, which is obviously language-specific. We therefore leave it to the language modules to define the individual State instances. Games can also add new states as needed, of course.
class
State : LState
State
LState
object
adjectives
all
stateProp
vocabTab
vocabWords
Inherited from LState
:
additionalInfo
appliesTo
classInit
construct
getVocab
matchName
Inherited from LState
:
addToName
getAdditionalInfo
initWord
adjectives | thing.t[878] |
States are generally represented in names by adjectives added to the object name, both in displaying output and in parsing input. For example, a Lit/Unlit state would add 'lit' in the lit state and 'unlit' in the unlit state. So we provide an easy way of initializing a state object: just list the states and their corresponding adjectives.
Make one entry in this list for each possible state; the entry is a list, [stateval, [adjectives]], where 'stateval' is the state variable value, and [adjectives] is a list of strings giving the corresponding adjectives. The first adjective in the list is the display adjective - this is the one that addToName() will use to generate an object name for display. The rest are used to parse input; they'll all be matched to the state.
all | thing.t[894] |
stateProp | thing.t[814] |
vocabTab | thing.t[858] |
vocabWords | thing.t[891] |
[[nil, 'unlit', MatchAdj],
[true, 'lit', MatchAdj]]
appliesTo (obj) | thing.t[821] |
classInit ( ) | thing.t[939] |
construct ( ) | thing.t[897] |
getVocab (state) | thing.t[851] |
matchName (tok, state, cmp) | thing.t[835] |
For example, a Lit/Unlit state would return MatchAdj for 'lit' if 'state' is true, 0 otherwise.