[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Tads3] UnderSurface - Second Thoughts
- From: "Eric Eve" <eric.eve@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Subject: [Tads3] UnderSurface - Second Thoughts
- Date: Tue, 9 Sep 2003 18:38:13 +0100
- To: "Tads3" <tads3@xxxxxxxxxxx>
I've been rethinking the way UnderSurface might be implemented and used to
hide or reveal objects underneath. In particular, on second thoughts, I've
decided that the UnderSurfaceRevealer class is probably redundant. My
prototype implementation now has the following:
1) An Underside class, derived from BulkLimiter, which is basically an
adaptation of Surface to deal with Put Under and Look Under (instead of Put
On and Look In).
2) For objects that start life hidden under something, a mix-in class
defined thus:
class UnderHidden : object
isListed = nil
sightPresence = (isListed)
;
The action routine for Underside's dObjFor(LookUnder) then includes the
following:
/* Reveal any items concealed under me */
foreach(local cur in contents)
if(cur.ofKind(UnderHidden)) cur.isListed = true;
Any UnderHidden object is then listed and becomes visible and manipulable
thereafter.
3) A mix-in UnderSurface class to add Look Under and Put Under capabilities
to other objects:
class UnderSurface : Thing
dobjFor(LookUnder) maybeRemapTo(underside != nil, LookUnder, underside)
iobjFor(PutUnder) maybeRemapTo(underside != nil, PutUnder, DirectObject,
underside)
underside = nil
;
This can then be used as in the following example (which allows things to be
put both on or under the shelves):
+ linenShelves : UnderSurface, Surface, Fixture 'shelf*shelves' 'shelves'
"The shelves are made of wooden slats are placed round three sides of the
room. They
are covered with towels, sheets and other linen. "
underside : ComplexComponent, Underside { }
;
This appears to work, at any rate, and seems quite a workable scheme. There
may be better ways of implementing it, and there are probably better names
for the classes, but does it look like the basis of a workable scheme that
may be worth including in the library?
-- Eric