Stateclass | thing.t[947] |
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[1020] |
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[1036] |
stateProp | thing.t[956] |
vocabTab | thing.t[1000] |
vocabWords | thing.t[1033] |
[[nil, 'unlit', MatchAdj],
[true, 'lit', MatchAdj]]
appliesTo (obj) | thing.t[963] |
classInit ( ) | thing.t[1081] |
construct ( ) | thing.t[1039] |
getVocab (state) | thing.t[993] |
matchName (tok, state, cmp) | thing.t[977] |
For example, a Lit/Unlit state would return MatchAdj for 'lit' if 'state' is true, 0 otherwise.