* 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>
using Content.Client.Guidebook.Richtext;
using Content.Client.Message;
using Content.Client.UserInterface.ControlExtensions;
+using Content.Shared.Body.Prototypes;
using Content.Shared.Chemistry.Reaction;
using Content.Shared.Chemistry.Reagent;
using JetBrains.Annotations;
var groupLabel = new RichTextLabel();
groupLabel.SetMarkup(Loc.GetString("guidebook-reagent-effects-metabolism-group-rate",
- ("group", group), ("rate", effect.MetabolismRate)));
+ ("group", _prototype.Index<MetabolismGroupPrototype>(group).LocalizedName), ("rate", effect.MetabolismRate)));
var descriptionLabel = new RichTextLabel
{
Margin = new Thickness(25, 0, 10, 0)
var groupTitleText = $"{Loc.GetString(
"health-analyzer-window-damage-group-text",
- ("damageGroup", Loc.GetString("health-analyzer-window-damage-group-" + damageGroupId)),
+ ("damageGroup", _prototypes.Index<DamageGroupPrototype>(damageGroupId).LocalizedName),
("amount", damageAmount)
)}";
var damageString = Loc.GetString(
"health-analyzer-window-damage-type-text",
- ("damageType", Loc.GetString("health-analyzer-window-damage-type-" + type)),
+ ("damageType", _prototypes.Index<DamageTypePrototype>(type).LocalizedName),
("amount", typeAmount)
);
# Define some damage groups
- type: damageType
id: TestDamage1
+ name: damage-type-blunt
- type: damageType
id: TestDamage2a
+ name: damage-type-blunt
- type: damageType
id: TestDamage2b
+ name: damage-type-blunt
- type: damageType
id: TestDamage3a
+ name: damage-type-blunt
- type: damageType
id: TestDamage3b
+ name: damage-type-blunt
- type: damageType
id: TestDamage3c
+ name: damage-type-blunt
# Define damage Groups with 1,2,3 damage types
- type: damageGroup
id: TestGroup1
+ name: damage-group-brute
damageTypes:
- TestDamage1
- type: damageGroup
id: TestGroup2
+ name: damage-group-brute
damageTypes:
- TestDamage2a
- TestDamage2b
- type: damageGroup
id: TestGroup3
+ name: damage-group-brute
damageTypes:
- TestDamage3a
- TestDamage3b
public const string DamagePrototypes = $@"
- type: damageType
id: TestBlunt
+ name: damage-type-blunt
- type: damageType
id: TestSlash
+ name: damage-type-slash
- type: damageType
id: TestPiercing
+ name: damage-type-piercing
- type: damageType
id: TestHeat
+ name: damage-type-heat
- type: damageType
id: TestShock
+ name: damage-type-shock
- type: damageType
id: TestCold
+ name: damage-type-cold
- type: damageGroup
id: TestBrute
+ name: damage-group-brute
damageTypes:
- TestBlunt
- TestSlash
- type: damageGroup
id: TestBurn
+ name: damage-group-burn
damageTypes:
- TestHeat
- TestShock
-using Content.Server.Body.Components;
+using Content.Server.Body.Components;
using Content.Shared.Body.Prototypes;
using Content.Shared.Chemistry.Reagent;
using Robust.Shared.Prototypes;
public override string GuidebookExplanation(IPrototypeManager prototype)
{
return Loc.GetString("reagent-effect-condition-guidebook-organ-type",
- ("name", prototype.Index<MetabolizerTypePrototype>(Type).Name),
+ ("name", prototype.Index<MetabolizerTypePrototype>(Type).LocalizedName),
("shouldhave", ShouldHave));
}
}
-using Content.Shared.Chemistry.Reagent;
+using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using Robust.Shared.Prototypes;
prototype.TryIndex(Reagent, out reagentProto);
return Loc.GetString("reagent-effect-condition-guidebook-reagent-threshold",
- ("reagent", reagentProto?.LocalizedName ?? "this reagent"),
+ ("reagent", reagentProto?.LocalizedName ?? Loc.GetString("reagent-effect-condition-guidebook-this-reagent")),
("max", Max == FixedPoint2.MaxValue ? (float) int.MaxValue : Max.Float()),
("min", Min.Float()));
}
-using Content.Shared.Body.Prototypes;
+using Content.Shared.Body.Prototypes;
using Content.Shared.Chemistry.Reagent;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
return Loc.GetString("reagent-effect-guidebook-adjust-reagent-group",
("chance", Probability),
("deltasign", MathF.Sign(Amount.Float())),
- ("group", groupProto.ID),
+ ("group", groupProto.LocalizedName),
("amount", MathF.Abs(Amount.Float())));
}
damages.Add(
Loc.GetString("health-change-display",
- ("kind", group.ID),
+ ("kind", group.LocalizedName),
("amount", MathF.Abs(amount.Float())),
("deltasign", sign)
));
damages.Add(
Loc.GetString("health-change-display",
- ("kind", kind),
+ ("kind", prototype.Index<DamageTypePrototype>(kind).LocalizedName),
("amount", MathF.Abs(amount.Float())),
("deltasign", sign)
));
-using Robust.Shared.Prototypes;
+using Robust.Shared.Prototypes;
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);
}
}
-using Robust.Shared.Prototypes;
+using Robust.Shared.Prototypes;
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);
}
}
{
[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!;
}
[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>
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;
public sealed class DamageExamineSystem : EntitySystem
{
[Dependency] private readonly ExamineSystemShared _examine = default!;
+ [Dependency] private readonly IPrototypeManager _prototype = default!;
public override void Initialize()
{
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)));
}
}
private string _damagePrototypes = @"
- type: damageType
id: Blunt
+ name: damage-type-blunt
- type: damageType
id: Slash
+ name: damage-type-slash
- type: damageType
id: Piercing
+ name: damage-type-piercing
- type: damageType
id: Heat
+ name: damage-type-heat
- type: damageType
id: Shock
+ name: damage-type-shock
- type: damageType
id: Cold
+ name: damage-type-cold
# Poison damage. Generally caused by various reagents being metabolised.
- type: damageType
id: Poison
+ name: damage-type-poison
- type: damageType
id: Radiation
+ name: damage-type-radiation
# Damage due to being unable to breathe.
# Represents not enough oxygen (or equivalent) getting to the blood.
# Usually healed automatically if entity can breathe
- type: damageType
id: Asphyxiation
+ name: damage-type-asphyxiation
# Damage representing not having enough blood.
# Represents there not enough blood to supply oxygen (or equivalent).
- type: damageType
id: Bloodloss
+ name: damage-type-bloodloss
- type: damageType
id: Cellular
+ name: damage-type-cellular
- type: damageGroup
id: Brute
+ name: damage-group-brute
damageTypes:
- Blunt
- Slash
- type: damageGroup
id: Burn
+ name: damage-group-burn
damageTypes:
- Heat
- Shock
# bloodloss, not this whole group, unless you have a wonder drug that affects both.
- type: damageGroup
id: Airloss
+ name: damage-group-airloss
damageTypes:
- Asphyxiation
- Bloodloss
# Though there are probably some radioactive poisons.
- type: damageGroup
id: Toxin
+ name: damage-group-toxin
damageTypes:
- Poison
- Radiation
- type: damageGroup
id: Genetic
+ name: damage-group-genetic
damageTypes:
- Cellular
--- /dev/null
+damage-group-brute = Brute
+damage-group-burn = Burn
+damage-group-airloss = Airloss
+damage-group-toxin = Toxin
+damage-group-genetic = Genetic
--- /dev/null
+damage-type-asphyxiation = Asphyxiation
+damage-type-bloodloss = Bloodloss
+damage-type-blunt = Blunt
+damage-type-cellular = Cellular
+damage-type-caustic = Caustic
+damage-type-cold = Cold
+damage-type-heat = Heat
+damage-type-piercing = Piercing
+damage-type-poison = Poison
+damage-type-radiation = Radiation
+damage-type-shock = Shock
+damage-type-slash = Slash
+damage-type-structural = Structural
-reagent-effect-condition-guidebook-total-damage =
+reagent-effect-condition-guidebook-total-damage =
{ $max ->
[2147483648] it has at least {NATURALFIXED($min, 2)} total damage
*[other] { $min ->
[true] does not have
*[false] has
} the tag {$tag}
+
+reagent-effect-condition-guidebook-this-reagent = this reagent
health-analyzer-window-scan-mode-active = ACTIVE
health-analyzer-window-scan-mode-inactive = INACTIVE
-health-analyzer-window-damage-group-Brute = Brute
-health-analyzer-window-damage-type-Blunt = Blunt
-health-analyzer-window-damage-type-Slash = Slash
-health-analyzer-window-damage-type-Piercing = Piercing
-
-health-analyzer-window-damage-group-Burn = Burn
-health-analyzer-window-damage-type-Heat = Heat
-health-analyzer-window-damage-type-Shock = Shock
-health-analyzer-window-damage-type-Cold = Cold
-health-analyzer-window-damage-type-Caustic = Caustic
-
-health-analyzer-window-damage-group-Airloss = Airloss
-health-analyzer-window-damage-type-Asphyxiation = Asphyxiation
-health-analyzer-window-damage-type-Bloodloss = Bloodloss
-
-health-analyzer-window-damage-group-Toxin = Toxin
-health-analyzer-window-damage-type-Poison = Poison
-health-analyzer-window-damage-type-Radiation = Radiation
-
-health-analyzer-window-damage-group-Genetic = Genetic
-health-analyzer-window-damage-type-Cellular = Cellular
-
health-analyzer-window-malnutrition = Severely malnourished
--- /dev/null
+metabolism-group-poison = Poison
+metabolism-group-medicine = Medicine
+metabolism-group-narcotic = Narcotic
+metabolism-group-alcohol = Alcohol
+metabolism-group-food = Food
+metabolism-group-drink = Drink
+metabolism-group-gas = Gas
--- /dev/null
+metabolizer-type-animal = Animal
+metabolizer-type-bloodsucker = Bloodsucker
+metabolizer-type-dragon = Dragon
+metabolizer-type-human = Human
+metabolizer-type-slime = Slime
+metabolizer-type-vox = Vox
+metabolizer-type-rat = Rat
+metabolizer-type-plant = Plant
+metabolizer-type-dwarf = Dwarf
+metabolizer-type-moth = Moth
+metabolizer-type-arachnid = Arachnid
-# Default human metabolism groups.
+# Default human metabolism groups.
- type: metabolismGroup
id: Poison
+ name: metabolism-group-poison
- type: metabolismGroup
id: Medicine
+ name: metabolism-group-medicine
- type: metabolismGroup
id: Narcotic
+ name: metabolism-group-narcotic
- type: metabolismGroup
id: Alcohol
+ name: metabolism-group-alcohol
- type: metabolismGroup
id: Food
+ name: metabolism-group-food
- type: metabolismGroup
id: Drink
+ name: metabolism-group-drink
# Used for gases that have effects on being inhaled
- type: metabolismGroup
id: Gas
+ name: metabolism-group-gas
-# If your species wants to metabolize stuff differently,
+# If your species wants to metabolize stuff differently,
# you'll likely have to tag its metabolizers with something other than Human.
- type: metabolizerType
id: Animal
- name: animal
+ name: metabolizer-type-animal
- type: metabolizerType
id: Bloodsucker
- name: bloodsucker
+ name: metabolizer-type-bloodsucker
- type: metabolizerType
id: Dragon
- name: dragon
+ name: metabolizer-type-dragon
- type: metabolizerType
id: Human
- name: human
+ name: metabolizer-type-human
- type: metabolizerType
id: Slime
- name: slime
+ name: metabolizer-type-slime
- type: metabolizerType
id: Vox
- name: vox
+ name: metabolizer-type-vox
- type: metabolizerType
id: Rat
- name: rat
+ name: metabolizer-type-rat
- type: metabolizerType
id: Plant
- name: plant
+ name: metabolizer-type-plant
- type: metabolizerType
id: Dwarf
- name: dwarf
+ name: metabolizer-type-dwarf
- type: metabolizerType
id: Moth
- name: moth
+ name: metabolizer-type-moth
- type: metabolizerType
id: Arachnid
- name: arachnid
+ name: metabolizer-type-arachnid
- type: damageGroup
id: Brute
+ name: damage-group-brute
damageTypes:
- Blunt
- Slash
- type: damageGroup
id: Burn
+ name: damage-group-burn
damageTypes:
- Heat
- Shock
# bloodloss, not this whole group, unless you have a wonder drug that affects both.
- type: damageGroup
id: Airloss
+ name: damage-group-airloss
damageTypes:
- Asphyxiation
- Bloodloss
# Though there are probably some radioactive poisons.
- type: damageGroup
id: Toxin
+ name: damage-group-toxin
damageTypes:
- Poison
- Radiation
- type: damageGroup
id: Genetic
+ name: damage-group-genetic
damageTypes:
- Cellular
# Usually healed automatically if entity can breathe
- type: damageType
id: Asphyxiation
+ name: damage-type-asphyxiation
armorCoefficientPrice: 5
armorFlatPrice: 50
# Represents there not enough blood to supply oxygen (or equivalent).
- type: damageType
id: Bloodloss
+ name: damage-type-bloodloss
armorCoefficientPrice: 5
armorFlatPrice: 50
- type: damageType
id: Blunt
+ name: damage-type-blunt
armorCoefficientPrice: 2
armorFlatPrice: 10
- type: damageType
id: Cellular
+ name: damage-type-cellular
armorCoefficientPrice: 5
armorFlatPrice: 30
- type: damageType
id: Caustic
+ name: damage-type-caustic
armorCoefficientPrice: 5
armorFlatPrice: 30
- type: damageType
id: Cold
+ name: damage-type-cold
armorCoefficientPrice: 2.5
armorFlatPrice: 20
- type: damageType
id: Heat
+ name: damage-type-heat
armorCoefficientPrice: 2.5
armorFlatPrice: 20
- type: damageType
id: Piercing
+ name: damage-type-piercing
armorCoefficientPrice: 2
armorFlatPrice: 10
# Poison damage. Generally caused by various reagents being metabolised.
- type: damageType
id: Poison
+ name: damage-type-poison
armorCoefficientPrice: 10
armorFlatPrice: 60
- type: damageType
id: Radiation
+ name: damage-type-radiation
armorCoefficientPrice: 2.5
armorFlatPrice: 16
- type: damageType
id: Shock
+ name: damage-type-shock
armorCoefficientPrice: 2.5
armorFlatPrice: 20
- type: damageType
id: Slash
+ name: damage-type-slash
armorCoefficientPrice: 2
armorFlatPrice: 10
# Exclusive for structures such as walls, airlocks and others.
- type: damageType
id: Structural
+ name: damage-type-structural
armorCoefficientPrice: 1
armorFlatPrice: 1