mirror of
https://github.com/soarqin/DSP_Mods.git
synced 2026-11-19 17:05:20 +08:00
feat(uxassist): generate blueprint production descriptions
Add native blueprint description generation with proliferation controls, separate power categories, and steady-state material and research reporting. Distinguish necessary coproducts from overbuild and fractional headroom, with regression checks and updated architecture documentation. Validation: 464 ProductionCheck checks and Release builds of UXAssist, CheatEnabler, and UniverseGenTweaks.
This commit is contained in:
1 parent
cc36edecc7
commit
ae44c3ca6a
16 files changed
+2294
-51
No files matched your search
@@ -22,6 +22,11 @@ internal static class Program
|
||||
ProliferatorGradesAndFinishedSpraying();
|
||||
BlackBoxBalancesAndThreshold();
|
||||
BlackBoxMixedModesAndDeficits();
|
||||
BlueprintJointProduction();
|
||||
BlueprintSteadyStateInputs();
|
||||
BlueprintMixedProducersAndCycles();
|
||||
BlueprintProliferationAndCompleteness();
|
||||
BlueprintDescriptionFormattingAndFields();
|
||||
LogisticsChargingPower();
|
||||
FractionationFlow();
|
||||
AccumulatorRoundTrip();
|
||||
@@ -708,6 +713,8 @@ internal static class Program
|
||||
Equal(180, report.ItemFlows[2].GrossProduction, "tiers retain separate capacities");
|
||||
Equal(150, report.ItemFlows[2].GrossConsumption, "downstream runs at full load");
|
||||
Equal(30, report.ItemFlows[2].Surplus, "fractional intermediate balance retained");
|
||||
Equal(0, report.ItemFlows[2].OverbuildSurplus.Value,
|
||||
"sub-building ratio headroom is not redundant whole-building capacity");
|
||||
Equal(60, report.ItemFlows[2].SingleBuildingSurplusThreshold, "smallest actual producer threshold");
|
||||
Check(!report.ItemFlows[2].IsExcessIntermediate, "sub-threshold surplus is normally balanced");
|
||||
Equal(2, report.ItemFlows[2].ProducerGroups.Count, "producer groups retained");
|
||||
@@ -721,6 +728,8 @@ internal static class Program
|
||||
speedFactor: 0.8));
|
||||
var atThreshold = analyzer.Analyze(request);
|
||||
Equal(60, atThreshold.ItemFlows[2].Surplus, "intermediate at threshold");
|
||||
Equal(60, atThreshold.ItemFlows[2].OverbuildSurplus.Value,
|
||||
"a removable whole building accounts for the true overbuild");
|
||||
Check(atThreshold.ItemFlows[2].IsExcessIntermediate, "threshold reached qualifies as excess");
|
||||
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(102, 10, 402, 1, ProliferationMode.None));
|
||||
@@ -1062,6 +1071,15 @@ internal static class Program
|
||||
"unknown Dyson power is not reported as zero");
|
||||
Check(missingTechnology.Diagnostics.Any(d => d.Code == ProductionDiagnosticCode.MissingOperatingParameter),
|
||||
"missing solar-loss technology is diagnosed");
|
||||
Check(missingTechnology.PowerBreakdown.FactoryComplete &&
|
||||
missingTechnology.PowerBreakdown.FactoryConsumptionWatts == 0,
|
||||
"unknown Dyson requirement does not erase known factory consumption");
|
||||
plan.OperatingParametersByRecipe[999] = parameters;
|
||||
var plannedWithoutLoss = new ProductionPlanner(catalog).Calculate(plan);
|
||||
Check(plannedWithoutLoss.MaterialComplete && !plannedWithoutLoss.PowerComplete &&
|
||||
plannedWithoutLoss.PowerBreakdown.FactoryComplete &&
|
||||
plannedWithoutLoss.PowerBreakdown.FactoryConsumptionWatts == 0,
|
||||
"planner retains calculable factory watts while Dyson requirement is unknown");
|
||||
}
|
||||
|
||||
private static void LauncherCyclesAndAmmunition()
|
||||
@@ -1173,6 +1191,8 @@ internal static class Program
|
||||
Check(!missing.MaterialComplete && missing.Diagnostics.Any(d =>
|
||||
d.Code == ProductionDiagnosticCode.MissingOperatingParameter),
|
||||
"unavailable gas composition is diagnosed instead of inventing outputs");
|
||||
Check(missing.PowerBreakdown.FactoryComplete && missing.PowerBreakdown.FactoryConsumptionWatts == 0,
|
||||
"missing gas composition does not turn collector self-fueling into grid consumption");
|
||||
}
|
||||
|
||||
private static void ResearchHashesAndMatrices()
|
||||
@@ -1181,17 +1201,27 @@ internal static class Program
|
||||
{
|
||||
new KeyValuePair<int, double>(6001, 2), new KeyValuePair<int, double>(6002, 1)
|
||||
});
|
||||
var otherTech = new ProductionTechnology(402, new[]
|
||||
{
|
||||
new KeyValuePair<int, double>(6001, 4), new KeyValuePair<int, double>(6002, 2),
|
||||
new KeyValuePair<int, double>(6003, 3), new KeyValuePair<int, double>(6004, 1),
|
||||
new KeyValuePair<int, double>(6005, 5), new KeyValuePair<int, double>(6006, 1)
|
||||
});
|
||||
var catalog = new ProductionCatalog(new[]
|
||||
{
|
||||
new ProductionItem(6001, 0, false, false, 0, 0),
|
||||
new ProductionItem(6002, 0, false, false, 0, 0),
|
||||
new ProductionItem(6003, 0, false, false, 0, 0),
|
||||
new ProductionItem(6004, 0, false, false, 0, 0),
|
||||
new ProductionItem(6005, 0, false, false, 0, 0),
|
||||
new ProductionItem(6006, 0, false, false, 0, 0),
|
||||
new ProductionItem(7000, 0, false, false, 4, 75)
|
||||
}, Array.Empty<ProductionRecipe>(), new[]
|
||||
{
|
||||
new ProductionBuilding(91, ProductionRecipeCategory.Research, 1, 1000, 100)
|
||||
}, new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 }, new[] { tech });
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 }, new[] { tech, otherTech }, Enumerable.Range(6001, 6));
|
||||
var settings = new Dictionary<string, double>
|
||||
{
|
||||
["ResearchMode"] = 1, ["TechId"] = 401, ["ResearchSpeed"] = 0.5
|
||||
@@ -1219,6 +1249,18 @@ internal static class Program
|
||||
Check(sprayed.Groups.Single().Process.ProliferationMode == ProliferationMode.ExtraProducts,
|
||||
"research mode does not mistake copied assembler speedup setting for hash mode");
|
||||
|
||||
settings["TechId"] = 999;
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 91, 0, 2,
|
||||
ProliferationMode.None, operatingParameters: settings);
|
||||
var unrecognizedTech = analyzer.Analyze(request);
|
||||
Check(!unrecognizedTech.MaterialComplete &&
|
||||
unrecognizedTech.Diagnostics.Any(d => d.Code == ProductionDiagnosticCode.InvalidRequest) &&
|
||||
unrecognizedTech.PowerBreakdown.FactoryComplete &&
|
||||
unrecognizedTech.PowerBreakdown.FactoryConsumptionWatts == 5000,
|
||||
"every research-mode lab retains full working power when its technology cannot be evaluated");
|
||||
Check(unrecognizedTech.PowerComplete && unrecognizedTech.Power?.ConsumptionWatts == 5000,
|
||||
"invalid research technology does not hide an independently known full-load power total");
|
||||
|
||||
settings.Remove("TechId");
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 91, 0, 1,
|
||||
ProliferationMode.None, operatingParameters: settings);
|
||||
@@ -1226,6 +1268,227 @@ internal static class Program
|
||||
Check(!missing.MaterialComplete && missing.Diagnostics.Any(d =>
|
||||
d.Code == ProductionDiagnosticCode.MissingOperatingParameter),
|
||||
"missing technology cannot silently report zero matrices");
|
||||
Check(missing.PowerBreakdown.FactoryComplete &&
|
||||
missing.PowerBreakdown.FactoryConsumptionWatts == 2500,
|
||||
"research power remains calculable without the technology when proliferation is enabled");
|
||||
Check(missing.PowerComplete && missing.Power?.ConsumptionWatts == 2500,
|
||||
"missing research technology does not hide rated total power");
|
||||
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(2, 91, 0, 2,
|
||||
ProliferationMode.None, operatingParameters: new Dictionary<string, double>
|
||||
{
|
||||
["ResearchMode"] = 1, ["TechId"] = 401, ["ResearchSpeed"] = 0.5
|
||||
}));
|
||||
var mixedResearch = analyzer.Analyze(request);
|
||||
Check(!mixedResearch.MaterialComplete && mixedResearch.PowerBreakdown.FactoryComplete &&
|
||||
mixedResearch.PowerBreakdown.FactoryConsumptionWatts == 7500,
|
||||
"all research-mode labs add their rated power even when settings differ");
|
||||
Check(mixedResearch.PowerComplete && mixedResearch.Power?.ConsumptionWatts == 7500,
|
||||
"every research-mode lab contributes to the independent power total");
|
||||
request.Buildings.RemoveAt(1);
|
||||
|
||||
var noSprayCatalog = new ProductionCatalog(catalog.Items.Values.Where(item => item.Id != 7000),
|
||||
Array.Empty<ProductionRecipe>(), catalog.Buildings.Values,
|
||||
new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 }, catalog.Technologies.Values,
|
||||
catalog.ResearchMatrixItemIds);
|
||||
var noSpray = new FactoryBlackBoxAnalyzer(noSprayCatalog).Analyze(request);
|
||||
Check(noSpray.PowerComplete && noSpray.Power?.ConsumptionWatts == 1000,
|
||||
"without a supported spray level, research mode still budgets full base power");
|
||||
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 91, 0, 2,
|
||||
ProliferationMode.None, operatingParameters: new Dictionary<string, double> { ["ResearchMode"] = 1 });
|
||||
request.ProliferationEnabled = false;
|
||||
var blueprintLab = analyzer.Analyze(request);
|
||||
Check(!blueprintLab.MaterialComplete && blueprintLab.PowerBreakdown.FactoryComplete &&
|
||||
blueprintLab.PowerBreakdown.FactoryConsumptionWatts == 2000,
|
||||
"blueprint research labs report working watts without transient technology or speed");
|
||||
Check(blueprintLab.PowerComplete && blueprintLab.Power?.ConsumptionWatts == 2000,
|
||||
"an unconfigured research blueprint reports known full-load power separately from unknown matrices");
|
||||
var researchDescription = BlueprintDescriptionFormatter.Format(blueprintLab, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
Check(researchDescription.Power == "Factory power 2kW" && researchDescription.Description == "",
|
||||
"blueprint descriptions show research power without inventing matrix materials");
|
||||
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 91, 0, 2,
|
||||
ProliferationMode.None, operatingParameters: new Dictionary<string, double>
|
||||
{
|
||||
["ResearchMode"] = 1, ["ResearchMatrixSink"] = 1,
|
||||
["TechId"] = 999, ["ResearchSpeed"] = 0.01
|
||||
});
|
||||
var assumed = analyzer.Analyze(request);
|
||||
Check(assumed.MaterialComplete && assumed.PowerComplete && assumed.Diagnostics.Count == 0,
|
||||
"blueprint labs do not require a valid research technology or speed");
|
||||
Check(assumed.ItemFlows.Count == 0 && assumed.ResearchHashesPerMinute == 0,
|
||||
"labs alone do not invent matrix inputs or research hashes");
|
||||
var assumedDescription = BlueprintDescriptionFormatter.Format(assumed, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
Check(assumedDescription.Power == "Factory power 2kW" && assumedDescription.Description == "",
|
||||
"research-only blueprints show power but no imaginary matrix demand");
|
||||
|
||||
request.ProliferationEnabled = true;
|
||||
var assumedSprayed = analyzer.Analyze(request);
|
||||
Check(assumedSprayed.MaterialComplete && assumedSprayed.PowerComplete &&
|
||||
assumedSprayed.ItemFlows.Count == 0,
|
||||
"spraying research stations does not invent matrix consumption");
|
||||
Equal(5000, assumedSprayed.Power.ConsumptionWatts,
|
||||
"every research station still uses its full sprayed power");
|
||||
var unsprayableResearch = new FactoryBlackBoxAnalyzer(noSprayCatalog).Analyze(request);
|
||||
Check(unsprayableResearch.MaterialComplete && unsprayableResearch.PowerComplete,
|
||||
"a catalog without proliferation keeps research material accounting complete");
|
||||
Equal(2000, unsprayableResearch.Power.ConsumptionWatts,
|
||||
"unavailable proliferation does not change full-load research power");
|
||||
var missingMatricesCatalog = new ProductionCatalog(catalog.Items.Values,
|
||||
catalog.Recipes.Values, catalog.Buildings.Values,
|
||||
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 },
|
||||
researchMatrixItemIds: catalog.ResearchMatrixItemIds);
|
||||
var missingMatrices = new FactoryBlackBoxAnalyzer(missingMatricesCatalog).Analyze(request);
|
||||
Check(missingMatrices.MaterialComplete && missingMatrices.PowerComplete &&
|
||||
missingMatrices.ItemFlows.Count == 0,
|
||||
"blueprint matrix routing does not depend on a catalog of unlocked technologies");
|
||||
var noNativeIdsCatalog = new ProductionCatalog(catalog.Items.Values, catalog.Recipes.Values,
|
||||
catalog.Buildings.Values, new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 }, catalog.Technologies.Values);
|
||||
var noNativeIds = new FactoryBlackBoxAnalyzer(noNativeIdsCatalog).Analyze(request);
|
||||
Check(!noNativeIds.MaterialComplete && noNativeIds.PowerComplete &&
|
||||
noNativeIds.Diagnostics.Any(d => d.Code == ProductionDiagnosticCode.MissingOperatingParameter),
|
||||
"missing native matrix IDs remain unknown without hiding research power");
|
||||
request.ProliferationEnabled = false;
|
||||
|
||||
var matrixCatalog = new ProductionCatalog(catalog.Items.Values.Concat(new[]
|
||||
{
|
||||
new ProductionItem(1, 0, true, false, 0, 0),
|
||||
new ProductionItem(2, 0, true, false, 0, 0),
|
||||
new ProductionItem(8000, 0, false, false, 0, 0)
|
||||
}), new[]
|
||||
{
|
||||
Recipe(910, new[] { (1, 1.0) }, new[]
|
||||
{
|
||||
(6001, 2.0), (6002, 1.0), (6003, 1.0),
|
||||
(6004, 1.0), (6005, 1.0), (6006, 1.0)
|
||||
}),
|
||||
Recipe(911, new[] { (6001, 1.0) }, new[] { (8000, 1.0) }),
|
||||
Recipe(912, new[] { (2, 1.0) }, new[] { (6001, 2.0) })
|
||||
}, catalog.Buildings.Values.Concat(new[]
|
||||
{
|
||||
new ProductionBuilding(92, ProductionRecipeCategory.Assemble, 1, 100, 10),
|
||||
new ProductionBuilding(93, ProductionRecipeCategory.Assemble, 1, 200, 20)
|
||||
}), new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 }, catalog.Technologies.Values,
|
||||
catalog.ResearchMatrixItemIds);
|
||||
var matrixRequest = new FactoryBlackBoxRequest();
|
||||
matrixRequest.Buildings.Add(new ProductionBuildingSnapshot(1, 92, 910, 3, ProliferationMode.None));
|
||||
matrixRequest.Buildings.Add(new ProductionBuildingSnapshot(2, 93, 911, 1, ProliferationMode.None));
|
||||
matrixRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 92, 912, 3, ProliferationMode.None));
|
||||
var withoutLab = new FactoryBlackBoxAnalyzer(matrixCatalog).Analyze(matrixRequest);
|
||||
Equal(0, withoutLab.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"without a research station, excess single-matrix production slows upstream");
|
||||
Equal(6, withoutLab.ItemFlows[6001].OverbuildSurplus.Value,
|
||||
"without a research station, unnecessary matrix production is excess");
|
||||
Check(withoutLab.ItemFlows[6002].IsFinalProduct,
|
||||
"without a research station, exported matrix production remains visible");
|
||||
var withoutLabText = BlueprintDescriptionFormatter.Format(withoutLab, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
Check(withoutLabText.Research == "" && withoutLabText.Warnings.Contains("Excess: " + TestItemTag(6001)) &&
|
||||
withoutLabText.Output.Contains(TestItemTag(6002) + " x3"),
|
||||
"without a research station, matrices use ordinary output and excess rules");
|
||||
|
||||
matrixRequest.Buildings.Add(new ProductionBuildingSnapshot(4, 91, 0, 1,
|
||||
ProliferationMode.None, operatingParameters: new Dictionary<string, double>
|
||||
{
|
||||
["ResearchMode"] = 1, ["ResearchMatrixSink"] = 1,
|
||||
["TechId"] = 999, ["ResearchSpeed"] = 0.01
|
||||
}));
|
||||
var withLab = new FactoryBlackBoxAnalyzer(matrixCatalog).Analyze(matrixRequest);
|
||||
Check(withLab.MaterialComplete && withLab.PowerComplete,
|
||||
"one research station accepts every matrix made inside the blueprint");
|
||||
foreach (var itemId in Enumerable.Range(6001, 6))
|
||||
{
|
||||
var flow = withLab.ItemFlows[itemId];
|
||||
Equal(itemId == 6001 ? 12 : 3, flow.GrossProduction,
|
||||
"research does not replace the known gross matrix production ledger");
|
||||
Equal(itemId == 6001 ? 1 : 0, flow.GrossConsumption,
|
||||
"a research sink does not invent numerical matrix consumption");
|
||||
Check(flow.IsFinalProduct && flow.IsResearchProduct && flow.OverbuildSurplus == 0 &&
|
||||
flow.CoproductSurplus == 0,
|
||||
"matrices absorbed by research remain final products without excess warnings");
|
||||
}
|
||||
Check(!withLab.ItemFlows[6001].IsExcessIntermediate,
|
||||
"matrix production absorbed by research is not flagged as overbuild");
|
||||
Equal(3, withLab.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"six-matrix production retains its full raw input throughput");
|
||||
Equal(3, withLab.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"one research station prevents throttling additional matrix-only producers");
|
||||
Equal(1800, withLab.Power.ConsumptionWatts,
|
||||
"one research station contributes its full power independently of matrix routing");
|
||||
var withLabText = BlueprintDescriptionFormatter.Format(withLab, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
var researchOutput = string.Join(", ", Enumerable.Range(6001, 6)
|
||||
.Select(itemId => TestItemTag(itemId) + " x" + (itemId == 6001 ? 11 : 3)));
|
||||
Check(withLabText.Input == TestItemTag(1) + " x3, " + TestItemTag(2) + " x3" &&
|
||||
withLabText.Output == TestItemTag(8000) + " x1" &&
|
||||
withLabText.Research == researchOutput && withLabText.Warnings == "" &&
|
||||
withLabText.Description == "Input: " + withLabText.Input + "\nOutput: " + withLabText.Output +
|
||||
"\nResearch: " + researchOutput,
|
||||
"the net matrix output appears once in research, separate from ordinary final products");
|
||||
|
||||
matrixRequest.Buildings[3] = new ProductionBuildingSnapshot(4, 91, 0, 2,
|
||||
ProliferationMode.None, operatingParameters: new Dictionary<string, double>
|
||||
{
|
||||
["ResearchMode"] = 1, ["ResearchMatrixSink"] = 1,
|
||||
["TechId"] = 401, ["ResearchSpeed"] = 1000000
|
||||
});
|
||||
var twoLabs = new FactoryBlackBoxAnalyzer(matrixCatalog).Analyze(matrixRequest);
|
||||
Equal(3, twoLabs.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"lab count and technology-specific research speed never throttle matrix producers");
|
||||
Equal(2800, twoLabs.Power.ConsumptionWatts,
|
||||
"each additional lab still contributes its rated power");
|
||||
|
||||
var noTechMatrixCatalog = new ProductionCatalog(matrixCatalog.Items.Values,
|
||||
matrixCatalog.Recipes.Values, matrixCatalog.Buildings.Values,
|
||||
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 },
|
||||
researchMatrixItemIds: matrixCatalog.ResearchMatrixItemIds);
|
||||
var noTechMatrixReport = new FactoryBlackBoxAnalyzer(noTechMatrixCatalog).Analyze(matrixRequest);
|
||||
Check(noTechMatrixReport.MaterialComplete && noTechMatrixReport.ItemFlows[6001].IsFinalProduct,
|
||||
"matrix producers remain final research output without technology records");
|
||||
Equal(3, noTechMatrixReport.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"unlocked-technology data cannot change upstream matrix throughput");
|
||||
|
||||
var oneMatrixRequest = new FactoryBlackBoxRequest();
|
||||
oneMatrixRequest.Buildings.Add(matrixRequest.Buildings[2]);
|
||||
oneMatrixRequest.Buildings.Add(matrixRequest.Buildings[3]);
|
||||
var oneMatrix = new FactoryBlackBoxAnalyzer(matrixCatalog).Analyze(oneMatrixRequest);
|
||||
Check(oneMatrix.MaterialComplete && oneMatrix.ItemFlows.Keys.OrderBy(itemId => itemId)
|
||||
.SequenceEqual(new[] { 2, 6001 }) && oneMatrix.ItemFlows[6001].IsFinalProduct &&
|
||||
oneMatrix.ItemFlows[6001].IsResearchProduct,
|
||||
"research output includes only the matrix types made in the blueprint");
|
||||
Equal(3, oneMatrix.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"a single produced matrix type retains full upstream inputs");
|
||||
var oneMatrixText = BlueprintDescriptionFormatter.Format(oneMatrix, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
Check(oneMatrixText.Output == "" && oneMatrixText.Research == TestItemTag(6001) + " x6" &&
|
||||
oneMatrixText.Description == "Input: " + oneMatrixText.Input +
|
||||
"\nResearch: " + oneMatrixText.Research,
|
||||
"research-only output does not add an empty ordinary output line");
|
||||
|
||||
var externalMatrixRequest = new FactoryBlackBoxRequest();
|
||||
externalMatrixRequest.Buildings.Add(matrixRequest.Buildings[1]);
|
||||
externalMatrixRequest.Buildings.Add(matrixRequest.Buildings[3]);
|
||||
var externalMatrix = new FactoryBlackBoxAnalyzer(matrixCatalog).Analyze(externalMatrixRequest);
|
||||
Equal(1, externalMatrix.ItemFlows[6001].RequiredExternalSupply,
|
||||
"other buildings still require externally supplied matrices when none are made");
|
||||
Equal(1, externalMatrix.ItemFlows[6001].SteadyStateExternalSupply.Value,
|
||||
"a research lab does not erase known external matrix requirements");
|
||||
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 91, 0, 1,
|
||||
ProliferationMode.None);
|
||||
@@ -1275,6 +1538,677 @@ internal static class Program
|
||||
var missing = planner.Calculate(request);
|
||||
Check(missing.MaterialComplete && !missing.PowerComplete,
|
||||
"missing auxiliary rating does not discard complete material ledger");
|
||||
Check(!missing.PowerBreakdown.FactoryComplete && missing.PowerBreakdown.LogisticsComplete,
|
||||
"planner marks factory consumption incomplete without inventing logistics demand");
|
||||
}
|
||||
|
||||
private static void BlueprintJointProduction()
|
||||
{
|
||||
var analyzer = new FactoryBlackBoxAnalyzer(BlueprintCatalog());
|
||||
var request = BlueprintRequest(2);
|
||||
var two = analyzer.Analyze(request);
|
||||
Check(two.MaterialComplete && two.PowerComplete, "two joint-production buildings are complete");
|
||||
Equal(120, two.ItemFlows[2].GrossProduction, "two upstream buildings run at full load");
|
||||
Equal(120, two.ItemFlows[2].GrossConsumption, "downstream demand stays at full load");
|
||||
Equal(0, two.ItemFlows[2].OverbuildSurplus.Value, "both upstream buildings are necessary");
|
||||
Equal(0, two.ItemFlows[3].OverbuildSurplus.Value, "joint output is not falsely redundant");
|
||||
Equal(90, two.ItemFlows[3].CoproductSurplus.Value, "necessary joint production leaves B90");
|
||||
Equal(4000, two.Power.ConsumptionWatts, "two upstream and one downstream consume full power");
|
||||
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 10, 610, 3, ProliferationMode.None);
|
||||
var three = analyzer.Analyze(request);
|
||||
Equal(180, three.ItemFlows[2].GrossProduction, "three upstream buildings retain their gross output");
|
||||
Equal(60, three.ItemFlows[2].OverbuildSurplus.Value, "third building's A60 is excess");
|
||||
Equal(60, three.ItemFlows[3].OverbuildSurplus.Value, "third building's B60 is excess");
|
||||
Equal(90, three.ItemFlows[3].CoproductSurplus.Value,
|
||||
"B90 from necessary buildings remains a separate coproduct");
|
||||
Equal(150, three.ItemFlows[3].Surplus, "original B150 balance is not replaced by reduced output");
|
||||
Equal(5000, three.Power.ConsumptionWatts, "the redundant building still consumes full power");
|
||||
Equal(3, three.ItemFlows[1].RequiredExternalSupply,
|
||||
"full-load raw material accounting remains unchanged");
|
||||
Equal(2, three.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"an idle redundant joint producer consumes no steady-state raw material");
|
||||
|
||||
var reordered = new FactoryBlackBoxRequest();
|
||||
reordered.Buildings.Add(request.Buildings[1]);
|
||||
reordered.Buildings.Add(new ProductionBuildingSnapshot(103, 10, 610, 1, ProliferationMode.None));
|
||||
reordered.Buildings.Add(new ProductionBuildingSnapshot(101, 10, 610, 1, ProliferationMode.None));
|
||||
reordered.Buildings.Add(new ProductionBuildingSnapshot(102, 10, 610, 1, ProliferationMode.None));
|
||||
var reverse = analyzer.Analyze(reordered);
|
||||
foreach (var itemId in new[] { 2, 3 })
|
||||
{
|
||||
Equal(three.ItemFlows[itemId].OverbuildSurplus.Value, reverse.ItemFlows[itemId].OverbuildSurplus.Value,
|
||||
"reordered equivalent buildings retain one shared overbuild budget");
|
||||
Equal(three.ItemFlows[itemId].CoproductSurplus.Value, reverse.ItemFlows[itemId].CoproductSurplus.Value,
|
||||
"reordered equivalent buildings retain their coproduct amounts");
|
||||
}
|
||||
Equal(three.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
reverse.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"steady-state inputs do not depend on blueprint building order");
|
||||
}
|
||||
|
||||
private static void BlueprintSteadyStateInputs()
|
||||
{
|
||||
var catalog = BlueprintCatalog();
|
||||
var fractionalCatalog = new ProductionCatalog(catalog.Items.Values,
|
||||
catalog.Recipes.Values.Where(recipe => recipe.Id != 611).Concat(new[]
|
||||
{
|
||||
Recipe(611, new[] { (2, 90.0), (3, 30.0) }, new[] { (4, 1.0) })
|
||||
}), catalog.Buildings.Values, new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||
var fractional = new FactoryBlackBoxAnalyzer(fractionalCatalog).Analyze(BlueprintRequest(2));
|
||||
Equal(2, fractional.ItemFlows[1].RequiredExternalSupply,
|
||||
"the full-load report retains raw consumption below one-building headroom");
|
||||
Equal(1.5, fractional.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"part of an upstream building slows when its output exceeds downstream demand");
|
||||
Equal(0, fractional.ItemFlows[2].OverbuildSurplus.Value,
|
||||
"fractional throttling does not create a false whole-building overbuild warning");
|
||||
Equal(0, fractional.ItemFlows[2].CoproductSurplus.Value,
|
||||
"the limiting joint product's fractional headroom is not an unavoidable coproduct");
|
||||
Equal(90, fractional.ItemFlows[3].CoproductSurplus.Value,
|
||||
"necessary whole joint producers retain the other product's rated coproduct");
|
||||
|
||||
var singleOutput = new FactoryBlackBoxRequest();
|
||||
singleOutput.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 612, 1, ProliferationMode.None));
|
||||
singleOutput.Buildings.Add(new ProductionBuildingSnapshot(2, 20, 611, 1, ProliferationMode.None));
|
||||
var single = new FactoryBlackBoxAnalyzer(catalog).Analyze(singleOutput);
|
||||
Equal(0.5, single.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"single-output headroom reduces upstream raw inputs without losing final capacity");
|
||||
Equal(120, single.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"unavailable intermediate material remains an external input");
|
||||
|
||||
var chainCatalog = new ProductionCatalog(new[]
|
||||
{
|
||||
new ProductionItem(1, 0, true, false, 0, 0),
|
||||
new ProductionItem(2, 710, false, false, 0, 0),
|
||||
new ProductionItem(3, 711, false, false, 0, 0),
|
||||
new ProductionItem(4, 712, false, false, 0, 0)
|
||||
}, new[]
|
||||
{
|
||||
Recipe(710, new[] { (1, 1.0) }, new[] { (2, 4.0) }),
|
||||
Recipe(711, new[] { (2, 4.0) }, new[] { (3, 2.0) }),
|
||||
Recipe(712, new[] { (3, 1.0) }, new[] { (4, 1.0) })
|
||||
}, new[] { new ProductionBuilding(10, ProductionRecipeCategory.Assemble, 1, 1000, 100) },
|
||||
new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 });
|
||||
var chainRequest = new FactoryBlackBoxRequest();
|
||||
chainRequest.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 710, 1, ProliferationMode.None));
|
||||
chainRequest.Buildings.Add(new ProductionBuildingSnapshot(2, 10, 711, 1, ProliferationMode.None));
|
||||
chainRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 10, 712, 1, ProliferationMode.None));
|
||||
var chain = new FactoryBlackBoxAnalyzer(chainCatalog).Analyze(chainRequest);
|
||||
Equal(0.5, chain.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"downstream throttling propagates through multiple upstream stages");
|
||||
Equal(0, chain.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"throttling does not invent external supply for balanced intermediates");
|
||||
Equal(1, chain.ItemFlows[4].GrossProduction,
|
||||
"final rated output remains unchanged when upstream inputs are capped");
|
||||
Equal(3000, chain.Power.ConsumptionWatts,
|
||||
"rated power remains distinct from estimated steady-state materials");
|
||||
}
|
||||
|
||||
private static void BlueprintMixedProducersAndCycles()
|
||||
{
|
||||
var analyzer = new FactoryBlackBoxAnalyzer(BlueprintCatalog());
|
||||
var request = BlueprintRequest(3);
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 10, 612, 1, ProliferationMode.None));
|
||||
var mixed = analyzer.Analyze(request);
|
||||
Equal(240, mixed.ItemFlows[3].GrossProduction, "single and joint B producers share the ledger");
|
||||
Equal(30, mixed.ItemFlows[3].GrossConsumption, "shared B keeps its downstream consumption");
|
||||
Equal(120, mixed.ItemFlows[3].OverbuildSurplus.Value,
|
||||
"one joint and one single-output building are both redundant");
|
||||
Equal(90, mixed.ItemFlows[3].CoproductSurplus.Value,
|
||||
"B90 from necessary joint production is not counted as excess again");
|
||||
Equal(60, mixed.ItemFlows[2].OverbuildSurplus.Value,
|
||||
"all products of the removable joint building are accounted for");
|
||||
Equal(6000, mixed.Power.ConsumptionWatts, "mixed producers keep original full-load power");
|
||||
Equal(2, mixed.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"shared intermediate producers use one steady-state raw material budget");
|
||||
|
||||
var catalog = BlueprintCatalog();
|
||||
var consumedJointCatalog = new ProductionCatalog(catalog.Items.Values,
|
||||
catalog.Recipes.Values.Where(recipe => recipe.Id != 611).Concat(new[]
|
||||
{
|
||||
Recipe(611, new[] { (2, 60.0), (3, 90.0) }, new[] { (4, 1.0) })
|
||||
}), catalog.Buildings.Values, new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 });
|
||||
var consumedJointRequest = BlueprintRequest(1);
|
||||
consumedJointRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 10, 612, 1,
|
||||
ProliferationMode.None));
|
||||
var consumedJoint = new FactoryBlackBoxAnalyzer(consumedJointCatalog).Analyze(consumedJointRequest);
|
||||
Equal(30, consumedJoint.ItemFlows[3].Surplus,
|
||||
"mixed producers retain their full-load ratio headroom");
|
||||
Equal(0, consumedJoint.ItemFlows[3].OverbuildSurplus.Value,
|
||||
"both mixed producers are needed at the whole-building level");
|
||||
Equal(0, consumedJoint.ItemFlows[3].CoproductSurplus.Value,
|
||||
"fully consumed joint output does not turn single-product headroom into a coproduct");
|
||||
Equal(1.5, consumedJoint.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"single-product headroom still reduces steady-state input");
|
||||
var consumedJointText = BlueprintDescriptionFormatter.Format(consumedJoint, TestItemTag,
|
||||
new BlueprintDescriptionLabels("Factory power", "Logistics power", "Missing: ", "Excess: ", "Unknown",
|
||||
"(known portion)", "Input: ", "Output: ", "Research: "));
|
||||
Check(!consumedJointText.Output.Contains(TestItemTag(3)),
|
||||
"the description does not export internally consumed joint products");
|
||||
|
||||
var sharedJointCatalog = new ProductionCatalog(catalog.Items.Values,
|
||||
catalog.Recipes.Values.Where(recipe => recipe.Id != 611 && recipe.Id != 612).Concat(new[]
|
||||
{
|
||||
Recipe(611, new[] { (2, 60.0), (3, 90.0), (5, 60.0) }, new[] { (4, 1.0) }),
|
||||
Recipe(612, new[] { (1, 1.0) }, new[] { (3, 60.0), (5, 60.0) })
|
||||
}), catalog.Buildings.Values, new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 });
|
||||
var sharedJoint = new FactoryBlackBoxAnalyzer(sharedJointCatalog).Analyze(consumedJointRequest);
|
||||
Equal(30, sharedJoint.ItemFlows[3].CoproductSurplus.Value,
|
||||
"necessary joint producers share internal consumption before exposing a coproduct");
|
||||
Equal(0, sharedJoint.ItemFlows[3].OverbuildSurplus.Value,
|
||||
"shared coproduct output does not imply a removable joint producer");
|
||||
Equal(2, sharedJoint.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"both necessary joint producers retain their steady-state input");
|
||||
|
||||
var reversedResults = new ProductionCatalog(catalog.Items.Values,
|
||||
catalog.Recipes.Values.Where(recipe => recipe.Id != 610).Concat(new[]
|
||||
{
|
||||
Recipe(610, new[] { (1, 1.0) }, new[] { (3, 60.0), (2, 60.0) })
|
||||
}), catalog.Buildings.Values,
|
||||
new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||
var alternate = new FactoryBlackBoxAnalyzer(reversedResults).Analyze(request);
|
||||
Equal(mixed.ItemFlows[3].OverbuildSurplus.Value, alternate.ItemFlows[3].OverbuildSurplus.Value,
|
||||
"overbuild does not depend on a recipe's result array order");
|
||||
Equal(mixed.ItemFlows[3].CoproductSurplus.Value, alternate.ItemFlows[3].CoproductSurplus.Value,
|
||||
"coproduct does not depend on a recipe's result array order");
|
||||
|
||||
var shortage = analyzer.Analyze(BlueprintRequest(1));
|
||||
Equal(60, shortage.ItemFlows[2].IntermediateShortage,
|
||||
"joint production with insufficient A reports an intermediate shortage");
|
||||
Equal(60, shortage.ItemFlows[2].RequiredExternalSupply,
|
||||
"intermediate shortages remain external material requirements");
|
||||
Equal(60, shortage.ItemFlows[2].SteadyStateExternalSupply.Value,
|
||||
"stable throughput never worsens an existing intermediate shortage");
|
||||
Equal(0, shortage.ItemFlows[2].OverbuildSurplus.Value, "a needed producer cannot be removed");
|
||||
Equal(30, shortage.ItemFlows[3].CoproductSurplus.Value,
|
||||
"a known A shortage does not hide independently known B coproduct");
|
||||
Equal(3000, shortage.Power.ConsumptionWatts, "shortage does not throttle downstream power");
|
||||
|
||||
request.Buildings.Clear();
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 620, 1, ProliferationMode.None));
|
||||
var returned = analyzer.Analyze(request);
|
||||
Equal(1, returned.ItemFlows[2].GrossProduction, "returned material keeps gross production");
|
||||
Equal(1, returned.ItemFlows[2].GrossConsumption, "returned material keeps gross consumption");
|
||||
Equal(0, returned.ItemFlows[2].RequiredExternalSupply,
|
||||
"internal return does not create a false external input");
|
||||
Check(!returned.ItemFlows[2].IsFinalProduct, "a pure material return is not a final product");
|
||||
Equal(60, returned.ItemFlows[3].Surplus, "the same recipe still supplies its net output");
|
||||
|
||||
request.Buildings.Clear();
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 621, 1, ProliferationMode.None));
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(2, 10, 622, 1, ProliferationMode.None));
|
||||
var cycle = analyzer.Analyze(request);
|
||||
foreach (var itemId in new[] { 5, 6 })
|
||||
{
|
||||
Equal(1, cycle.ItemFlows[itemId].GrossProduction, "cyclic production stays gross");
|
||||
Equal(1, cycle.ItemFlows[itemId].GrossConsumption, "cyclic consumption stays gross");
|
||||
Equal(0, cycle.ItemFlows[itemId].IntermediateShortage, "balanced cycle has no missing inputs");
|
||||
Equal(0, cycle.ItemFlows[itemId].OverbuildSurplus.Value, "balanced cycle has no excess");
|
||||
Equal(0, cycle.ItemFlows[itemId].CoproductSurplus.Value, "balanced cycle has no coproduct");
|
||||
}
|
||||
}
|
||||
|
||||
private static void BlueprintProliferationAndCompleteness()
|
||||
{
|
||||
var analyzer = new FactoryBlackBoxAnalyzer(BlueprintCatalog());
|
||||
var sprayedRequest = new FactoryBlackBoxRequest { ProliferationEnabled = true };
|
||||
sprayedRequest.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 610, 1,
|
||||
ProliferationMode.ExtraProducts));
|
||||
sprayedRequest.Buildings.Add(new ProductionBuildingSnapshot(2, 10, 610, 1,
|
||||
ProliferationMode.Speedup));
|
||||
var sprayed = analyzer.Analyze(sprayedRequest);
|
||||
Equal(195, sprayed.ItemFlows[2].GrossProduction,
|
||||
"highest captured proliferation keeps distinct extra-product and speedup modes");
|
||||
Check(sprayed.Groups[0].Process.ProliferationMode == ProliferationMode.ExtraProducts &&
|
||||
sprayed.Groups[1].Process.ProliferationMode == ProliferationMode.Speedup &&
|
||||
sprayed.Groups.All(group => group.Process.ProliferationLevel == 4),
|
||||
"each building retains its native mode at the highest supported level");
|
||||
Check(!sprayed.ItemFlows.ContainsKey(7), "externally supplied input coating adds no inferred spray flow");
|
||||
sprayedRequest.ProliferationEnabled = false;
|
||||
var unsprayed = analyzer.Analyze(sprayedRequest);
|
||||
Equal(120, unsprayed.ItemFlows[2].GrossProduction, "unchecked proliferation restores plain capacity");
|
||||
Equal(2000, unsprayed.Power.ConsumptionWatts, "unchecked proliferation restores plain power");
|
||||
|
||||
var request = BlueprintRequest(2);
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 30, 0, 1, ProliferationMode.None,
|
||||
operatingParameters: new Dictionary<string, double> { ["ChargePowerWatts"] = 600000000 }));
|
||||
var complete = analyzer.Analyze(request);
|
||||
Equal(4000, complete.PowerBreakdown.FactoryConsumptionWatts.Value,
|
||||
"factory consumption excludes selected logistics chargers");
|
||||
Equal(600000000, complete.PowerBreakdown.LogisticsConsumptionWatts.Value,
|
||||
"logistics consumption uses configured charging maximum");
|
||||
Equal(600004000, complete.Power.ConsumptionWatts, "the existing total still includes both categories");
|
||||
Equal(0, complete.Power.AccumulatorChargingWatts,
|
||||
"logistics charging does not become accumulator exchange");
|
||||
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(4, 31, 0, 1, ProliferationMode.None));
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(5, 32, 0, 1, ProliferationMode.None));
|
||||
var withAuxiliaries = analyzer.Analyze(request);
|
||||
Equal(5100, withAuxiliaries.PowerBreakdown.FactoryConsumptionWatts.Value,
|
||||
"sorters and spray coaters add to factory rather than logistics consumption");
|
||||
Equal(600000000, withAuxiliaries.PowerBreakdown.LogisticsConsumptionWatts.Value,
|
||||
"non-logistics auxiliary watts do not change charging limits");
|
||||
request.Buildings.RemoveRange(3, 2);
|
||||
|
||||
request.Buildings[2] = new ProductionBuildingSnapshot(3, 30, 0, 1, ProliferationMode.None);
|
||||
var missingLogistics = analyzer.Analyze(request);
|
||||
Check(missingLogistics.MaterialComplete && !missingLogistics.PowerComplete &&
|
||||
missingLogistics.PowerBreakdown.FactoryComplete &&
|
||||
!missingLogistics.PowerBreakdown.LogisticsComplete,
|
||||
"unknown logistics charging does not discard known factory watts");
|
||||
Equal(4000, missingLogistics.PowerBreakdown.FactoryConsumptionWatts.Value,
|
||||
"factory category remains usable when logistics power is unknown");
|
||||
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 10, 999, 2, ProliferationMode.None);
|
||||
request.Buildings[2] = new ProductionBuildingSnapshot(3, 30, 0, 1, ProliferationMode.None,
|
||||
operatingParameters: new Dictionary<string, double> { ["ChargePowerWatts"] = 600000000 });
|
||||
var missingFactory = analyzer.Analyze(request);
|
||||
Check(!missingFactory.MaterialComplete && !missingFactory.PowerComplete &&
|
||||
!missingFactory.PowerBreakdown.FactoryComplete && missingFactory.PowerBreakdown.LogisticsComplete,
|
||||
"unknown factory process does not discard known logistics charging");
|
||||
Equal(600000000, missingFactory.PowerBreakdown.LogisticsConsumptionWatts.Value,
|
||||
"known logistics consumption remains independently reportable");
|
||||
|
||||
request = BlueprintRequest(3);
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 40, 0, 2, ProliferationMode.None,
|
||||
operatingParameters: new Dictionary<string, double> { ["MachineSpeedFactor"] = 1.5 }));
|
||||
var partialMaterials = analyzer.Analyze(request);
|
||||
Check(!partialMaterials.MaterialComplete && !partialMaterials.PowerComplete &&
|
||||
partialMaterials.PowerBreakdown.FactoryComplete,
|
||||
"a miner lacking blueprint resource context retains calculable native demand");
|
||||
Equal(22500, partialMaterials.PowerBreakdown.FactoryConsumptionWatts.Value,
|
||||
"miner speed-ratio watts add to the other full-load factory consumers");
|
||||
Check(partialMaterials.ItemFlows[3].OverbuildSurplus == null &&
|
||||
partialMaterials.ItemFlows[3].CoproductSurplus == null,
|
||||
"partial materials cannot establish overbuild or coproduct conclusions");
|
||||
Equal(3, partialMaterials.ItemFlows[1].RequiredExternalSupply,
|
||||
"partial materials retain the full-load input ledger");
|
||||
Equal(2, partialMaterials.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"unrelated unknown settings do not prevent capping known upstream inputs");
|
||||
Equal(1, partialMaterials.ItemFlows[4].NetFlow,
|
||||
"partial material estimates keep independently known rated final outputs");
|
||||
|
||||
var unknownRecipeRequest = BlueprintRequest(3);
|
||||
unknownRecipeRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 10, 999, 1,
|
||||
ProliferationMode.None));
|
||||
var unknownRecipe = analyzer.Analyze(unknownRecipeRequest);
|
||||
Equal(3, unknownRecipe.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"unknown downstream recipe must not be mistaken for zero demand");
|
||||
Check(!unknownRecipe.ItemFlows[4].IsFinalProduct,
|
||||
"an unrecognized downstream recipe cannot establish a final product");
|
||||
|
||||
var partialCatalog = new ProductionCatalog(BlueprintCatalog().Items.Values,
|
||||
BlueprintCatalog().Recipes.Values.Concat(new[]
|
||||
{
|
||||
new ProductionRecipe(613, ProductionRecipeCategory.Fractionate, 3600, false,
|
||||
new[] { new KeyValuePair<int, double>(2, 1) },
|
||||
new[] { new KeyValuePair<int, double>(4, 1) })
|
||||
}), BlueprintCatalog().Buildings.Values.Concat(new[]
|
||||
{
|
||||
new ProductionBuilding(50, ProductionRecipeCategory.Fractionate, 1, 300, 30,
|
||||
ProductionBuildingKind.Fractionator)
|
||||
}), new[] { 0.0 }, new[] { 0.0 }, new[] { 1.0 });
|
||||
var incompleteDownstreamRequest = BlueprintRequest(3);
|
||||
incompleteDownstreamRequest.Buildings.Add(new ProductionBuildingSnapshot(3, 50, 613, 1,
|
||||
ProliferationMode.None));
|
||||
var incompleteDownstream = new FactoryBlackBoxAnalyzer(partialCatalog).Analyze(incompleteDownstreamRequest);
|
||||
Check(incompleteDownstream.Diagnostics.Any(diagnostic =>
|
||||
diagnostic.Code == ProductionDiagnosticCode.MissingOperatingParameter),
|
||||
"missing fractionator throughput leaves its known input demand unmodeled");
|
||||
Equal(3, incompleteDownstream.ItemFlows[1].SteadyStateExternalSupply.Value,
|
||||
"an unresolved but known downstream input prevents underestimating its upstream supply");
|
||||
}
|
||||
|
||||
private static void BlueprintDescriptionFormattingAndFields()
|
||||
{
|
||||
var labels = new BlueprintDescriptionLabels("工厂耗电", "物流耗电", "缺少:", "多余:", "未知",
|
||||
"(已知部分)", "输入:", "输出:", "研究:");
|
||||
var joint = new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(BlueprintRequest(3));
|
||||
var text = BlueprintDescriptionFormatter.Format(joint, TestItemTag, labels);
|
||||
Check(text.Power == "工厂耗电 5kW", "absent logistics consumption is omitted");
|
||||
var warnings = "多余:" + TestItemTag(2) + " x60, " + TestItemTag(3) + " x60";
|
||||
Check(text.Input == TestItemTag(1) + " x2",
|
||||
"input excludes warnings and reflects upstream throughput capped by downstream demand");
|
||||
Check(text.Output == TestItemTag(3) + " x90, " + TestItemTag(4) + " x1",
|
||||
"coproduct appears once alongside the final product");
|
||||
Check(text.Warnings == warnings && text.Description == warnings + "\n输入:" + text.Input +
|
||||
"\n输出:" + text.Output,
|
||||
"excess items share one labeled line before input and output");
|
||||
Check(!text.Input.Contains(((char)10).ToString()) && !text.Output.Contains(((char)10).ToString()),
|
||||
"each material line retains comma-separated entries without embedded breaks");
|
||||
|
||||
var shortage = BlueprintDescriptionFormatter.Format(
|
||||
new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(BlueprintRequest(1)), TestItemTag, labels);
|
||||
Check(shortage.Description.StartsWith("缺少:" + TestItemTag(2) + " x60\n输入:") &&
|
||||
!shortage.Input.Contains("缺少"),
|
||||
"shortage warnings are placed before inputs rather than inside them");
|
||||
|
||||
var warningOnlyReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
new[]
|
||||
{
|
||||
new ProductionItemFlow(52, 2, 3, 0, 0, 0, 0, 1,
|
||||
false, false, 0, Array.Empty<int>(), Array.Empty<int>(), 1, 0, 0),
|
||||
new ProductionItemFlow(53, 1, 3, 0, 0, 0, 0, 2,
|
||||
false, false, 0, Array.Empty<int>(), Array.Empty<int>(), 2, 0, 0),
|
||||
new ProductionItemFlow(54, 3, 0, 0, 0, 0, 3, 0,
|
||||
false, true, 3, Array.Empty<int>(), Array.Empty<int>(), 0, 3, 0)
|
||||
},
|
||||
Array.Empty<ProductionGroupFlow>(), Array.Empty<ProductionDiagnostic>(),
|
||||
new ProductionPower(0, 0, 0, 0, 0, 0, ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(0, 0, true, true));
|
||||
var warningOnly = BlueprintDescriptionFormatter.Format(warningOnlyReport, TestItemTag, labels);
|
||||
var warningLines = "缺少:" + TestItemTag(52) + " x1, " + TestItemTag(53) + " x2" +
|
||||
"\n多余:" + TestItemTag(54) + " x3";
|
||||
Check(warningOnly.Warnings == warningLines && warningOnly.Description == warningLines &&
|
||||
warningOnly.Input == "" && warningOnly.Output == "" && warningOnly.Research == "",
|
||||
"missing and excess use separate aligned lines without repeating labels or adding empty lines");
|
||||
|
||||
var powerOnly = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
Array.Empty<ProductionItemFlow>(), Array.Empty<ProductionGroupFlow>(),
|
||||
Array.Empty<ProductionDiagnostic>(), new ProductionPower(3100000000, 3100000000, 0, 0, 0, 0,
|
||||
ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(2500000000, 600000000, true, true));
|
||||
var large = BlueprintDescriptionFormatter.Format(powerOnly, TestItemTag, labels);
|
||||
Check(large.Power == "工厂耗电 2.5GW | 物流耗电 600MW",
|
||||
"gigawatt and megawatt display matches the native Chinese field example");
|
||||
Check(large.Input == "" && large.Output == "" && large.Description == "",
|
||||
"empty material categories add no description lines");
|
||||
|
||||
var logisticsRequest = new FactoryBlackBoxRequest();
|
||||
logisticsRequest.Buildings.Add(new ProductionBuildingSnapshot(1, 30, 0, 1, ProliferationMode.None,
|
||||
operatingParameters: new Dictionary<string, double> { ["ChargePowerWatts"] = 600000000 }));
|
||||
var logisticsOnly = BlueprintDescriptionFormatter.Format(
|
||||
new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(logisticsRequest), TestItemTag, labels);
|
||||
Check(logisticsOnly.Power == "物流耗电 600MW" && logisticsOnly.Description == "",
|
||||
"logistics-only blueprints do not show empty factory or material categories");
|
||||
logisticsRequest.Buildings[0] = new ProductionBuildingSnapshot(1, 30, 0, 1, ProliferationMode.None);
|
||||
var unknownLogistics = BlueprintDescriptionFormatter.Format(
|
||||
new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(logisticsRequest), TestItemTag, labels);
|
||||
Check(unknownLogistics.Power == "物流耗电 未知",
|
||||
"unknown charging demand is not omitted as an absent building");
|
||||
|
||||
var request = BlueprintRequest(2);
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 30, 0, 1, ProliferationMode.None,
|
||||
operatingParameters: new Dictionary<string, double> { ["ChargePowerWatts"] = 600000000 }));
|
||||
request.Buildings[0] = new ProductionBuildingSnapshot(1, 10, 999, 2, ProliferationMode.None);
|
||||
var missingFactory = new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(request);
|
||||
var partial = BlueprintDescriptionFormatter.Format(missingFactory, TestItemTag, labels);
|
||||
Check(partial.Power == "工厂耗电 未知 | 物流耗电 600MW",
|
||||
"unknown factory demand cannot become zero or erase known logistics power");
|
||||
Check(partial.Input.Contains("(已知部分)"),
|
||||
"known material inputs are explicitly identified as partial");
|
||||
|
||||
request = BlueprintRequest(3);
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 40, 0, 1, ProliferationMode.None));
|
||||
var partialProduction = new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(request);
|
||||
var knownText = BlueprintDescriptionFormatter.Format(partialProduction, TestItemTag, labels);
|
||||
Check(knownText.Input.Contains("(已知部分)") && knownText.Output.Contains("(已知部分)") &&
|
||||
!knownText.Input.Contains("多余") && !knownText.Output.Contains(TestItemTag(3)),
|
||||
"partial materials retain known rates without inferring excess or coproducts");
|
||||
Check(knownText.Input.Contains(TestItemTag(1) + " x2") &&
|
||||
!knownText.Input.Contains(TestItemTag(1) + " x3"),
|
||||
"partial descriptions cap known material inputs at downstream throughput");
|
||||
|
||||
request = new FactoryBlackBoxRequest();
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(3, 40, 0, 1, ProliferationMode.None));
|
||||
var noMaterial = new FactoryBlackBoxAnalyzer(BlueprintCatalog()).Analyze(request);
|
||||
partial = BlueprintDescriptionFormatter.Format(noMaterial, TestItemTag, labels);
|
||||
Check(partial.Input == "" && partial.Output == "" && partial.Description == "",
|
||||
"unknown materials without known entries do not create empty lines");
|
||||
Check(partial.Power == "工厂耗电 4kW",
|
||||
"the miner's independent power remains available without its resource context");
|
||||
|
||||
var failed = false;
|
||||
try
|
||||
{
|
||||
BlueprintDescriptionFormatter.Format(ProductionReport.Failure(new ProductionDiagnostic(
|
||||
ProductionDiagnosticCode.DataNotReady, "Data is not ready.")), TestItemTag, labels);
|
||||
}
|
||||
catch (InvalidOperationException)
|
||||
{
|
||||
failed = true;
|
||||
}
|
||||
|
||||
Check(failed, "unavailable catalog cannot be formatted as a complete zero report");
|
||||
|
||||
var fractional = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
new[]
|
||||
{
|
||||
new ProductionItemFlow(42, 0.125, 0, 0, 0, 0, 0.125, 0,
|
||||
true, false, 0, Array.Empty<int>(), Array.Empty<int>()),
|
||||
new ProductionItemFlow(43, 1.2, 0, 0, 0, 0, 1.2, 0,
|
||||
true, false, 0, Array.Empty<int>(), Array.Empty<int>())
|
||||
}, Array.Empty<ProductionGroupFlow>(), Array.Empty<ProductionDiagnostic>(),
|
||||
new ProductionPower(0, 0, 0, 0, 0, 0, ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(0, 0, true, true));
|
||||
var rounded = BlueprintDescriptionFormatter.Format(fractional, TestItemTag, labels);
|
||||
Check(rounded.Output == TestItemTag(42) + " x0.125, " + TestItemTag(43) + " x1.2",
|
||||
"display rounding retains small nonzero rates and omits unnecessary trailing zeros");
|
||||
Check(rounded.Power == "" && rounded.Input == "" &&
|
||||
rounded.Description == "输出:" + rounded.Output,
|
||||
"no consumers means no power field and an output-only report has one line");
|
||||
|
||||
var inputOnlyReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
new[] { new ProductionItemFlow(51, 0, 3, 0, 0, 0, 0, 3,
|
||||
false, false, 0, Array.Empty<int>(), Array.Empty<int>()) },
|
||||
Array.Empty<ProductionGroupFlow>(), Array.Empty<ProductionDiagnostic>(),
|
||||
new ProductionPower(0, 0, 0, 0, 0, 0, ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(0, 0, true, true));
|
||||
var inputOnly = BlueprintDescriptionFormatter.Format(inputOnlyReport, TestItemTag, labels);
|
||||
Check(inputOnly.Output == "" && inputOnly.Description == "输入:" + inputOnly.Input,
|
||||
"an input-only report omits the empty output line");
|
||||
|
||||
var longReport = new ProductionReport(ProductionStatus.Complete, true, true,
|
||||
Enumerable.Range(1000, 140).Select(itemId => new ProductionItemFlow(itemId, 1.2, 0, 0, 0, 0, 1.2, 0,
|
||||
true, false, 0, Array.Empty<int>(), Array.Empty<int>())),
|
||||
Array.Empty<ProductionGroupFlow>(), Array.Empty<ProductionDiagnostic>(),
|
||||
new ProductionPower(0, 0, 0, 0, 0, 0, ProductionPowerScope.SelectedFacilities),
|
||||
new ProductionPowerBreakdown(0, 0, true, true));
|
||||
var longText = BlueprintDescriptionFormatter.Format(longReport, TestItemTag, labels);
|
||||
Check(longText.Description.Length > BlueprintDescriptionText.MaximumDescriptionLength &&
|
||||
!longText.Description.Contains("\n") && longText.Description.Contains(TestItemTag(1139)),
|
||||
"long material lines are not truncated and can be refused at the native description limit");
|
||||
TestNativeFields();
|
||||
}
|
||||
|
||||
private static void TestNativeFields()
|
||||
{
|
||||
var firstFields = TestBlueprintFields("2.5GW");
|
||||
var result = BlueprintDescriptionFields.TryUpdate("Other:unchanged;", firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var generated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated && generated == "Other:unchanged;Power:2.5GW;",
|
||||
"only the power field is appended while unrelated fields remain intact");
|
||||
|
||||
var escapedFields = TestBlueprintFields("2.5GW:250; " + (char)92 + "extra");
|
||||
result = BlueprintDescriptionFields.TryUpdate("", escapedFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var escaped);
|
||||
var escapedPower = escaped.Split(';')[0];
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
UnescapeNativeField(escapedPower.Substring(escapedPower.IndexOf(':') + 1)) == escapedFields[0].Value,
|
||||
"native backslash, semicolon, and colon escaping still round-trips power fields");
|
||||
|
||||
result = BlueprintDescriptionFields.TryUpdate(generated,
|
||||
TestBlueprintFields("3GW"), 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var repeated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated && repeated == "Other:unchanged;Power:3GW;",
|
||||
"repeated generation updates the power field without appending duplicates");
|
||||
|
||||
result = BlueprintDescriptionFields.TryUpdate(
|
||||
"Note:keep;Input (per minute):manual;Output (per minute):manual;Power:old;", firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var preserved);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
preserved == "Note:keep;Input (per minute):manual;Output (per minute):manual;Power:2.5GW;",
|
||||
"only the power field is updated; input and output custom fields remain untouched");
|
||||
|
||||
var partialExisting = "Unrelated:hand edited;Input:manual;";
|
||||
result = BlueprintDescriptionFields.TryUpdate(partialExisting,
|
||||
TestBlueprintFields("100MW"), 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var updated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
updated == "Unrelated:hand edited;Input:manual;Power:100MW;",
|
||||
"a custom input field remains unchanged when power is appended");
|
||||
|
||||
var chineseFields = new[]
|
||||
{
|
||||
new BlueprintDescriptionField("耗电", "新功率", "Power", "耗电")
|
||||
};
|
||||
result = BlueprintDescriptionFields.TryUpdate("Power:old;输入:manual;Output (per minute):manual;",
|
||||
chineseFields, 3, EscapeNativeField, UnescapeNativeField, out var translated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
translated == "耗电:新功率;输入:manual;Output (per minute):manual;",
|
||||
"English and Chinese power titles match while other localized fields remain unchanged");
|
||||
|
||||
var duplicateNames = "Power:old;耗电:old;Note:Power Input Output;输入(每分钟):manual;Output:manual;";
|
||||
result = BlueprintDescriptionFields.TryUpdate(duplicateNames,
|
||||
TestBlueprintFields("new"), 5, EscapeNativeField, UnescapeNativeField,
|
||||
out var keptDuplicates);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
keptDuplicates == "Power:new;Note:Power Input Output;输入(每分钟):manual;Output:manual;",
|
||||
"duplicate power slots are merged without modifying other titled fields");
|
||||
|
||||
var noPowerFields = TestBlueprintFields(null);
|
||||
result = BlueprintDescriptionFields.TryUpdate("Other:keep;Power:old;耗电:old;输入:manual;Output:manual;",
|
||||
noPowerFields, 20, EscapeNativeField, UnescapeNativeField, out var removed);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated && removed == "Other:keep;输入:manual;Output:manual;",
|
||||
"a blueprint without consumers removes only stale power fields");
|
||||
result = BlueprintDescriptionFields.TryUpdate("", noPowerFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var empty);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated && empty == "",
|
||||
"empty power and material categories do not create any custom fields");
|
||||
|
||||
var full = string.Concat(Enumerable.Range(0, 20).Select(index => "Custom" + index + ":keep;"));
|
||||
result = BlueprintDescriptionFields.TryUpdate(full, firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out var rejected);
|
||||
Check(result == BlueprintFieldUpdateResult.CapacityExceeded && rejected == full,
|
||||
"a missing power field at native capacity causes an all-or-nothing refusal");
|
||||
result = BlueprintDescriptionFields.TryUpdate(full, noPowerFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out updated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated && updated == full,
|
||||
"description-only generation needs no custom-field slot even at native capacity");
|
||||
var onePresent = "Power:old;" + string.Concat(Enumerable.Range(0, 19)
|
||||
.Select(index => "Custom" + index + ":keep;"));
|
||||
result = BlueprintDescriptionFields.TryUpdate(onePresent, firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out updated);
|
||||
Check(result == BlueprintFieldUpdateResult.Updated &&
|
||||
updated == "Power:2.5GW;" + onePresent.Substring("Power:old;".Length),
|
||||
"existing power fields can be updated at the native field limit");
|
||||
var otherFieldsAtCapacity = "Input:manual;Output:manual;" + string.Concat(Enumerable.Range(0, 18)
|
||||
.Select(index => "Custom" + index + ":keep;"));
|
||||
result = BlueprintDescriptionFields.TryUpdate(otherFieldsAtCapacity, firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out rejected);
|
||||
Check(result == BlueprintFieldUpdateResult.CapacityExceeded && rejected == otherFieldsAtCapacity,
|
||||
"other input and output fields cannot be removed to make room for power");
|
||||
|
||||
result = BlueprintDescriptionFields.TryUpdate("Unterminated:old", firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out rejected);
|
||||
Check(result == BlueprintFieldUpdateResult.InvalidFields && rejected == "Unterminated:old",
|
||||
"invalid native serialization is rejected without changing existing text");
|
||||
foreach (var malformed in new[] { "MissingDelimiter;", "Too:many:delimiters;", "Valid:value;;" })
|
||||
{
|
||||
Check(!BlueprintDescriptionFields.IsNativeFormatValid(malformed),
|
||||
"malformed native fields are detected before the inspector collects pending edits");
|
||||
result = BlueprintDescriptionFields.TryUpdate(malformed, firstFields, 20,
|
||||
EscapeNativeField, UnescapeNativeField, out rejected);
|
||||
Check(result == BlueprintFieldUpdateResult.InvalidFields && rejected == malformed,
|
||||
"malformed native fields cannot be partially replaced or silently discarded");
|
||||
}
|
||||
}
|
||||
|
||||
private static BlueprintDescriptionField[] TestBlueprintFields(string power)
|
||||
{
|
||||
return new[] { new BlueprintDescriptionField("Power", power, "耗电") };
|
||||
}
|
||||
|
||||
private static string EscapeNativeField(string value)
|
||||
{
|
||||
var serialized = new System.Text.StringBuilder();
|
||||
foreach (var character in value)
|
||||
{
|
||||
if (character == (char)92) serialized.Append((char)92).Append((char)92);
|
||||
else if (character == ';') serialized.Append((char)92).Append('b');
|
||||
else if (character == ':') serialized.Append((char)92).Append('c');
|
||||
else serialized.Append(character);
|
||||
}
|
||||
|
||||
return serialized.ToString();
|
||||
}
|
||||
|
||||
private static string UnescapeNativeField(string value)
|
||||
{
|
||||
var text = new System.Text.StringBuilder();
|
||||
for (var index = 0; index < value.Length; index++)
|
||||
{
|
||||
if (value[index] != (char)92 || index + 1 >= value.Length)
|
||||
{
|
||||
text.Append(value[index]);
|
||||
continue;
|
||||
}
|
||||
|
||||
index++;
|
||||
switch (value[index])
|
||||
{
|
||||
case 'b': text.Append(';'); break;
|
||||
case 'c': text.Append(':'); break;
|
||||
case (char)92: text.Append((char)92); break;
|
||||
default: text.Append((char)92).Append(value[index]); break;
|
||||
}
|
||||
}
|
||||
|
||||
return text.ToString();
|
||||
}
|
||||
|
||||
private static string TestItemTag(int itemId)
|
||||
{
|
||||
return ((char)92).ToString() + "item" + itemId + "-;";
|
||||
}
|
||||
|
||||
private static FactoryBlackBoxRequest BlueprintRequest(int upstreamBuildings)
|
||||
{
|
||||
var request = new FactoryBlackBoxRequest();
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(1, 10, 610, upstreamBuildings,
|
||||
ProliferationMode.None));
|
||||
request.Buildings.Add(new ProductionBuildingSnapshot(2, 20, 611, 1, ProliferationMode.None));
|
||||
return request;
|
||||
}
|
||||
|
||||
private static ProductionCatalog BlueprintCatalog()
|
||||
{
|
||||
return new ProductionCatalog(new[]
|
||||
{
|
||||
new ProductionItem(1, 0, true, false, 0, 0),
|
||||
new ProductionItem(2, 610, false, false, 0, 0),
|
||||
new ProductionItem(3, 610, false, false, 0, 0),
|
||||
new ProductionItem(4, 611, false, false, 0, 0),
|
||||
new ProductionItem(5, 621, false, false, 0, 0),
|
||||
new ProductionItem(6, 622, false, false, 0, 0),
|
||||
new ProductionItem(7, 0, false, false, 4, 60)
|
||||
}, new[]
|
||||
{
|
||||
Recipe(610, new[] { (1, 1.0) }, new[] { (2, 60.0), (3, 60.0) }),
|
||||
Recipe(611, new[] { (2, 120.0), (3, 30.0) }, new[] { (4, 1.0) }),
|
||||
Recipe(612, new[] { (1, 1.0) }, new[] { (3, 60.0) }),
|
||||
Recipe(620, new[] { (1, 1.0), (2, 1.0) }, new[] { (2, 1.0), (3, 60.0) }),
|
||||
Recipe(621, new[] { (5, 1.0) }, new[] { (6, 1.0) }),
|
||||
Recipe(622, new[] { (6, 1.0) }, new[] { (5, 1.0) })
|
||||
}, new[]
|
||||
{
|
||||
new ProductionBuilding(10, ProductionRecipeCategory.Assemble, 1, 1000, 100),
|
||||
new ProductionBuilding(20, ProductionRecipeCategory.Assemble, 1, 2000, 200),
|
||||
new ProductionBuilding(30, ProductionRecipeCategory.None, 0, 600000000, 0,
|
||||
ProductionBuildingKind.Logistics),
|
||||
new ProductionBuilding(31, ProductionRecipeCategory.None, 0, 900, 50,
|
||||
ProductionBuildingKind.Auxiliary),
|
||||
new ProductionBuilding(32, ProductionRecipeCategory.None, 0, 200, 10,
|
||||
ProductionBuildingKind.Auxiliary),
|
||||
new ProductionBuilding(40, ProductionRecipeCategory.None, 0, 4000, 200,
|
||||
ProductionBuildingKind.Miner, minerKind: ProductionMinerKind.Vein, miningPeriodTicks: 60000)
|
||||
}, new[] { 0.0, 0.25, 0.5, 0.75, 1.0 },
|
||||
new[] { 0.0, 0.125, 0.2, 0.225, 0.25 },
|
||||
new[] { 1.0, 1.3, 1.7, 2.1, 2.5 });
|
||||
}
|
||||
|
||||
private static ProductionPlanRequest Request(params (int id, double rate)[] targets)
|
||||
|
||||
Reference in new issue
Block a user