Exemplo n.º 1
0
        public BaseEntity GetEntity(string type, string name)
        {
            switch (type)
            {
            case "assembling-machine":
                return(Assemblers.TryGetValue(name, out var x1) ? x1 : null);

            case "furnace":
                return(Furnaces.TryGetValue(name, out var x2) ? x2 : null);

            case "electric-pole":
                return(ElectricPoles.TryGetValue(name, out var x3) ? x3 : null);

            case "mining-drill":
                return(MiningDrills.TryGetValue(name, out var x4) ? x4 : null);

            case "transport-belt":
                return(TransportBelts.TryGetValue(name, out var x5) ? x5 : null);

            case "container":
                return(Containers.TryGetValue(name, out var x6) ? x6 : null);

            case "inserter":
                return(Inserters.TryGetValue(name, out var x7) ? x7 : null);
            }
            return(null);
        }
Exemplo n.º 2
0
        public EnableDisableItemsDialog()
        {
            InitializeComponent();
            DataContext = this;

            Assemblers.AddRange(DataCache.Current.Assemblers.Values.OrderBy(x => x.FriendlyName));
            Miners.AddRange(DataCache.Current.Miners.Values.OrderBy(x => x.FriendlyName));
            Modules.AddRange(DataCache.Current.Modules.Values.OrderBy(x => x.FriendlyName));
            Mods.AddRange(DataCache.Current.Mods.OrderBy(x => x.Name));
        }
Exemplo n.º 3
0
 void AcquireBlock(GridScanArgs <IMyTerminalBlock> item)
 {
     if (item.First)
     {
         Updating = true;
         AssemblerUpdater.Dispose();
         foreach (var a in Assemblers)
         {
             a.Block = null;
         }
         Refineries.Clear();
     }
     if (Owner.PolicyCheck(Policy, item.Item))
     {
         if (item.Item is IMyRefinery)
         {
             Refineries.Add(item.Item as IMyRefinery);
         }
         if ((item.Item is IMyAssembler) && (!IgnoreSurvivalKits || (item.Item.BlockDefinition.TypeIdString != "MyObjectBuilder_SurvivalKit")))
         {
             bool found = false;
             foreach (var a in Assemblers)
             {
                 if (a.TryAttachBlock(item.Item))
                 {
                     found = true;
                     break;
                 }
             }
             if (!found)
             {
                 Assemblers.Add(new AssemblerInfo(item.Item as IMyAssembler));
             }
         }
     }
     if (item.Last)
     {
         for (int i = Assemblers.Count - 1; i >= 0; i--)
         {
             if (!Assemblers[i].HasBlock)
             {
                 Assemblers.RemoveAt(i);
             }
         }
         Assemblers.Sort((a, b) => a.Block.CustomName.CompareTo(b.Block.CustomName));
         Assemblers.Sort((a, b) => a.Block.CubeGrid.EntityId.CompareTo(b.Block.CubeGrid.EntityId));
         Refineries.Sort((a, b) => a.CustomName.CompareTo(b.CustomName));
         Refineries.Sort((a, b) => a.CubeGrid.EntityId.CompareTo(b.CubeGrid.EntityId));
         AssemblerUpdater = Assemblers.GetEnumerator();
         Updating         = false;
     }
 }
 public XmlTransmitVariant2()
 {
     Description = "XML send micro pipeline.";
     Version     = new Version(1, 0);
     PreAssemblers
     .Add(new FailedMessageRoutingEnablerComponent {
         SuppressRoutingFailureReport = false
     })
     .Add(new MicroPipelineComponent {
         Enabled = true
     });
     Assemblers
     .Add(new XmlAsmComp());
 }
 public TrackingXmlTransmitVariant2()
 {
     Description = "XML send pipeline with tracking.";
     Version     = new Version(1, 0);
     PreAssemblers
     .Add(
         new FailedMessageRoutingEnablerComponent {
         SuppressRoutingFailureReport = false
     })
     .Add(
         new ActivityTrackerComponent {
         TrackingModes = ActivityTrackingModes.Context
     });
     Assemblers
     .Add(new XmlAsmComp());
 }
Exemplo n.º 6
0
        void Load(MyIni state)
        {
            if (LoadConfig)
            {
                Policy             = state.Get(ID, "Policy").ToString();
                IgnoreSurvivalKits = state.Get(ID, "IgnoreSurvivalKits").ToBoolean(true);
                Owner.Unsubscribe(UpdateProductionState, Tick);
                Tick = Owner.Subscribe(UpdateProductionState, state.Get(ID, "Update").ToString(), "update100s");
            }
            List <MyIniKey> keys = new List <MyIniKey>();

            Assemblers.Clear();
            Refineries.Clear();
            state.GetKeys(ID + ".Assemblers", keys);
            foreach (var key in keys)
            {
                Assemblers.Add(new AssemblerInfo(key.Name, state.Get(key).ToString()));
            }
        }