void step(IMyGridTerminalSystem gts) { this.projector.AttachEverything(gts); WelderStatus welderStatus = this.welder.GetStatus(); if (welderStatus != WelderStatus.Deployed) { this.log("Welder is not ready"); return; } ProjectorStatus projStatus = this.projector.GetStatus(); if (projStatus != ProjectorStatus.Projecting) { this.log("Projector is not ready"); return; } InventoryStatus invStatus = this.inventoryManager.GetStatus(); if (invStatus == InventoryStatus.NotReady) { this.log("Inventory is not ready"); return; } this.welder.Step(); }
void updateStatusDisplay() { using (Display.Frame f = this.statusDisplay.DrawFrame()) { f.DrawText(this.name + " status", new Vector2(this.statusDisplay.SurfaceSize.X / 2, 0)); float x = this.statusDisplay.SurfaceSize.X - 2; float y = 60; this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); ProjectorStatus projStatus = this.projector.GetStatus(); WelderStatus welderStatus = this.welder.GetStatus(); InventoryStatus invStatus = this.invManager.GetStatus(); if (projStatus == ProjectorStatus.Projecting && welderStatus == WelderStatus.Deployed && invStatus != InventoryStatus.NotReady) { this.drawLineOfText(f, "Status", "Ready", x, ref y); } else { this.drawLineOfText(f, "Status", "Not ready", x, ref y, CRITICAL); } if (projStatus == ProjectorStatus.Projecting) { this.drawLineOfText(f, "Completion", $"{this.projector.GetCompletion() * 100:N0}%", x, ref y); this.drawLineOfText(f, "Time since block added", $"{this.counter}", x, ref y); } else { this.drawLineOfText(f, "Completion", "N/A", x, ref y); this.drawLineOfText(f, "Time since block added", "N/A", x, ref y); } this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); Color?color = projStatus != ProjectorStatus.Projecting ? CRITICAL : (Color?)null; this.drawLineOfText(f, "Projector status", projStatus.ToString(), x, ref y, color); color = this.projector.HasBlocksAttached() ? WARNING : (Color?)null; this.drawLineOfText(f, "Has blocks attached", this.projector.HasBlocksAttached().ToString(), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); color = welderStatus != WelderStatus.Deployed ? CRITICAL : (Color?)null; this.drawLineOfText(f, "Welder status", welderStatus.ToString(), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); color = invStatus == InventoryStatus.NotReady ? CRITICAL : invStatus == InventoryStatus.MandatoryLow ? ERROR : invStatus == InventoryStatus.OptionalLow ? WARNING : (Color?)null; this.drawLineOfText(f, "Inventory status", this.getString(invStatus), x, ref y, color); this.drawLine(f, this.statusDisplay.SurfaceSize.X, ref y); if (!string.IsNullOrEmpty(this.LastMessage)) { f.DrawText(this.LastMessage, new Vector2(0, y), CRITICAL, 0.75f, alignment: TextAlignment.LEFT); } } }