fCraft.PlantTask.PerformInternal C# (CSharp) Method

PerformInternal() protected method

protected PerformInternal ( ) : int
return int
        protected override int PerformInternal()
        {
            if ( _map.GetBlock( _x, _y, _z ) != Block.Plant ) //superflous task added by grass scanner or deleted plant. just forget it
                return 0;

            TreeType type = TypeByBlock( _map.GetBlock( _x, _y, _z - 1 ) );
            if ( TreeType.NoGrow == type )
                return 0;

            short height = ( short )_r.Next( 4, 7 );
            if ( CanGrow( height ) )
                MakeTrunks( height, type );

            return 0; //non-repeating task
        }