diff --git a/Content.Client/Labels/EntitySystems/LabelSystem.cs b/Content.Client/Labels/EntitySystems/LabelSystem.cs
new file mode 100644
index 0000000000..baa9f7fee7
--- /dev/null
+++ b/Content.Client/Labels/EntitySystems/LabelSystem.cs
@@ -0,0 +1,7 @@
+using Content.Shared.Labels.EntitySystems;
+
+namespace Content.Client.Labels;
+
+public sealed partial class LabelSystem : SharedLabelSystem
+{
+}
diff --git a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
index 7a09d16265..b93498fe31 100644
--- a/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
+++ b/Content.Server/Chemistry/EntitySystems/ReagentDispenserSystem.cs
@@ -1,17 +1,11 @@
using Content.Server.Administration.Logs;
using Content.Server.Chemistry.Components;
using Content.Server.Chemistry.Containers.EntitySystems;
-using Content.Server.Nutrition.Components;
using Content.Server.Nutrition.EntitySystems;
-using Content.Server.Labels.Components;
-using Content.Server.Chemistry;
using Content.Shared.Chemistry;
-using Content.Shared.Chemistry.Components.SolutionManager;
using Content.Shared.Chemistry.Dispenser;
using Content.Shared.Chemistry.EntitySystems;
-using Content.Shared.Chemistry.Reagent;
using Content.Shared.Containers.ItemSlots;
-using Content.Shared.Database;
using Content.Shared.FixedPoint;
using JetBrains.Annotations;
using Robust.Server.Audio;
@@ -19,7 +13,7 @@ using Robust.Server.GameObjects;
using Robust.Shared.Audio;
using Robust.Shared.Containers;
using Robust.Shared.Prototypes;
-using System.Linq;
+using Content.Shared.Labels.Components;
namespace Content.Server.Chemistry.EntitySystems
{
diff --git a/Content.Server/Labels/Label/Components/LabelComponent.cs b/Content.Server/Labels/Label/Components/LabelComponent.cs
deleted file mode 100644
index a23acc55da..0000000000
--- a/Content.Server/Labels/Label/Components/LabelComponent.cs
+++ /dev/null
@@ -1,24 +0,0 @@
-namespace Content.Server.Labels.Components
-{
- ///
- /// Makes entities have a label in their name. Labels are normally given by
- ///
- [RegisterComponent]
- public sealed partial class LabelComponent : Component
- {
- ///
- /// 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 69b4b47f4c..59a1a3b213 100644
--- a/Content.Server/Labels/Label/LabelSystem.cs
+++ b/Content.Server/Labels/Label/LabelSystem.cs
@@ -3,10 +3,10 @@ using Content.Server.Paper;
using Content.Shared.Containers.ItemSlots;
using Content.Shared.Examine;
using Content.Shared.Labels;
+using Content.Shared.Labels.Components;
+using Content.Shared.Labels.EntitySystems;
using JetBrains.Annotations;
-using Robust.Server.GameObjects;
using Robust.Shared.Containers;
-using Robust.Shared.Utility;
namespace Content.Server.Labels
{
@@ -14,7 +14,7 @@ namespace Content.Server.Labels
/// A system that lets players see the contents of a label on an object.
///
[UsedImplicitly]
- public sealed class LabelSystem : EntitySystem
+ public sealed class LabelSystem : SharedLabelSystem
{
[Dependency] private readonly ItemSlotsSystem _itemSlotsSystem = default!;
[Dependency] private readonly SharedAppearanceSystem _appearance = default!;
@@ -26,7 +26,6 @@ namespace Content.Server.Labels
{
base.Initialize();
- SubscribeLocalEvent(OnExamine);
SubscribeLocalEvent(OnLabelCompMapInit);
SubscribeLocalEvent(OnComponentInit);
SubscribeLocalEvent(OnComponentRemove);
@@ -38,7 +37,10 @@ namespace Content.Server.Labels
private void OnLabelCompMapInit(EntityUid uid, LabelComponent component, MapInitEvent args)
{
if (!string.IsNullOrEmpty(component.CurrentLabel))
+ {
component.CurrentLabel = Loc.GetString(component.CurrentLabel);
+ Dirty(uid, component);
+ }
}
///
@@ -65,6 +67,8 @@ namespace Content.Server.Labels
label.CurrentLabel = null;
label.OriginalName = null;
+ Dirty(uid, label);
+
return;
}
@@ -72,6 +76,8 @@ namespace Content.Server.Labels
label.OriginalName ??= metadata.EntityName;
label.CurrentLabel = text;
_metaData.SetEntityName(uid, $"{label.OriginalName} ({text})", metadata);
+
+ Dirty(uid, label);
}
private void OnComponentInit(EntityUid uid, PaperLabelComponent component, ComponentInit args)
@@ -89,19 +95,6 @@ namespace Content.Server.Labels
_itemSlotsSystem.RemoveItemSlot(uid, component.LabelSlot);
}
- private void OnExamine(EntityUid uid, LabelComponent? label, ExaminedEvent args)
- {
- if (!Resolve(uid, ref label))
- return;
-
- if (label.CurrentLabel == null)
- return;
-
- var message = new FormattedMessage();
- message.AddText(Loc.GetString("hand-labeler-has-label", ("label", label.CurrentLabel)));
- args.PushMessage(message);
- }
-
private void OnExamined(EntityUid uid, PaperLabelComponent comp, ExaminedEvent args)
{
if (comp.LabelSlot.Item is not {Valid: true} item)
diff --git a/Content.Shared/Labels/Components/LabelComponent.cs b/Content.Shared/Labels/Components/LabelComponent.cs
new file mode 100644
index 0000000000..c0dccd3481
--- /dev/null
+++ b/Content.Shared/Labels/Components/LabelComponent.cs
@@ -0,0 +1,24 @@
+using Robust.Shared.GameStates;
+
+namespace Content.Shared.Labels.Components;
+
+///
+/// Makes entities have a label in their name. Labels are normally given by
+///
+[RegisterComponent, NetworkedComponent, AutoGenerateComponentState]
+public sealed partial class LabelComponent : Component
+{
+ ///
+ /// 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.
+ ///
+ [DataField, AutoNetworkedField]
+ public string? CurrentLabel { get; set; }
+
+ ///
+ /// The original name of the entity
+ /// Used for reverting the modified entity name when the label is removed
+ ///
+ [DataField, AutoNetworkedField]
+ public string? OriginalName { get; set; }
+}
diff --git a/Content.Shared/Labels/EntitySystems/SharedLabelSystem.cs b/Content.Shared/Labels/EntitySystems/SharedLabelSystem.cs
new file mode 100644
index 0000000000..a8239e7867
--- /dev/null
+++ b/Content.Shared/Labels/EntitySystems/SharedLabelSystem.cs
@@ -0,0 +1,28 @@
+using Content.Shared.Examine;
+using Content.Shared.Labels.Components;
+using Robust.Shared.Utility;
+
+namespace Content.Shared.Labels.EntitySystems;
+
+public abstract partial class SharedLabelSystem : EntitySystem
+{
+ public override void Initialize()
+ {
+ base.Initialize();
+
+ SubscribeLocalEvent(OnExamine);
+ }
+
+ private void OnExamine(EntityUid uid, LabelComponent? label, ExaminedEvent args)
+ {
+ if (!Resolve(uid, ref label))
+ return;
+
+ if (label.CurrentLabel == null)
+ return;
+
+ var message = new FormattedMessage();
+ message.AddText(Loc.GetString("hand-labeler-has-label", ("label", label.CurrentLabel)));
+ args.PushMessage(message);
+ }
+}