Author Topic: Destroy bricks with the same color  (Read 1666 times)

Several times now I've come across a situation where I would have needed to destroy all the bricks adjacent to each other that have the same color. Essentially a Fillcan except it destroys the bricks. An additional functionality could be switching between hammer and wand modes.

oh lawdy support big time.
this isnt exactly something i really need but there are times where i'd really love to have this.

Here's a quick, untested version.

Code: [Select]
function serverCmdWandColorArea( %cl )
{
%status = ( %cl.wandColorArea = !%cl.wandColorArea ? "enabled" : "disabled" );
messageClient( %cl, '', "\c6Bricks of the same color being affected by the Wand is now " @ %status @ "." );
}

function wandColorArea( %obj, %col, %color, %count )
{
if ( !%obj.client.wandColorArea || %count >= 500 )
{
return false;
}

%db = %col.getDataBlock();
%ai = %col.angleId;

%sz = %db.brickSizeZ;

if ( %ai % 2 == 1 )
{
%sx = %db.brickSizeY;
%sy = %db.brickSizeX;
}
else
{
%sx = %db.brickSizeX;
%sy = %db.brickSizeY;
}

%box = ( %sx * 0.5 + 0.6 ) SPC ( %sy * 0.5 + 0.6 ) SPC ( %sz * 0.2 + 0.3 );
%end = true;

initContainerBoxSearch( %col.getPosition(), %box, $TypeMasks::FxBrickAlwaysObjectType );

while ( isObject( %find = containerSearchNext() ) )
{
%trust = getTrustLevel( %obj.client, %find );

if ( %find.isPlanted() && %find.getColorID() == %color && %trust >= 2 )
{
if ( !wandColorArea( %obj, %find, %color, %count++ ) )
{
%end = false;
break;
}
}
}

%col.killBrick();
return %end;
}

package wand_color_area_package
{
function wandImage::onHitObject( %this, %obj, %slot, %col, %pos, %normal )
{
if ( %obj.client.wandColorArea && !wandColorArea( %obj, %col, %col.getColorID() ) )
{
%obj.client.centerPrint( "\c6Brick limit reached.", 2 );
}

if ( isObject( %col ) )
{
parent::onHitObject( %this, %obj, %slot, %col, %pos, %normal );
}
}
};

activatePackage( "wand_color_area_package" );
« Last Edit: January 21, 2013, 02:03:20 PM by Port »

Doesn't work, the wand still only destroys one brick.

Doesn't work, the wand still only destroys one brick.
Did you say /WandColorArea first?

EDIT: Your right.
« Last Edit: January 21, 2013, 02:41:14 PM by jes00 »

Bump. Someone make Port's code work please?

edit the fill can to break bricks instead.

edit the fill can to break bricks instead.
If I knew how to do that I would not have made this thread.



So say you wanted to delete the grey bricks in demo house, wouldn't the roof go with it?

So say you wanted to delete the grey bricks in demo house, wouldn't the roof go with it?
Yes it would. Unless someone scripts a fancy hammer mode that leaves support or something like that.

Does this not work?
http://forum.blockland.us/index.php?topic=174107.0
Nope.