Author Topic: Finding supported bricks  (Read 1428 times)

Is there a default function for finding which and how many bricks are currently supported by another brick?
I could do this by using getUpBrick() and getDownBrick(), but I don't want to jump straight into a complicated process like this if there already is a pre-made function that does what I'm looking for.

Looking through the duplicator code, I found this: .getNumUpBricks(); and .getNumDownBricks();.

Looking through the duplicator code, I found this: .getNumUpBricks(); and .getNumDownBricks();.
I'm aware of these. They count the bricks directly above and below the selected brick. They don't say anything about support
I said that I could do it this way, but it wouldn't be as simple as a premade function.

I'm aware of these. They count the bricks directly above and below the selected brick. They don't say anything about support
I said that I could do it this way, but it wouldn't be as simple as a premade function.
Ah, woops my bad. But doesn't the duplicator duplicate every brick being supported by the original brick?

Ah, woops my bad. But doesn't the duplicator duplicate every brick being supported by the original brick?
Sort of. It appears that it only does that when duping the base. If you hit a brick that is supported from above it doesn't work.

Sort of. It appears that it only does that when duping the base. If you hit a brick that is supported from above it doesn't work.
Ah, that makes sense.

The Duplicator selects any brick that is connected in any way to the brick you hit.

The Duplicator selects any brick that is connected in any way to the brick you hit.
Nopeh
It does not select bricks directly under the brick you hit
Except there is another way through other bricks to that brick

Yes we have already established this. Is anyone going to answer my original question? I mean, the code has to exist somewhere, the wand and magic wand use it when they destroy bricks.

Turn trace on then hit a brick that supports another with a hammer.

I don't have an opportunity to use blockland until next weekend, so could somebody do that for me?

Also, I found the function willCauseChainKill, it appears to be a bool that tells if destroying one brick will destroy others as well. This is probably what the hammer uses though...

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
« Last Edit: April 28, 2012, 02:23:49 PM by Greek2me »

hasPathToGround should work.

hasPathToGround should work.
It doesn't tell me which bricks will be destroyed. It will be helpful, but it's only a bool indicator.

Look at these 2 functions, they might help you get an idea of what is supporting:
%brick.dumpDownList() - ()Dumps the downbrick list.
%brick.dumpUpList() - ()Dumps the upbrick list.