Note that LockableWithKey should usually go BEFORE a Thing-derived class in the superclass list.
LockableWithKey : Lockable
Some authors might prefer not to assume that the player should remember which keys operate which locks, so this property can be changed to nil to eliminate this memory feature. By default we set this to true, since it shouldn't generally give away any secrets or puzzles for the game to assume that a key that was used successfully once with a given lock is the one to be used subsequently with the same lock.
The point of this routine is to make this class concerned only with the abstract notion of objects that serve to lock and unlock other objects, without requiring that the key objects resemble little notched metal sticks or that the lock objects resemble cylinders with pins - or, more specifically, without requiring that all of the kinds of keys in a game remotely resemble one another.
For example, one kind of "key" in a game might be a plastic card with a magnetic stripe, and the corresponding lock would be a card slot; another kind of key might the traditional notched metal stick. Clearly, no one would ever think to use a plastic card with a conventional door lock, nor would one try to put a house key into a card slot (not with the expectation that it would actually work, anyway). This routine is meant to facilitate this kind of distinction: the card slot can use this routine to indicate that only plastic card objects are plausible as keys, and door locks can indicate that only metal keys are plausible.
This routine can be used for disambiguation and other purposes when we must programmatically select a key that is not specified or is only vaguely specified. For example, the keyring searcher uses it so that, when we're searching for a key on a keyring to open this lock, we implicitly try only the kinds of keys that would be plausibly useful for this kind of lock.
By default, we'll simply return true. Subclasses specific to a game (such as the "card reader" base class or the "door lock" base class) can override this to discriminate among the game-specific key classes.