Merge remote-tracking branch 'upstream/stable' into ed-27-05-2025-upstream-sync
# Conflicts: # .github/CODEOWNERS # Content.Client/Guidebook/Controls/GuideReagentReaction.xaml.cs # Content.IntegrationTests/Tests/Chemistry/TryAllReactionsTest.cs # Content.Server/Procedural/DungeonJob/DungeonJob.OreDunGen.cs # Resources/Prototypes/Entities/Effects/chemistry_effects.yml # Resources/Prototypes/Entities/Mobs/Customization/Markings/human_hair.yml # Resources/Prototypes/GameRules/meteorswarms.yml # Resources/Prototypes/Procedural/dungeon_configs.yml
This commit is contained in:
@@ -35,16 +35,16 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
|
||||
|
||||
public GuideReagentReaction(ReactionPrototype prototype, IPrototypeManager protoMan, IEntitySystemManager sysMan) : this(protoMan)
|
||||
{
|
||||
var reactantsLabel = ReactantsLabel;
|
||||
SetReagents(prototype.Reactants, ref reactantsLabel, protoMan);
|
||||
var productLabel = ProductsLabel;
|
||||
var products = new Dictionary<string, FixedPoint2>(prototype._products); // CP14 random reactions
|
||||
Container container = ReactantsContainer;
|
||||
SetReagents(prototype.Reactants, ref container, protoMan);
|
||||
Container productContainer = ProductsContainer;
|
||||
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);
|
||||
SetReagents(products, ref productContainer, protoMan, false);
|
||||
// CP14 random reagents begin
|
||||
foreach (var randomVariation in prototype.Cp14RandomProducts)
|
||||
{
|
||||
@@ -109,8 +109,8 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
|
||||
entContainer.AddChild(nameLabel);
|
||||
ReactantsContainer.AddChild(entContainer);
|
||||
|
||||
var productLabel = ProductsLabel;
|
||||
SetReagents(solution.Contents, ref productLabel, protoMan);
|
||||
Container productContainer = ProductsContainer;
|
||||
SetReagents(solution.Contents, ref productContainer, protoMan, false);
|
||||
SetMixingCategory(categories, null, sysMan);
|
||||
}
|
||||
|
||||
@@ -119,75 +119,80 @@ public sealed partial class GuideReagentReaction : BoxContainer, ISearchableCont
|
||||
IPrototypeManager protoMan,
|
||||
IEntitySystemManager sysMan) : this(protoMan)
|
||||
{
|
||||
ReactantsLabel.Visible = true;
|
||||
ReactantsLabel.SetMarkup(Loc.GetString("guidebook-reagent-sources-gas-wrapper",
|
||||
var label = new RichTextLabel();
|
||||
label.SetMarkup(Loc.GetString("guidebook-reagent-sources-gas-wrapper",
|
||||
("name", Loc.GetString(prototype.Name).ToLower())));
|
||||
|
||||
ReactantsContainer.Visible = true;
|
||||
ReactantsContainer.AddChild(label);
|
||||
|
||||
if (prototype.Reagent != null)
|
||||
{
|
||||
var quantity = new Dictionary<string, FixedPoint2>
|
||||
{
|
||||
{ prototype.Reagent, FixedPoint2.New(0.21f) }
|
||||
};
|
||||
var productLabel = ProductsLabel;
|
||||
SetReagents(quantity, ref productLabel, protoMan);
|
||||
Container productContainer = ProductsContainer;
|
||||
SetReagents(quantity, ref productContainer, protoMan, false);
|
||||
}
|
||||
SetMixingCategory(categories, null, sysMan);
|
||||
}
|
||||
|
||||
private void SetReagents(List<ReagentQuantity> reagents, ref RichTextLabel label, IPrototypeManager protoMan)
|
||||
private void SetReagents(List<ReagentQuantity> reagents, ref Container container, IPrototypeManager protoMan, bool addLinks = true)
|
||||
{
|
||||
var amounts = new Dictionary<string, FixedPoint2>();
|
||||
foreach (var (reagent, quantity) in reagents)
|
||||
{
|
||||
amounts.Add(reagent.Prototype, quantity);
|
||||
}
|
||||
SetReagents(amounts, ref label, protoMan);
|
||||
SetReagents(amounts, ref container, protoMan, addLinks);
|
||||
}
|
||||
|
||||
private void SetReagents(
|
||||
Dictionary<string, ReactantPrototype> reactants,
|
||||
ref RichTextLabel label,
|
||||
IPrototypeManager protoMan)
|
||||
ref Container container,
|
||||
IPrototypeManager protoMan,
|
||||
bool addLinks = true)
|
||||
{
|
||||
var amounts = new Dictionary<string, FixedPoint2>();
|
||||
foreach (var (reagent, reactantPrototype) in reactants)
|
||||
{
|
||||
amounts.Add(reagent, reactantPrototype.Amount);
|
||||
}
|
||||
SetReagents(amounts, ref label, protoMan);
|
||||
SetReagents(amounts, ref container, protoMan, addLinks);
|
||||
}
|
||||
|
||||
[PublicAPI]
|
||||
private void SetReagents(
|
||||
Dictionary<ProtoId<MixingCategoryPrototype>, ReactantPrototype> reactants,
|
||||
ref RichTextLabel label,
|
||||
IPrototypeManager protoMan)
|
||||
ref Container container,
|
||||
IPrototypeManager protoMan,
|
||||
bool addLinks = true)
|
||||
{
|
||||
var amounts = new Dictionary<string, FixedPoint2>();
|
||||
foreach (var (reagent, reactantPrototype) in reactants)
|
||||
{
|
||||
amounts.Add(reagent, reactantPrototype.Amount);
|
||||
}
|
||||
SetReagents(amounts, ref label, protoMan);
|
||||
SetReagents(amounts, ref container, protoMan, addLinks);
|
||||
}
|
||||
|
||||
private void SetReagents(Dictionary<string, FixedPoint2> reagents, ref RichTextLabel label, IPrototypeManager protoMan)
|
||||
private void SetReagents(Dictionary<string, FixedPoint2> reagents, ref Container container, IPrototypeManager protoMan, bool addLinks = true)
|
||||
{
|
||||
var msg = new FormattedMessage();
|
||||
var reagentCount = reagents.Count;
|
||||
var i = 0;
|
||||
foreach (var (product, amount) in reagents.OrderByDescending(p => p.Value))
|
||||
{
|
||||
var productProto = protoMan.Index<ReagentPrototype>(product);
|
||||
var msg = new FormattedMessage();
|
||||
msg.AddMarkupOrThrow(Loc.GetString("guidebook-reagent-recipes-reagent-display",
|
||||
("reagent", protoMan.Index<ReagentPrototype>(product).LocalizedName), ("ratio", amount)));
|
||||
i++;
|
||||
if (i < reagentCount)
|
||||
msg.PushNewline();
|
||||
("reagent", productProto.LocalizedName), ("ratio", amount)));
|
||||
|
||||
var label = new GuidebookRichPrototypeLink();
|
||||
if (addLinks)
|
||||
label.LinkedPrototype = productProto;
|
||||
label.SetMessage(msg);
|
||||
container.AddChild(label);
|
||||
}
|
||||
msg.Pop();
|
||||
label.SetMessage(msg);
|
||||
label.Visible = true;
|
||||
container.Visible = true;
|
||||
}
|
||||
|
||||
private void SetMixingCategory(IReadOnlyList<ProtoId<MixingCategoryPrototype>> mixingCategories, ReactionPrototype? prototype, IEntitySystemManager sysMan)
|
||||
|
||||
Reference in New Issue
Block a user