Localize preset labels on chem dispenser (#24617)
This commit is contained in:
@@ -7,12 +7,17 @@ namespace Content.Server.Labels.Components
|
|||||||
public sealed partial class LabelComponent : Component
|
public sealed partial class LabelComponent : Component
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 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.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[ViewVariables(VVAccess.ReadWrite)]
|
[ViewVariables(VVAccess.ReadWrite)]
|
||||||
[DataField("currentLabel")]
|
[DataField("currentLabel")]
|
||||||
public string? CurrentLabel { get; set; }
|
public string? CurrentLabel { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// The original name of the entity
|
||||||
|
/// Used for reverting the modified entity name when the label is removed
|
||||||
|
/// </summary>
|
||||||
[DataField("originalName")]
|
[DataField("originalName")]
|
||||||
public string? OriginalName { get; set; }
|
public string? OriginalName { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,6 +27,7 @@ namespace Content.Server.Labels
|
|||||||
base.Initialize();
|
base.Initialize();
|
||||||
|
|
||||||
SubscribeLocalEvent<LabelComponent, ExaminedEvent>(OnExamine);
|
SubscribeLocalEvent<LabelComponent, ExaminedEvent>(OnExamine);
|
||||||
|
SubscribeLocalEvent<LabelComponent, MapInitEvent>(OnLabelCompMapInit);
|
||||||
SubscribeLocalEvent<PaperLabelComponent, ComponentInit>(OnComponentInit);
|
SubscribeLocalEvent<PaperLabelComponent, ComponentInit>(OnComponentInit);
|
||||||
SubscribeLocalEvent<PaperLabelComponent, ComponentRemove>(OnComponentRemove);
|
SubscribeLocalEvent<PaperLabelComponent, ComponentRemove>(OnComponentRemove);
|
||||||
SubscribeLocalEvent<PaperLabelComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
|
SubscribeLocalEvent<PaperLabelComponent, EntInsertedIntoContainerMessage>(OnContainerModified);
|
||||||
@@ -34,6 +35,12 @@ namespace Content.Server.Labels
|
|||||||
SubscribeLocalEvent<PaperLabelComponent, ExaminedEvent>(OnExamined);
|
SubscribeLocalEvent<PaperLabelComponent, ExaminedEvent>(OnExamined);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void OnLabelCompMapInit(EntityUid uid, LabelComponent component, MapInitEvent args)
|
||||||
|
{
|
||||||
|
if (!string.IsNullOrEmpty(component.CurrentLabel))
|
||||||
|
component.CurrentLabel = Loc.GetString(component.CurrentLabel);
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Apply or remove a label on an entity.
|
/// Apply or remove a label on an entity.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
@@ -58,7 +58,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: carbon
|
currentLabel: reagent-name-carbon
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -73,7 +73,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: iodine
|
currentLabel: reagent-name-iodine
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -88,7 +88,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: fluorine
|
currentLabel: reagent-name-fluorine
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -103,7 +103,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: chlorine
|
currentLabel: reagent-name-chlorine
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -118,7 +118,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: aluminium
|
currentLabel: reagent-name-aluminium
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -133,7 +133,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: phosphorus
|
currentLabel: reagent-name-phosphorus
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -148,7 +148,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: sulfur
|
currentLabel: reagent-name-sulfur
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -163,7 +163,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: silicon
|
currentLabel: reagent-name-silicon
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -178,7 +178,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: hydrogen
|
currentLabel: reagent-name-hydrogen
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -193,7 +193,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: lithium
|
currentLabel: reagent-name-lithium
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -208,7 +208,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: sodium
|
currentLabel: reagent-name-sodium
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -223,7 +223,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: potassium
|
currentLabel: reagent-name-potassium
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -238,7 +238,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: radium
|
currentLabel: reagent-name-radium
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -253,7 +253,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: iron
|
currentLabel: reagent-name-iron
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -268,7 +268,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: copper
|
currentLabel: reagent-name-copper
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -283,7 +283,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: gold
|
currentLabel: reagent-name-gold
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -298,7 +298,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: mercury
|
currentLabel: reagent-name-mercury
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -313,7 +313,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: silver
|
currentLabel: reagent-name-silver
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -328,7 +328,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: ethanol
|
currentLabel: reagent-name-ethanol
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -343,7 +343,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: sugar
|
currentLabel: reagent-name-sugar
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -358,7 +358,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: nitrogen
|
currentLabel: reagent-name-nitrogen
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -373,7 +373,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: oxygen
|
currentLabel: reagent-name-oxygen
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -388,7 +388,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: Plant-B-Gone
|
currentLabel: reagent-name-plant-b-gone
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
@@ -403,7 +403,7 @@
|
|||||||
noSpawn: true
|
noSpawn: true
|
||||||
components:
|
components:
|
||||||
- type: Label
|
- type: Label
|
||||||
currentLabel: welding fuel
|
currentLabel: reagent-name-welding-fuel
|
||||||
- type: SolutionContainerManager
|
- type: SolutionContainerManager
|
||||||
solutions:
|
solutions:
|
||||||
beaker:
|
beaker:
|
||||||
|
|||||||
Reference in New Issue
Block a user