That totally didn't work.

All of the raycasts seem to go through the trees
Also I can't seem to place the 2x2 plates. Ignore the colors.
//BEEP BEEP, BUILDMODE COMING THROUGH
if(%client.buildmode == 1 && %client.bmstock !$= "")
{
%result = containerRaycast(%start, %end, $Typemasks::ALL, %client.player); //I have the other parts in before this
%mat = getWord(%client.bmstock, 1); //%client.bmstock is a string with something like 20 String in it. It specifies how many they can
%amt = getWord(%client.bmstock, 0); //place. %mat is the material type (String) and %amt is the amount (20)
%pos = posFromRaycast(%result);
if(%pos $= "")
return;
//Ignore this if-statement chain
if(%mat $= "Silver")
{
%db = SilverBrickData;
%color = 1;
}
else if(%mat $= "Iron")
{
%db = IronBrickData;
%color = 1;
}
else if(%mat $= "Steel")
{
%db = SteelBrickData;
%color = %client.currentColor;
}
else if(%mat $= "String")
{
%db = StringBrickData;
%color = 1;
}
else if(%mat $= "WoodPlank")
{
%db = WoodPlankBrickData;
%color = %client.currentColor;
}
%brick = new fxDTSBrick()
{
datablock = %db;
position = %pos;
isPlanted = 1;
colorID = %color;
};
%client.bmstock = %amt - 1 SPC %mat;
return;
}The code is a bit messy right now, sorry.
Edit: I fixed the wooden planks not planting, it was an if-statement i set up that would return;, and it was going off when it wasn't supposed to. Bricks placed through this method have really wonky collision, it's a bumpy ride when you walk on them. All tools (hammer, wrench, printer) seem to ignore them. I also made it so the bricks are added to the clients brickgroup.
I found this snippet of code:
%posToGrid = mFloatLength(getWord(%pos,0)/2,0)*2 SPC mFloatLength(getWord(%pos,1)/2,0)*2 SPC 1+mFloatLength(getWord(%pos,2)/2,0)*2;
Practically no idea what it does, but could I use it? It's said to align it to the 4x4 cube grid. Can I use that for my 2x2 plates and 4x4 plates?
Edit 2: Oh wait, I'm dumb. They are actually aligning to the grid. Or, at least the plates are. I'm not sure what was up with trees. I should probably re-test that. It's just that they can't be tool'd and their collision is really weird. /getID raycasts completely ignore them.


If I stand still on top of them, my feet just sink through.