/// <summary> /// Default constructor /// </summary> /// <param name="assemblyItem"></param> public FactorioAssembly(FactorioItem assemblyItem) { AssemblyItem = assemblyItem; Quantity = 1; if (assemblyItem.Recipe == null) { return; } foreach (var item in assemblyItem.Recipe) { SubAssembly.Add(new FactorioAssembly(item.Key, this, item.Value)); } }
/// <summary> /// Constructor for subassemblies /// </summary> /// <param name="assemblyItem"></param> /// <param name="topAssembly"></param> /// <param name="quantity"></param> public FactorioAssembly(FactorioItem assemblyItem, FactorioAssembly topAssembly, int quantity) { AssemblyItem = assemblyItem; ItemQuantity = quantity; m_topAssembly = topAssembly; Quantity = (quantity * ((topAssembly.Quantity * topAssembly.AssemblyItem.Productivity)) / (assemblyItem.Productivity * topAssembly.AssemblyItem.CraftingOutput)); Quantity *= topAssembly.CraftingSpeed / CraftingSpeed; if (assemblyItem.Recipe != null) { foreach (var item in assemblyItem.Recipe) { SubAssembly.Add(new FactorioAssembly(item.Key, this, item.Value)); } } }