public override bool Prepare( Vector3I[] marks ) {
if( marks == null ) throw new ArgumentNullException( "marks" );
if( marks.Length < 1 ) throw new ArgumentException( "At least one mark needed.", "marks" );
Marks = marks;
Origin = marks[0];
SourceBlock = Map.GetBlock( Origin );
if( Player.Info.Rank.DrawLimit == 0 ) {
// Unlimited!
Bounds = Map.Bounds;
} else {
// Our fill limit is cube root of DrawLimit
double pow = Math.Pow( Player.Info.Rank.DrawLimit, 1/3d );
int maxLimit = (int)Math.Ceiling( pow / 2 );
// Compute the largest possible extent
if( maxLimit < 1 || maxLimit > 2048 ) maxLimit = 2048;
Vector3I maxDelta = new Vector3I( maxLimit, maxLimit, maxLimit );
Bounds = new BoundingBox( Origin - maxDelta, Origin + maxDelta );
// Clip bounds to the map, used to limit fill extent
Bounds = Bounds.GetIntersection( Map.Bounds );
}
// Set everything up for filling
Coords = Origin;
StartTime = DateTime.UtcNow;
Context = BlockChangeContext.Drawn | BlockChangeContext.Filled;
BlocksTotalEstimate = Bounds.Volume;
coordEnumerator = BlockEnumerator().GetEnumerator();
if( Brush == null ) throw new NullReferenceException( Name + ": Brush not set" );
return Brush.Begin( Player, this );
}