Author Topic: Nancy Drew and the case of the mising bricks  (Read 1155 times)

I'm in a bit of a pickle.  I have this code for creating bricks for a little mod on my server:
Code: [Select]
function plantdigbrick( %pos )  //Plants a dig-able brick at %pos
{
%newBrick = new fxDtsBrick()
{
position = %pos;
rotation = "1 0 0 0";
angleID = 0;
colorID = $dirt_color;
colorFXID = 0;
shapeFXID = 0;
printID = 0;
dataBlock = brick4xCubeData;
isBasePlate = 1;
isPlanted = 1;
client = findlocalclient();
};
%newbrick.clicktokill=1;
findlocalclient().brickGroup.add(%newBrick);
%newBrick.setTrusted(1);
%err = %newBrick.plant();
if(%err == 1 || %err == 2 || %err == 3 || %err == 4 || %err == 5 )
{
%newBrick.delete();
}
else
{
$cavepart[ %pos ] = 2;
}
}

It is largely based ripped off of the duplicator.  The problem is that occasionally one person will have random sections of the build be completely invisible.  It is rare and happens to only one person, but I would like to fix it.

As a note to get a head start on the questioning:  Nothing you do to the bricks makes them appear.  Not spraying them a different color, wrenching them and turning on and off stuff, nothing.  It also happens to me some times.

When you overlap bricks you get a strange transparent sort of brick texture; might want to make sure your not somehow glitching them to overlap.

Putting multiple bricks (probably > 5 depending on volume) at the same position will cause them to go invisible too

It's more obvious that my code prevents that if you look at the duplicator code that I ripped it from.  Besides, my script doesn't event try to place bricks in the same place.
Code: [Select]
if(%err == 1 || %err == 2 || %err == 3 || %err == 4 || %err == 5 || (%brick.getTooFarDist(%this.player) > $Pref::Server::TooFarDistance && $Pref::Duplicator::TooFar))
{
if($Pref::Duplicator::PlantErrorMsgs)
{
if(%err == 1)
messageClient(%this, 'MsgPlantError_Overlap');
else if(%err == 2)
messageClient(%this, 'MsgPlantError_Float');
else if(%err == 3)
messageClient(%this, 'MsgPlantError_Stuck');
else if(%err == 4)
messageClient(%this, 'MsgPlantError_Unstable');
else if(%err == 5)
messageClient(%this, 'MsgPlantError_Buried');
else
messageClient(%this, 'MsgPlantError_TooFar');
}
%brick.delete();
%totalBricksPlaced--;
}

Try delaying placing them or something, perhaps it can't transmit them all at once correctly if you place a massive amount together.