Beispiel #1
0
 public void AddEvents(EasyBlocks blocks, Func<EasyBlock, bool> evnt, Func<EasyBlock, bool> action)
 {
     for(int i = 0; i < blocks.Count(); i++)
     {
         this.AddEvent(new EasyEvent<EasyBlock>(blocks.GetBlock(i), evnt, action));
     }
 }
Beispiel #2
0
 public void AddEvents(EasyBlocks blocks, Func <EasyBlock, bool> evnt, Func <EasyBlock, bool> action, bool onChange = false)
 {
     for (int i = 0; i < blocks.Count(); i++)
     {
         this.AddEvent(new EasyEvent(blocks.GetBlock(i), evnt, action, onChange));
     }
 }
Beispiel #3
0
 public void MoveTo(EasyBlocks Blocks, int Inventory = 0, int dummy = 0)
 {
     // Right now it moves them to all of them.  Todo: determine if the move was successful an exit for if it was.
     // In the future you will be able to sort EasyBlocks and use this to prioritize where the items get moved.
     for (int i = 0; i < Blocks.Count(); i++)
     {
         this.Inventory.TransferItemTo(Blocks.GetBlock(i).Block.GetInventory(Inventory), ItemIndex);
     }
 }
Beispiel #4
0
    public EasyBlocks Minus(EasyBlocks Blocks)
    {
        List <EasyBlock> FilteredList = new List <EasyBlock>();

        FilteredList.AddRange(this.Blocks);
        for (int i = 0; i < Blocks.Count(); i++)
        {
            FilteredList.Remove(Blocks.GetBlock(i));
        }

        return(new EasyBlocks(FilteredList));
    }
Beispiel #5
0
    public EasyBlocks Plus(EasyBlocks Blocks)
    {
        List <EasyBlock> FilteredList = new List <EasyBlock>();

        FilteredList.AddRange(this.Blocks);
        for (int i = 0; i < Blocks.Count(); i++)
        {
            if (!FilteredList.Contains(Blocks.GetBlock(i)))
            {
                FilteredList.Add(Blocks.GetBlock(i));
            }
        }

        return(new EasyBlocks(FilteredList));
    }
Beispiel #6
0
    public void plot(EasyBlocks blocks, double x, double y, double scale = 1.0, char brush = 'o', bool showBounds = true, char boundingBrush = '?')
    {
        VRageMath.Vector3D max  = new Vector3D(this.screen.CubeGrid.Max);
        VRageMath.Vector3D min  = new Vector3D(this.screen.CubeGrid.Min);
        VRageMath.Vector3D size = new Vector3D(max - min);

        int width  = (int)size.GetDim(0);
        int height = (int)size.GetDim(1);
        int depth  = (int)size.GetDim(2);

        int minX = (int)min.GetDim(0);
        int minY = (int)min.GetDim(1);
        int minZ = (int)min.GetDim(2);

        int maxX = (int)max.GetDim(0);
        int maxY = (int)max.GetDim(1);
        int maxZ = (int)max.GetDim(2);

        double s = (double)depth + 0.01;

        if (width > depth)
        {
            s = (double)width + 0.01;
        }

        if (showBounds)
        {
            box(x + -(((0 - (width / 2.0)) / s) * scale),
                y + -(((0 - (depth / 2.0)) / s) * scale),
                x + -(((maxX - minX - (width / 2.0)) / s) * scale),
                y + -(((maxZ - minZ - (depth / 2.0)) / s) * scale), boundingBrush);
        }

        for (int n = 0; n < blocks.Count(); n++)
        {
            var block = blocks.GetBlock(n);

            Vector3D pos = new Vector3D(block.Block.Position);

            pset(x + -((((double)(pos.GetDim(0) - minX - (width / 2.0)) / s)) * scale),
                 y + -((((double)(pos.GetDim(2) - minZ - (depth / 2.0)) / s)) * scale), brush);
        }
    }
Beispiel #7
0
    public void plot(EasyBlocks blocks, double x, double y, double scale = 1.0, char brush = 'o', bool showBounds = true, char boundingBrush = '?')
    {
        VRageMath.Vector3D max = new Vector3D(this.screen.CubeGrid.Max);
        VRageMath.Vector3D min = new Vector3D(this.screen.CubeGrid.Min);
        VRageMath.Vector3D size = new Vector3D(max - min);

        int width = (int)size.GetDim(0);
        int height = (int)size.GetDim(1);
        int depth = (int)size.GetDim(2);

        int minX = (int)min.GetDim(0);
        int minY = (int)min.GetDim(1);
        int minZ = (int)min.GetDim(2);

        int maxX = (int)max.GetDim(0);
        int maxY = (int)max.GetDim(1);
        int maxZ = (int)max.GetDim(2);

        double s = (double)depth + 0.01;
        if(width > depth)
        {
            s = (double)width + 0.01;
        }

        if(showBounds)
        {
            box(x + -(((0 - (width / 2.0)) / s) * scale),
                y + -(((0 - (depth / 2.0)) / s) * scale),
                x + -(((maxX - minX - (width / 2.0)) / s) * scale),
                y + -(((maxZ - minZ - (depth / 2.0)) / s) * scale), boundingBrush);
        }

        for(int n = 0; n < blocks.Count(); n++)
        {
            var block = blocks.GetBlock(n);

            Vector3D pos = new Vector3D(block.Block.Position);

            pset(x + -((((double)(pos.GetDim(0) - minX - (width / 2.0)) / s)) * scale),
                 y + -((((double)(pos.GetDim(2) - minZ - (depth / 2.0)) / s)) * scale), brush);
        }
    }