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.Client.UserInterface.ControlExtensions;
|
||||||
using Content.Shared.Chemistry.Reaction;
|
using Content.Shared.Chemistry.Reaction;
|
||||||
using Content.Shared.Chemistry.Reagent;
|
using Content.Shared.Chemistry.Reagent;
|
||||||
|
using Content.Shared.Localizations;
|
||||||
using JetBrains.Annotations;
|
using JetBrains.Annotations;
|
||||||
using Robust.Client.AutoGenerated;
|
using Robust.Client.AutoGenerated;
|
||||||
|
using Robust.Client.GameObjects;
|
||||||
using Robust.Client.Graphics;
|
using Robust.Client.Graphics;
|
||||||
using Robust.Client.UserInterface;
|
using Robust.Client.UserInterface;
|
||||||
using Robust.Client.UserInterface.Controls;
|
using Robust.Client.UserInterface.Controls;
|
||||||
@@ -53,7 +55,7 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
|
|||||||
|
|
||||||
public void SetHiddenState(bool state, string query)
|
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)
|
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();
|
reactantMsg.Pop();
|
||||||
control.ReactantsLabel.SetMessage(reactantMsg);
|
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 productMsg = new FormattedMessage();
|
||||||
var productCount = reactionPrototype.Products.Count;
|
var productCount = reactionPrototype.Products.Count;
|
||||||
var u = 0;
|
var u = 0;
|
||||||
@@ -202,6 +198,33 @@ public sealed partial class GuideReagentEmbed : BoxContainer, IDocumentTag, ISea
|
|||||||
}
|
}
|
||||||
productMsg.Pop();
|
productMsg.Pop();
|
||||||
control.ProductsLabel.SetMessage(productMsg);
|
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;
|
return control;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -8,13 +8,15 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Access="Public"/>
|
Access="Public"/>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<BoxContainer Orientation="Vertical" VerticalAlignment="Center">
|
<BoxContainer Orientation="Vertical" HorizontalAlignment="Center" VerticalAlignment="Center">
|
||||||
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"
|
<TextureRect TexturePath="/Textures/Interface/Misc/beakerlarge.png"
|
||||||
HorizontalAlignment="Center"/>
|
HorizontalAlignment="Center"
|
||||||
<Label Name="MixLabel"
|
Name="MixTexture"
|
||||||
Text="{Loc 'guidebook-reagent-recipes-mix'}"
|
Access="Public"/>
|
||||||
HorizontalAlignment="Center"
|
<RichTextLabel Name="MixLabel"
|
||||||
Access="Public"/>
|
HorizontalAlignment="Center"
|
||||||
|
Access="Public"
|
||||||
|
Margin="2 0 0 0"/>
|
||||||
</BoxContainer>
|
</BoxContainer>
|
||||||
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
|
<BoxContainer Orientation="Vertical" HorizontalExpand="True" VerticalAlignment="Center">
|
||||||
<RichTextLabel Name="ProductsLabel"
|
<RichTextLabel Name="ProductsLabel"
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using Robust.Shared.Prototypes;
|
using Robust.Shared.Prototypes;
|
||||||
|
using Robust.Shared.Utility;
|
||||||
|
|
||||||
namespace Content.Shared.Chemistry.Reaction;
|
namespace Content.Shared.Chemistry.Reaction;
|
||||||
|
|
||||||
@@ -11,4 +12,16 @@ public sealed partial class MixingCategoryPrototype : IPrototype
|
|||||||
/// <inheritdoc/>
|
/// <inheritdoc/>
|
||||||
[IdDataField]
|
[IdDataField]
|
||||||
public string ID { get; } = default!;
|
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
|
## Entity
|
||||||
|
|
||||||
default-mixing-success = You mix the {$mixed} with the {$mixer}
|
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-header = Recipe
|
||||||
guidebook-reagent-recipes-reagent-display = [bold]{$reagent}[/bold] \[{$ratio}\]
|
guidebook-reagent-recipes-reagent-display = [bold]{$reagent}[/bold] \[{$ratio}\]
|
||||||
guidebook-reagent-recipes-mix = Mix
|
guidebook-reagent-recipes-mix = Mix
|
||||||
guidebook-reagent-recipes-mix-and-heat = Mix at above {$temperature}K
|
|
||||||
guidebook-reagent-effects-header = Effects
|
guidebook-reagent-effects-header = Effects
|
||||||
guidebook-reagent-effects-metabolism-group-rate = [bold]{$group}[/bold] [color=gray]({$rate} units per second)[/color]
|
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-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
|
- type: mixingCategory
|
||||||
id: Centrifuge
|
id: Centrifuge
|
||||||
|
verbText: mixing-verb-centrifuge
|
||||||
|
icon:
|
||||||
|
sprite: Structures/Machines/Medical/centrifuge.rsi
|
||||||
|
state: base
|
||||||
|
|
||||||
- type: mixingCategory
|
- type: mixingCategory
|
||||||
id: Electrolysis
|
id: Electrolysis
|
||||||
|
verbText: mixing-verb-electrolysis
|
||||||
|
icon:
|
||||||
|
sprite: Structures/Machines/Medical/electrolysis.rsi
|
||||||
|
state: base
|
||||||
|
|
||||||
- type: mixingCategory
|
- type: mixingCategory
|
||||||
id: Holy
|
id: Holy
|
||||||
|
verbText: mixing-verb-holy
|
||||||
|
icon:
|
||||||
|
sprite: Objects/Specific/Chapel/bible.rsi
|
||||||
|
state: icon
|
||||||
|
|||||||
Reference in New Issue
Block a user