Added localization of groups and types: damage, metabolism (#27368)

* Added localization of groups and types: damage, metabolism (displayed in the guide book). The text for the health analyzer, weapon damage inspection is now taken from damage prototypes

* fix damage tests

* fix damage test yml

* fix damage test prototypes

* Update Content.Shared/Damage/Prototypes/DamageGroupPrototype.cs

* Update Content.Shared/Damage/Prototypes/DamageTypePrototype.cs

---------

Co-authored-by: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
This commit is contained in:
KrasnoshchekovPavel
2024-04-28 07:48:19 +03:00
committed by GitHub
parent f5b8b5fbdc
commit 3fcbbc0732
24 changed files with 150 additions and 51 deletions

View File

@@ -1,4 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.Body.Prototypes
{
@@ -7,5 +7,11 @@ namespace Content.Shared.Body.Prototypes
{
[IdDataField]
public string ID { get; private set; } = default!;
[DataField("name", required: true)]
private LocId Name { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
}
}

View File

@@ -1,4 +1,4 @@
using Robust.Shared.Prototypes;
using Robust.Shared.Prototypes;
namespace Content.Shared.Body.Prototypes
{
@@ -9,6 +9,9 @@ namespace Content.Shared.Body.Prototypes
public string ID { get; private set; } = default!;
[DataField("name", required: true)]
public string Name { get; private set; } = default!;
private LocId Name { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
}
}

View File

@@ -17,6 +17,12 @@ namespace Content.Shared.Damage.Prototypes
{
[IdDataField] public string ID { get; } = default!;
[DataField(required: true)]
private LocId Name { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
[DataField("damageTypes", required: true, customTypeSerializer: typeof(PrototypeIdListSerializer<DamageTypePrototype>))]
public List<string> DamageTypes { get; private set; } = default!;
}

View File

@@ -11,6 +11,12 @@ namespace Content.Shared.Damage.Prototypes
[IdDataField]
public string ID { get; private set; } = default!;
[DataField(required: true)]
private LocId Name { get; set; }
[ViewVariables(VVAccess.ReadOnly)]
public string LocalizedName => Loc.GetString(Name);
/// <summary>
/// The price for each 1% damage reduction in armors
/// </summary>

View File

@@ -1,8 +1,10 @@
using Content.Shared.Damage.Components;
using Content.Shared.Damage.Events;
using Content.Shared.Damage.Prototypes;
using Content.Shared.Examine;
using Content.Shared.FixedPoint;
using Content.Shared.Verbs;
using Robust.Shared.Prototypes;
using Robust.Shared.Utility;
namespace Content.Shared.Damage.Systems;
@@ -10,6 +12,7 @@ namespace Content.Shared.Damage.Systems;
public sealed class DamageExamineSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examine = default!;
[Dependency] private readonly IPrototypeManager _prototype = default!;
public override void Initialize()
{
@@ -66,7 +69,7 @@ public sealed class DamageExamineSystem : EntitySystem
if (damage.Value != FixedPoint2.Zero)
{
msg.PushNewline();
msg.AddMarkup(Loc.GetString("damage-value", ("type", damage.Key), ("amount", damage.Value)));
msg.AddMarkup(Loc.GetString("damage-value", ("type", _prototype.Index<DamageTypePrototype>(damage.Key).LocalizedName), ("amount", damage.Value)));
}
}