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()); }
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())); } }