I'm having a problem with the following script; bricks that are loaded and are supporting other bricks cannot be destroyed else the entire build collapses. How can I make this remove brick support when the package is activated or bricks are loaded?
if(isPackage(floatingBricks))
deactivatepackage(floatingBricks);
package floatingBricks
{
function serverCmdPlantBrick(%client)
{
if(!isObject(%client.player))
return;
%ghost = %client.player.tempBrick;
if(!isObject(%ghost))
return;
%brick = new fxDTSBrick()
{
position = %ghost.getPosition();
datablock = %ghost.getDatablock().getName();
rotation = %ghost.rotation;
angleID = %ghost.angleID;
colorID = %ghost.colorID;
client = %client;
isPlanted = 1;
scale = %ghost.scale;
stackBL_ID = %client.bl_id;
printID = %ghost.printID;
};
%brick.setTrusted( true );
%plant = %brick.plant();
if(%plant != 0 && %plant != 2)
{
%brick.delete();
}
else
{
if(%plant == 2)
{
%brick.floatingHammer = true;
}
%group = "BrickGroup_" @ %client.bl_id;
if(!isObject(%group))
{
%set = new SimSet()
{
bl_id = %client.bl_id;
client = %client;
};
%set.setName(%group);
mainBrickGroup.add(%set);
}
%group.add(%brick);
}
}
function hammerimage::onHitObject(%this, %obj, %slot, %col, %d,%e,%f)
{
if(%col.getClassName() $= "fxDTSBrick")
{
if(%col.floatingHammer)
{
if(getTrustLevel(%col,%cl = %obj.client) == 0)
{
messageClient(%cl,'',%cl.name @ " does not trust you enough to do that.");
return;
}
else
{
%col.delete();
}
}
else
{
return parent::onHitObject(%this,%obj,%slot,%col,%d,%e,%f);
}
}
else
return parent::onHitObject(%this,%obj,%slot,%col,%d,%e,%f);
}
};activatepackage(floatingBricks);