public void RegisterWorkStarted(ILaserToolKernel Tool)
 {
     if (!CurrentlyWorkingTools.Contains(Tool))
     {
         CurrentlyWorkingTools.Add(Tool);
     }
 }
Exemplo n.º 2
0
        private StringBuilder PrintToolVerboseStatus(ILaserToolKernel Tool)
        {
            StringBuilder info = new StringBuilder();

            info.AppendLine($"{Tool.Block.CustomName}: {ReadableLaserToolStatus(Tool.Responder.ToolStatus, false)}");
            info.AppendLine($"Mode: {(Tool.TermControls.ToolMode ? "Welder" : "Grinder")}");
            info.AppendLine($"Powered: {Math.Round(Tool.PowerModule.PowerRatio * 100)}%");
            //info.AppendLine($"Req. input: {Math.Round(Tool.PowerModule.RequiredInput, 3)}u");
            if (Tool.Responder.ToolStatusReport.Length > 0)
            {
                info.Append(Tool.Responder.ToolStatusReport.ToString());
                info.AppendLine();
            }
            info.AppendLine($"Support inventories: {Tool.Inventory.InventoryOwners.Count}");
            if (MyKernel.Session.Settings.Debug)
            {
                foreach (var Owner in Tool.Inventory.InventoryOwners)
                {
                    info.AppendLine(Owner.CustomName);
                }
            }
            info.AppendLine();

            return(info);
        }
 public bool CanStartWork(ILaserToolKernel Tool)
 {
     if (!ToolsPendingWorkStart.Contains(Tool))
     {
         return(false);
     }
     if (CurrentlyWorkingTools.Contains(Tool))
     {
         return(false);
     }
     if (ToolsPendingWorkStart.Peek() == Tool)
     {
         int MaxConcurrentTools = MySessionKernel.Settings.MaxToolUpdatePerTick;
         if (CurrentlyWorkingTools.Count < MaxConcurrentTools)
         {
             ToolsPendingWorkStart.Dequeue();
             return(true);
         }
         else
         {
             return(false);
         }
     }
     else
     {
         return(false);
     }
 }
 public void AddToStartWorkQueue(ILaserToolKernel Tool)
 {
     if (!ToolsPendingWorkStart.Contains(Tool))
     {
         ToolsPendingWorkStart.Enqueue(Tool);
     }
 }
 public void RegisterWorkFinished(ILaserToolKernel Tool)
 {
     if (CurrentlyWorkingTools.Contains(Tool))
     {
         CurrentlyWorkingTools.Remove(Tool);
     }
 }
        public void RemoveFromStartWorkQueue(ILaserToolKernel Tool)
        {
            if (!ToolsPendingWorkStart.Contains(Tool))
            {
                return;
            }

            var list = ToolsPendingWorkStart.ToList();

            list.Remove(Tool);
            ToolsPendingWorkStart.Clear();

            foreach (ILaserToolKernel tool in list)
            {
                ToolsPendingWorkStart.Enqueue(tool);
            }
        }
Exemplo n.º 7
0
        public void GetInventoriesForTool(ILaserToolKernel LaserTool, ref List <IMyTerminalBlock> SupportInventories)
        {
            if (MyKernel.Multigridder?.BiggestGrid?.InventorySystem == null)
            {
                return;
            }
            InventorySystemModule BiggestGridInventorySystem = (MyKernel.Multigridder.BiggestGrid.InventorySystem as InventorySystemModule);

            if (BiggestGridInventorySystem.InventoriesPerTool.ContainsKey(LaserTool))
            {
                SupportInventories.AddRange(BiggestGridInventorySystem.InventoriesPerTool[LaserTool]);
            }
            else
            {
                if (MyKernel.Session.Settings.Debug)
                {
                    WriteToLog(nameof(GetInventoriesForTool), $"No entries were found for tool {LaserTool.Block.CustomName} on grid {LaserTool.Block.CubeGrid.CustomName}. Biggest grid's InventoriesPerTool: {BiggestGridInventorySystem.InventoriesPerTool.Count}, biggest grid's Inventory Owners: {BiggestGridInventorySystem.InventoryOwners.Count}");
                }
            }
        }
Exemplo n.º 8
0
 public void Unsubscribe(ILaserToolKernel laserTool)
 {
     SubscribedLaserTools.Remove(laserTool.Block.EntityId);
 }
Exemplo n.º 9
0
 public void Subscribe(ILaserToolKernel laserTool)
 {
     SubscribedLaserTools.Add(laserTool.Block.EntityId, laserTool);
 }