diff --git a/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs b/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs index a292a93ea6..cf5a1b6e59 100644 --- a/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs +++ b/Content.Client/Guidebook/Controls/GuideReagentEmbed.xaml.cs @@ -6,8 +6,10 @@ using Content.Client.Message; 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; @@ -53,7 +55,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea public void SetHiddenState(bool state, string query) { - this.Visible = CheckMatchesSearch(query) ? state : !state; + Visible = CheckMatchesSearch(query) ? state : !state; } public bool TryParseTag(Dictionary args, [NotNullWhen(true)] out Control? control) @@ -183,12 +185,6 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea 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; @@ -202,6 +198,33 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea } productMsg.Pop(); control.ProductsLabel.SetMessage(productMsg); + + var mixingCategories = new List(); + 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().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; } } diff --git a/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml b/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml index 3f10592519..69c14a59af 100644 --- a/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml +++ b/Content.Client/Guidebook/Controls/GuideReagentReaction.xaml @@ -8,13 +8,15 @@ VerticalAlignment="Center" Access="Public"/> - + - [IdDataField] public string ID { get; } = default!; + + /// + /// A locale string used in the guidebook to describe this mixing category. + /// + [DataField(required: true)] + public LocId VerbText; + + /// + /// An icon used to represent this mixing category in the guidebook. + /// + [DataField(required: true)] + public SpriteSpecifier Icon = default!; } diff --git a/Resources/Locale/en-US/chemistry/components/mixing-component.ftl b/Resources/Locale/en-US/chemistry/components/mixing-component.ftl index 2abe5644f5..1ad9958804 100644 --- a/Resources/Locale/en-US/chemistry/components/mixing-component.ftl +++ b/Resources/Locale/en-US/chemistry/components/mixing-component.ftl @@ -1,3 +1,8 @@ +# Types +mixing-verb-centrifuge = centrifugation +mixing-verb-electrolysis = electrolyze +mixing-verb-holy = bless + ## Entity default-mixing-success = You mix the {$mixed} with the {$mixer} diff --git a/Resources/Locale/en-US/guidebook/chemistry/core.ftl b/Resources/Locale/en-US/guidebook/chemistry/core.ftl index 960a9972c4..7b39a63175 100644 --- a/Resources/Locale/en-US/guidebook/chemistry/core.ftl +++ b/Resources/Locale/en-US/guidebook/chemistry/core.ftl @@ -11,7 +11,16 @@ guidebook-reagent-name = [bold][color={$color}]{CAPITALIZE($name)}[/color][/bold 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 + } +} diff --git a/Resources/Prototypes/Chemistry/mixing_types.yml b/Resources/Prototypes/Chemistry/mixing_types.yml index e32afa43fa..dbf14c19c1 100644 --- a/Resources/Prototypes/Chemistry/mixing_types.yml +++ b/Resources/Prototypes/Chemistry/mixing_types.yml @@ -1,8 +1,20 @@ - type: mixingCategory id: Centrifuge + verbText: mixing-verb-centrifuge + icon: + sprite: Structures/Machines/Medical/centrifuge.rsi + state: base - type: mixingCategory id: Electrolysis + verbText: mixing-verb-electrolysis + icon: + sprite: Structures/Machines/Medical/electrolysis.rsi + state: base - type: mixingCategory id: Holy + verbText: mixing-verb-holy + icon: + sprite: Objects/Specific/Chapel/bible.rsi + state: icon