Author Topic: Help on creating bricks, deleting them, manipulating rotation and detecting them  (Read 792 times)

This is all for working with modular terrain.

How to detect bricks on the side of a brick and see what side of the face was the original brick facing in relation to that brick and create bricks with certain rotations?

Other more general know-how information is also appreciated.

these are the rotation values
$DTG[rot, 0] = "0 0 0 0";
$DTG[rot, 1] = "0 0 1 90";
$DTG[rot, 2] = "0 0 1 180";
$DTG[rot, 3] = "0 0 1 270";

I'm guessing you would just want to check the brick north/south/east/west of the brick being placed, try the autoroad code
and for placing bricks I use
Code: [Select]
%client = findclientbyname(phflack);
%brick = new fxDTSbrick()
{
datablock = $DTG[base];
position = %x * 16 + 8 SPC %y * 16 + 8 SPC %h5 * 2 + $DTG[terrainheight] - 3;
rotation = "0 0 0 0";
scale = "1 1 1";
colorID = 2;
shapefxID = 0;
printID = 85;
client = %client;
stackBL_ID = %client.bl_id;
isPlanted = 1;
};
%client.brickgroup.add(%brick);
%brick.setTrusted(1);
%brick.plant();

For deletion, %brick.delete(); will delete the brick instantly, possibly creating floating bricks, and %brick.killBrick(); (or was it just .kill() ?) will play the death animation, and cause supported bricks to be killed. If this is a tool that anybody can use, make sure to do trust checks first!


As for detection, use raycast methods. As far as I know, that is how relays work.
« Last Edit: June 30, 2015, 03:31:08 PM by boodals 2 »

You can also do getUpBrick and getDownBrick if I remember.