The problem: TAKE ALL FROM
an instance of ComplexContainer doesn’t appear to work in the expected way.
Sample code: defines a Furniture
class, which here is just an alias for Heavy
. Also defines a Dresser
class, which is Furniture
which is also a ComplexContainer
. Each Dresser
comes with: a DresserDrawer
which is an OpenableContainer
and a ComplexComponent
; and a DresserTop
which is a Surface
and a ComplexComponent
.
#charset "us-ascii"
#include <adv3.h>
#include <en_us.h>
startRoom: Room 'Void'
"This is a featureless void with a wooden dresser in one corner. "
;
class Furniture: Heavy;
class DresserDrawer: ComplexComponent, OpenableContainer
'(dresser) drawer' 'drawer';
class DresserTop: ComplexComponent, Surface
'on (dresser) top' 'top';
class Dresser: ComplexContainer, Furniture 'dresser' 'dresser'
subContainer = perInstance(new DresserDrawer())
subSurface = perInstance(new DresserTop())
contentsListed = nil
contentsListedInExamine = nil
drawer = subContainer
top = subSurface
initializeThing() {
subSurface.moveInto(self);
subSurface.targetObj = self;
subContainer.moveInto(self);
subContainer.targetObj = self;
inherited();
}
;
dresser: Dresser 'plain wooden dresser' 'dresser'
"It's a plain wooden dresser with one drawer. "
location = startRoom
;
+ pebble: Thing 'small round pebble' 'pebble'
"A small, round pebble. "
subLocation = &drawer
;
+ widget: Thing 'nondescript widget' 'widget'
"It's a nondescript widget. "
subLocation = &top
;
me: Person
location = startRoom
;
versionInfo: GameID
name = 'sample'
byline = 'nobody'
authorEmail = 'nobody <foo@bar.com>'
desc = '[This space intentionally left blank]'
version = '1.0'
IFID = '12345'
;
gameMain: GameMainDef
initialPlayerChar = me
;
This mostly works: the drawer can be opened and closed, OPEN DRESSER
automagically opens the drawer, and so on. But trying TAKE ALL FROM DRESSER
confuses the parser:
Void
This is a featureless void with a wooden dresser in one corner.
On the dresser, you see a widget.
>open dresser
Opening the dresser reveals a pebble.
>take all from dresser
widget: The widget isn't in that.
pebble: The pebble isn't in that.
Weirdly it figures out, correctly, which objects are in scope. Just not what to do with them.
Am I missing something obvious here, or is this a weirdness in ComplexContainer
that needs to be architected around?