Author Topic: Getting all the upward bricks  (Read 517 times)

How do I get all the bricks supported by one brick?

Like the wand does


BrickObject.dump();

There is no default method for getting a list of bricks supported by a brick.

Here's some stuff for reference:

Here's some useful functions:


Exposure:
%brick.getExposedAreaBottom() - ()
%brick.getExposedAreaEast() - ()
%brick.getExposedAreaNorth()
%brick.getExposedAreaSouth() - ()
%brick.getExposedAreaTop() - ()
%brick.getExposedAreaWest() - ()

%brick.iloveposed() - ()exposed = no bricks attached to one end

Up/Down Bricks
%brick.getUpBrick() - (int index)Returns up brick at given index.
%brick.getDownBrick() - (int index)Returns down brick at given index.
%brick.getNumDownBricks() - ()Returns number of bricks in downlist.
%brick.getNumUpBricks() - ()Returns number of bricks in uplist.

%brick.dumpDownList() - ()Dumps the downbrick list.
%brick.dumpUpList() - ()Dumps the upbrick list.

Path-to-Ground
%brick.getDistanceFromGround() - Returns number of connections away from the ground
%brick.hasFakePathToGround() - ()Returns true if brick is attached to a baseplate (considers blown-up bricks to be dead).
%brick.hasPathToGround() - ()Returns true if brick is attached to a baseplate.

%brick.willCauseChainKill() - () returns true if killing this brick will cause others to fall

It is actually pretty difficult. It took me a while to figure out how to do it correctly for the duplicator. It turns out it ended up to be the exact same method the original duplicator used. So your best bet would to look at the duplicator code.