Blockland Forums > Suggestions & Requests
Destroy bricks with the same color
(1/3) > >>
Demian:
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.
Aeschylus:
oh lawdy support big time.
this isnt exactly something i really need but there are times where i'd really love to have this.
Port:
Here's a quick, untested version.


--- Code: ---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" );

--- End code ---
Demian:
Doesn't work, the wand still only destroys one brick.
jes00:

--- Quote from: Demian on January 21, 2013, 02:31:55 PM ---Doesn't work, the wand still only destroys one brick.

--- End quote ---
Did you say /WandColorArea first?

EDIT: Your right.
Navigation
Message Index
Next page

Go to full version