public EasyLCD(EasyBlocks block, double scale = 1.0) { this.block = block.GetBlock(0); if(this.block.Type() == "Wide LCD panel") this.wPanel = 72; this.screen = (IMyTextPanel)(block.GetBlock(0).Block); this.fontSize = block.GetProperty<Single>("FontSize"); this.width = (int)((double)this.wPanel / this.fontSize); this.height = (int)((double)this.hPanel / this.fontSize); this.buffer = new char[this.width * this.height]; this.clear(); this.update(); }
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)); }
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)); } }
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)); } }
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); } }
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)); }
public EasyLCD(EasyBlocks block, double scale = 1.0) { this.block = block.GetBlock(0); if (this.block.Type() == "Wide LCD panel") { this.wPanel = 72; } this.screen = (IMyTextPanel)(block.GetBlock(0).Block); this.fontSize = block.GetProperty <Single>("FontSize"); this.width = (int)((double)this.wPanel / this.fontSize); this.height = (int)((double)this.hPanel / this.fontSize); this.buffer = new char[this.width * this.height]; this.clear(); this.update(); }
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); } }
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); } }