using Content.Client.UserInterface.ControlExtensions;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
+using Content.Shared.Localizations;
using JetBrains.Annotations;
using Robust.Client.AutoGenerated;
+using Robust.Client.GameObjects;
using Robust.Client.Graphics;
using Robust.Client.UserInterface;
using Robust.Client.UserInterface.Controls;
public void SetHiddenState(bool state, string query)
{
- this.Visible = CheckMatchesSearch(query) ? state : !state;
+ Visible = CheckMatchesSearch(query) ? state : !state;
}
public bool TryParseTag(Dictionary<string, string> args, [NotNullWhen(true)] out Control? control)
reactantMsg.Pop();
control.ReactantsLabel.SetMessage(reactantMsg);
- if (reactionPrototype.MinimumTemperature > 0.0f)
- {
- control.MixLabel.Text = Loc.GetString("guidebook-reagent-recipes-mix-and-heat",
- ("temperature", reactionPrototype.MinimumTemperature));
- }
-
var productMsg = new FormattedMessage();
var productCount = reactionPrototype.Products.Count;
var u = 0;
}
productMsg.Pop();
control.ProductsLabel.SetMessage(productMsg);
+
+ var mixingCategories = new List<MixingCategoryPrototype>();
+ if (reactionPrototype.MixingCategories != null)
+ {
+ foreach (var category in reactionPrototype.MixingCategories)
+ {
+ mixingCategories.Add(_prototype.Index(category));
+ }
+ }
+
+ // only use the first one for the icon.
+ if (mixingCategories.FirstOrDefault() is { } primaryCategory)
+ {
+ control.MixTexture.Texture = _systemManager.GetEntitySystem<SpriteSystem>().Frame0(primaryCategory.Icon);
+ }
+
+ var mixingVerb = mixingCategories.Count == 0
+ ? Loc.GetString("guidebook-reagent-recipes-mix")
+ : ContentLocalizationManager.FormatList(mixingCategories.Select(p => Loc.GetString(p.VerbText)).ToList());
+
+ var text = Loc.GetString("guidebook-reagent-recipes-mix-info",
+ ("verb", mixingVerb),
+ ("minTemp", reactionPrototype.MinimumTemperature),
+ ("maxTemp", reactionPrototype.MaximumTemperature),
+ ("hasMax", !float.IsPositiveInfinity(reactionPrototype.MaximumTemperature)));
+
+ control.MixLabel.SetMarkup(text);
return control;
}
}
VerticalAlignment="Center"
Access="Public"/>
</BoxContainer>
- <BoxContainer Orientation="Vertical" VerticalAlignment="Center">
+ <BoxContainer Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"
- HorizontalAlignment="Center"/>
- <Label Name="MixLabel"
- Text="{Loc 'guidebook-reagent-recipes-mix'}"
- HorizontalAlignment="Center"
- Access="Public"/>
+ HorizontalAlignment="Center"
+ Name="MixTexture"
+ Access="Public"/>
+ <RichTextLabel Name="MixLabel"
+ HorizontalAlignment="Center"
+ Access="Public"
+ Margin="2 0 0 0"/>
</BoxContainer>
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
<RichTextLabel Name="ProductsLabel"
using Robust.Shared.Prototypes;
+using Robust.Shared.Utility;
namespace Content.Shared.Chemistry.Reaction;
/// <inheritdoc/>
[IdDataField]
public string ID { get; } = default!;
+
+ /// <summary>
+ /// A locale string used in the guidebook to describe this mixing category.
+ /// </summary>
+ [DataField(required: true)]
+ public LocId VerbText;
+
+ /// <summary>
+ /// An icon used to represent this mixing category in the guidebook.
+ /// </summary>
+ [DataField(required: true)]
+ public SpriteSpecifier Icon = default!;
}
guidebook-reagent-recipes-header = Recipe
guidebook-reagent-recipes-reagent-display = [bold]{$reagent}[/bold] \[{$ratio}\]
guidebook-reagent-recipes-mix = Mix
-guidebook-reagent-recipes-mix-and-heat = Mix at above {$temperature}K
guidebook-reagent-effects-header = Effects
guidebook-reagent-effects-metabolism-group-rate = [bold]{$group}[/bold] [color=gray]({$rate} units per second)[/color]
guidebook-reagent-physical-description = [italic]Seems to be {$description}.[/italic]
+guidebook-reagent-recipes-mix-info = {$minTemp ->
+ [0] {$hasMax ->
+ [true] {$verb} below {$maxTemp}K
+ *[false] {$verb}
+ }
+ *[other] {$verb} {$hasMax ->
+ [true] between {$minTemp}K and {$maxTemp}K
+ *[false] above {$minTemp}K
+ }
+}