add mixing categories to chem guidebook (#22566)
This commit is contained in:
@@ -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<string, string> 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<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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -8,13 +8,15 @@
|
||||
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"
|
||||
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"
|
||||
|
||||
@@ -1,4 +1,5 @@
|
||||
using Robust.Shared.Prototypes;
|
||||
using Robust.Shared.Utility;
|
||||
|
||||
namespace Content.Shared.Chemistry.Reaction;
|
||||
|
||||
@@ -11,4 +12,16 @@ public sealed partial class MixingCategoryPrototype : IPrototype
|
||||
/// <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!;
|
||||
}
|
||||
|
||||
@@ -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}
|
||||
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user