Author Topic: Named Ghost Bricks  (Read 828 times)

I noticed that the ghost brick for the new duplicator has a client's name above it. is there any way it can be done for regular ghost bricks?

It's only above the selection box, not the ghost bricks.

Yes, it can be done. The exact same way probably.

The ghost brick can be obtained through %client.player.tempBrick, so you could create a static shape slightly above the brick and set the shape name for it.

e.g.
Code: [Select]
%brick = %client.player.tempBrick;

if(isObject(%brick)) {
%pos = %brick.getPosition();
%pos[x] = getWord(%pos, 0);
%pos[y] = getWord(%pos, 1);
%pos[z] = getWord(%pos, 2) + 1;

%shape = new StaticShape(tempShape) {
client = %client;
brick = %brick;
position = %pos[x] SPC %pos[y] SPC %pos[z];
};
%brick.staticShape = %shape;

%shape.setShapeName("Blockhead's Brick");
%shape.setShapeNameColor(getColorIDTable(%brick.colorID));
}

//
// it's been a while, consider this psuedo
//

EDIT: I don't, however, know what the functions are for manipulating the ghost brick. You would need to package those to update the static shape.

The same functions as regular bricks. I've done ghostbrick manipulation previously for an addon. You just need to take into accountthat when the player hits Num0, it gets deleted and its ID changes.

The same functions as regular bricks. I've done ghostbrick manipulation previously for an addon. You just need to take into accountthat when the player hits Num0, it gets deleted and its ID changes.
so can you list them then

I'm not at home right now. They have the same functions as any regular brick. Things that should be taken into account though is that they can be moved, no collision, can change datablocks, not planted, etc.