diff --git a/Content.Server/Labels/Label/Components/LabelComponent.cs b/Content.Server/Labels/Label/Components/LabelComponent.cs
index d697d6260a..a23acc55da 100644
--- a/Content.Server/Labels/Label/Components/LabelComponent.cs
+++ b/Content.Server/Labels/Label/Components/LabelComponent.cs
@@ -7,12 +7,17 @@ namespace Content.Server.Labels.Components
public sealed partial class LabelComponent : Component
{
///
- /// The actual text in the label
+ /// Current text on the label. If set before map init, during map init this string will be localized.
+ /// This permits localized preset labels with fallback to the text written on the label.
///
[ViewVariables(VVAccess.ReadWrite)]
[DataField("currentLabel")]
public string? CurrentLabel { get; set; }
+ ///
+ /// The original name of the entity
+ /// Used for reverting the modified entity name when the label is removed
+ ///
[DataField("originalName")]
public string? OriginalName { get; set; }
}
diff --git a/Content.Server/Labels/Label/LabelSystem.cs b/Content.Server/Labels/Label/LabelSystem.cs
index d20295d072..69b4b47f4c 100644
--- a/Content.Server/Labels/Label/LabelSystem.cs
+++ b/Content.Server/Labels/Label/LabelSystem.cs
@@ -27,6 +27,7 @@ namespace Content.Server.Labels
base.Initialize();
SubscribeLocalEvent(OnExamine);
+ SubscribeLocalEvent(OnLabelCompMapInit);
SubscribeLocalEvent(OnComponentInit);
SubscribeLocalEvent(OnComponentRemove);
SubscribeLocalEvent(OnContainerModified);
@@ -34,6 +35,12 @@ namespace Content.Server.Labels
SubscribeLocalEvent(OnExamined);
}
+ private void OnLabelCompMapInit(EntityUid uid, LabelComponent component, MapInitEvent args)
+ {
+ if (!string.IsNullOrEmpty(component.CurrentLabel))
+ component.CurrentLabel = Loc.GetString(component.CurrentLabel);
+ }
+
///
/// Apply or remove a label on an entity.
///
diff --git a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
index 01f5e45c47..c8a204e115 100644
--- a/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
+++ b/Resources/Prototypes/Entities/Objects/Specific/chemical-containers.yml
@@ -58,7 +58,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: carbon
+ currentLabel: reagent-name-carbon
- type: SolutionContainerManager
solutions:
beaker:
@@ -73,7 +73,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: iodine
+ currentLabel: reagent-name-iodine
- type: SolutionContainerManager
solutions:
beaker:
@@ -88,7 +88,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: fluorine
+ currentLabel: reagent-name-fluorine
- type: SolutionContainerManager
solutions:
beaker:
@@ -103,7 +103,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: chlorine
+ currentLabel: reagent-name-chlorine
- type: SolutionContainerManager
solutions:
beaker:
@@ -118,7 +118,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: aluminium
+ currentLabel: reagent-name-aluminium
- type: SolutionContainerManager
solutions:
beaker:
@@ -133,7 +133,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: phosphorus
+ currentLabel: reagent-name-phosphorus
- type: SolutionContainerManager
solutions:
beaker:
@@ -148,7 +148,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: sulfur
+ currentLabel: reagent-name-sulfur
- type: SolutionContainerManager
solutions:
beaker:
@@ -163,7 +163,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: silicon
+ currentLabel: reagent-name-silicon
- type: SolutionContainerManager
solutions:
beaker:
@@ -178,7 +178,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: hydrogen
+ currentLabel: reagent-name-hydrogen
- type: SolutionContainerManager
solutions:
beaker:
@@ -193,7 +193,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: lithium
+ currentLabel: reagent-name-lithium
- type: SolutionContainerManager
solutions:
beaker:
@@ -208,7 +208,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: sodium
+ currentLabel: reagent-name-sodium
- type: SolutionContainerManager
solutions:
beaker:
@@ -223,7 +223,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: potassium
+ currentLabel: reagent-name-potassium
- type: SolutionContainerManager
solutions:
beaker:
@@ -238,7 +238,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: radium
+ currentLabel: reagent-name-radium
- type: SolutionContainerManager
solutions:
beaker:
@@ -253,7 +253,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: iron
+ currentLabel: reagent-name-iron
- type: SolutionContainerManager
solutions:
beaker:
@@ -268,7 +268,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: copper
+ currentLabel: reagent-name-copper
- type: SolutionContainerManager
solutions:
beaker:
@@ -283,7 +283,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: gold
+ currentLabel: reagent-name-gold
- type: SolutionContainerManager
solutions:
beaker:
@@ -298,7 +298,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: mercury
+ currentLabel: reagent-name-mercury
- type: SolutionContainerManager
solutions:
beaker:
@@ -313,7 +313,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: silver
+ currentLabel: reagent-name-silver
- type: SolutionContainerManager
solutions:
beaker:
@@ -328,7 +328,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: ethanol
+ currentLabel: reagent-name-ethanol
- type: SolutionContainerManager
solutions:
beaker:
@@ -343,7 +343,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: sugar
+ currentLabel: reagent-name-sugar
- type: SolutionContainerManager
solutions:
beaker:
@@ -358,7 +358,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: nitrogen
+ currentLabel: reagent-name-nitrogen
- type: SolutionContainerManager
solutions:
beaker:
@@ -373,7 +373,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: oxygen
+ currentLabel: reagent-name-oxygen
- type: SolutionContainerManager
solutions:
beaker:
@@ -388,7 +388,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: Plant-B-Gone
+ currentLabel: reagent-name-plant-b-gone
- type: SolutionContainerManager
solutions:
beaker:
@@ -403,7 +403,7 @@
noSpawn: true
components:
- type: Label
- currentLabel: welding fuel
+ currentLabel: reagent-name-welding-fuel
- type: SolutionContainerManager
solutions:
beaker: