Add reaction randomization. (#308)
* Add random products datafield to the reaciton prototype. One of the items in the list will be used as additional products as a result of the reaction and will be persistent per round. Resolves #245 * Another try Add getter and setter for the reaction products field and add random products there. * There is no such product as CP14BasicEffectHealHeat * Try to visualize random products in the guidebook * experimental recipes * fix * file restructurization * Guidebook alchemy update * Update Alchemy.xml * fix * Update mixing_simple.yml --------- Co-authored-by: Ed <96445749+TheShuEd@users.noreply.github.com>
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
<BoxContainer xmlns="https://spacestation14.io"
|
||||
xmlns:controls="clr-namespace:Content.Client.UserInterface.Controls"
|
||||
Orientation="Horizontal"
|
||||
HorizontalAlignment="Stretch"
|
||||
HorizontalExpand="True"
|
||||
@@ -26,5 +27,18 @@
|
||||
VerticalAlignment="Center"
|
||||
Access="Public"
|
||||
Visible="False"/>
|
||||
<!-- CP14 random reactions begin -->
|
||||
<BoxContainer Name="RandomVariations"
|
||||
Orientation="Vertical"
|
||||
VerticalExpand="True"
|
||||
VerticalAlignment="Center"
|
||||
HorizontalAlignment="Left">
|
||||
<controls:SplitBar MinHeight="10">
|
||||
</controls:SplitBar>
|
||||
<Label Name="RandomVariationsLabel" Text="{Loc 'cp14-guidebook-random-variations-title'}" Visible="False"/>
|
||||
<controls:SplitBar MinHeight="10">
|
||||
</controls:SplitBar>
|
||||
</BoxContainer>
|
||||
<!-- CP14 random reactions end -->
|
||||
</BoxContainer>
|
||||
</BoxContainer>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Linq;
|
||||
using Content.Client.Message;
|
||||
using Content.Client.UserInterface.Controls; // CP14 random reactions
|
||||
using Content.Client.UserInterface.ControlExtensions;
|
||||
using Content.Shared.Atmos.Prototypes;
|
||||
using Content.Shared.Chemistry.Components;
|
||||
@@ -37,13 +38,36 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
|
||||
var reactantsLabel = ReactantsLabel;
|
||||
SetReagents(prototype.Reactants, ref reactantsLabel, protoMan);
|
||||
var productLabel = ProductsLabel;
|
||||
var products = new Dictionary<string, FixedPoint2>(prototype.Products);
|
||||
var products = new Dictionary<string, FixedPoint2>(prototype._products); // CP14 random reactions
|
||||
foreach (var (reagent, reactantProto) in prototype.Reactants)
|
||||
{
|
||||
if (reactantProto.Catalyst)
|
||||
products.Add(reagent, reactantProto.Amount);
|
||||
}
|
||||
SetReagents(products, ref productLabel, protoMan);
|
||||
// CP14 random reagents begin
|
||||
foreach (var randomVariation in prototype.Cp14RandomProducts)
|
||||
{
|
||||
// If there aren't any variations, this label will be not visible
|
||||
RandomVariationsLabel.Visible = true;
|
||||
var randomProductLabel = new RichTextLabel {
|
||||
HorizontalAlignment=HAlignment.Left,
|
||||
VerticalAlignment=VAlignment.Center,
|
||||
};
|
||||
var randomProducts = new Dictionary<string, FixedPoint2>(randomVariation);
|
||||
RandomVariations.AddChild(randomProductLabel);
|
||||
RandomVariations.AddChild(new SplitBar
|
||||
{
|
||||
MinHeight = 10,
|
||||
});
|
||||
foreach (var (reagent, reactantProto) in prototype.Reactants)
|
||||
{
|
||||
if (reactantProto.Catalyst)
|
||||
randomProducts.Add(reagent, reactantProto.Amount);
|
||||
}
|
||||
SetReagents(randomProducts, ref randomProductLabel, protoMan);
|
||||
}
|
||||
// CP14 random reagents end
|
||||
|
||||
var mixingCategories = new List<MixingCategoryPrototype>();
|
||||
if (prototype.MixingCategories != null)
|
||||
|
||||
Reference in New Issue
Block a user