fix reagent guidebook

This commit is contained in:
Ed
2025-05-30 15:43:23 +03:00
parent 7d658de8a1
commit a0956a399a
2 changed files with 10 additions and 18 deletions

View File

@@ -39,11 +39,11 @@
Visible="False"
HorizontalAlignment="Center"
FontColorOverride="#1e6651" />
<BoxContainer Name="RandomProductsContainer" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
<!-- Random products will be added as children here -->
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<BoxContainer Name="RandomProductsContainer" HorizontalAlignment="Center" VerticalAlignment="Center" Orientation="Vertical">
<!-- Random products will be added as children here -->
</BoxContainer>
</BoxContainer>
<controls:SplitBar MinHeight="10">
</controls:SplitBar>
</BoxContainer>
<!-- CP14 random reactions end -->

View File

@@ -45,25 +45,17 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
products.Add(reagent, reactantProto.Amount);
}
SetReagents(products, ref productContainer, protoMan, false);
// CP14 random reagents begin
foreach (var randomVariation in prototype.Cp14RandomProducts)
Container randomProductContainer = RandomProductsContainer;
if (prototype.Cp14RandomProducts.Count > 0)
{
// If there aren't any variations, this label will be not visible
RandomVariationsLabel.Visible = true;
Container randomProductContainer = RandomProductsContainer;
var randomProducts = new Dictionary<string, FixedPoint2>(randomVariation);
RandomVariations.AddChild(randomProductContainer);
RandomVariations.AddChild(new SplitBar
{
MinHeight = 10,
});
foreach (var (reagent, reactantProto) in prototype.Reactants)
{
if (reactantProto.Catalyst)
randomProducts.Add(reagent, reactantProto.Amount);
}
SetReagents(randomProducts, ref randomProductContainer, protoMan);
var randomProducts = new Dictionary<string, FixedPoint2>(prototype.Cp14RandomProducts[prototype.Cp14RandomProductIndex]);
SetReagents(randomProducts, ref randomProductContainer, protoMan, false);
}
// CP14 random reagents end