public RefineryWorklist(OreTypes oreTypes, IngotTypes ingotTypes, RefineryFactory refineryFactory, Blueprints blueprints) { this.oreTypes = oreTypes; iterators = new Dictionary <ItemType, IRefineryIterator>(ingotTypes.All.Count); blueprintsByIngotTypeAndBlockDefinition = new Dictionary <KeyValuePair <ItemType, string>, Blueprint[]>(refineryFactory.AllTypes.Count * ingotTypes.All.Count); blockDefinitionsByIngotType = new Dictionary <ItemType, string[]>(ingotTypes.All.Count); var blocks = new List <string>(refineryFactory.AllTypes.Count); foreach (var ingotType in ingotTypes.AllIngotItemTypes) { var bps = blueprints.GetBlueprintsProducing(ingotType); blocks.Clear(); foreach (var refineryType in refineryFactory.AllTypes) { var matchingBps = bps.Where(refineryType.Supports).ToArray(); var key = new KeyValuePair <ItemType, string>(ingotType, refineryType.BlockDefinitionName); blueprintsByIngotTypeAndBlockDefinition.Add(key, matchingBps); if (matchingBps.Length > 0) { blocks.Add(refineryType.BlockDefinitionName); } } blockDefinitionsByIngotType.Add(ingotType, blocks.ToArray()); iterators[ingotType] = new RefineryIterator(this, ingotType); } }
public StaticState(RequestedConfiguration configuration) { Blueprints = new Blueprints(Constants.BLUEPRINTS); RefineryFactory = new RefineryFactory(Constants.REFINERY_TYPES); var ores = Constants.BLUEPRINTS.Select(b => b.Input.ItemType).Distinct(); OreTypes = new OreTypes(ores, Constants.BLUEPRINTS); var ingotTypes = PrepareIngotTypes(configuration, Blueprints).ToArray(); IngotTypes = new IngotTypes(ingotTypes); RefinerySpeedFactor = configuration.RefinerySpeedFactor; AssemblerSpeedFactor = configuration.AssemblerSpeedFactor; IngotStatusDisplayName = configuration.IngotStatusDisplayName; OreStatusDisplayName = configuration.OreStatusDisplayName; InventoryBlockNames = configuration.InventoryBlockNames; }