Fix categories (#10683)

This commit is contained in:
Morb
2022-08-18 17:27:46 -07:00
committed by GitHub
parent de7895ca82
commit 86d7a1fbb9
6 changed files with 16 additions and 9 deletions

View File

@@ -167,7 +167,7 @@ namespace Content.Client.Construction.UI
continue;
}
if (!string.IsNullOrEmpty(category) && category != Loc.GetString("construction-presenter-category-all"))
if (!string.IsNullOrEmpty(category) && category != Loc.GetString("construction-category-all"))
{
if (recipe.Category != category)
continue;
@@ -191,11 +191,11 @@ namespace Content.Client.Construction.UI
var uniqueCategories = new HashSet<string>();
// hard-coded to show all recipes
uniqueCategories.Add(Loc.GetString("construction-presenter-category-all"));
uniqueCategories.Add(Loc.GetString("construction-category-all"));
foreach (var prototype in _prototypeManager.EnumeratePrototypes<ConstructionPrototype>())
{
var category = Loc.GetString(prototype.Category);
var category = prototype.Category;
if (!string.IsNullOrEmpty(category))
uniqueCategories.Add(category);

View File

@@ -8,6 +8,8 @@ namespace Content.Shared.Construction.Prototypes
[Prototype("construction")]
public sealed class ConstructionPrototype : IPrototype
{
private string _category = string.Empty;
[DataField("conditions")] private List<IConstructionCondition> _conditions = new();
/// <summary>
@@ -52,7 +54,12 @@ namespace Content.Shared.Construction.Prototypes
[DataField("canBuildInImpassable")]
public bool CanBuildInImpassable { get; private set; }
[DataField("category")] public string Category { get; private set; } = string.Empty;
[DataField("category")]
public string Category
{
get => _category;
private set => _category = Loc.GetString(value);
}
[DataField("objectType")] public ConstructionType Type { get; private set; } = ConstructionType.Structure;

View File

@@ -1,4 +1,5 @@
construction-category-furniture = Furniture
construction-category-all = All
construction-category-furniture = Furniture
construction-category-storage = Storage
construction-category-tools = Tools
construction-category-materials = Materials

View File

@@ -1,5 +1,4 @@
construction-presenter-category-all = All
construction-presenter-to-craft = To craft this item, you need to:
construction-presenter-to-craft = To craft this item, you need to:
construction-presenter-to-build = To build this, first you need to:
construction-presenter-step-wrapper = {$step-number}. {$text}

View File

@@ -142,7 +142,7 @@
graph: DisposalMachine
startNode: start
targetNode: mailing_unit
category: Utilities
category: construction-category-utilities
placementMode: SnapgridCenter
canBuildInImpassable: false
icon:

View File

@@ -67,7 +67,7 @@
graph: flowercrown
startNode: start
targetNode: flowercrown
category: Misc
category: construction-category-misc
description: "A coronet of fresh and fragrant flowers."
icon:
sprite: Clothing/Head/Misc/flower-crown.rsi