function nothereisntafunctionlikethat()
{
%brick = new fxdtsbrick()
{
datablock = "brick1x1Data";
position = "0.25 0.25 0.3";
rotation = "0 0 1 90";
isplanted = 1;
};
%brick.setColor(10);
brickgroup_31546.add(%brick);
%brick.setTrusted(1);
%err = %brick.plant();
if(%err!=0||%err!=2)
{
%brick.schedule(1,"delete");
}
}
%brick will be the object id of the newly created brick.
you can replace brick1x1Data with the name of the datablock of whatever brick you're trying to create
position is the center of the brick and will snap to the grid automatically.
rotation is an axis angle formula [x y z][angle] in this case we rotate around the z axis, and we pick an angle divisible by 90, negatives are accepted I think?
isplanted defines whether its a ghost brick or not. Like some variables, this should only do it's job at the initial creation of the brick. Changing isPlanted after the brick is created may not have the desired effect.
afaik brick color has to be set after the brick is created, but i may be wrong
add the brick to a brickgroup so it will be autodeleted on server shutdown, and so it interacts with the wrench properly
if we want to plant the brick, we can either do a trust check or cut through that bullstuff and just set it as trusted.
bricks will generate an error number when planted, 0 means OK, 2 means its floating, I forget the rest.
aside from "too far", the rest of the errors mean the brick probably wont work right, so we just delete the brick if it didn't plant correctly.