]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Move id and health examinable to shared (#27867)
authorDrSmugleaf <10968691+DrSmugleaf@users.noreply.github.com>
Fri, 10 May 2024 01:26:39 +0000 (18:26 -0700)
committerGitHub <noreply@github.com>
Fri, 10 May 2024 01:26:39 +0000 (11:26 +1000)
* Move id and health examinable to shared

* Make GetInfo public

Content.Server/Access/Components/IdExaminableComponent.cs [deleted file]
Content.Server/Body/Systems/BloodstreamSystem.cs
Content.Shared/Access/Components/IdCardComponent.cs
Content.Shared/Access/Components/IdExaminableComponent.cs [new file with mode: 0644]
Content.Shared/Access/Systems/IdExaminableSystem.cs [moved from Content.Server/Access/Systems/IdExaminableSystem.cs with 85% similarity]
Content.Shared/Access/Systems/SharedIdCardSystem.cs
Content.Shared/HealthExaminable/HealthExaminableComponent.cs [moved from Content.Server/HealthExaminable/HealthExaminableComponent.cs with 64% similarity]
Content.Shared/HealthExaminable/HealthExaminableSystem.cs [moved from Content.Server/HealthExaminable/HealthExaminableSystem.cs with 95% similarity]

diff --git a/Content.Server/Access/Components/IdExaminableComponent.cs b/Content.Server/Access/Components/IdExaminableComponent.cs
deleted file mode 100644 (file)
index 2def517..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-using Content.Server.Access.Systems;
-
-namespace Content.Server.Access.Components;
-
-[RegisterComponent, Access(typeof(IdExaminableSystem))]
-public sealed partial class IdExaminableComponent : Component
-{
-}
index 9e29fdf75680a8f4bdaf1170383881bae321d5d1..ddeb154e790a90a34b979ba7ec711d8c2398818c 100644 (file)
@@ -3,7 +3,6 @@ using Content.Server.Chemistry.Containers.EntitySystems;
 using Content.Server.Chemistry.ReactionEffects;
 using Content.Server.Fluids.EntitySystems;
 using Content.Server.Forensics;
-using Content.Server.HealthExaminable;
 using Content.Server.Popups;
 using Content.Shared.Alert;
 using Content.Shared.Chemistry.Components;
@@ -13,6 +12,7 @@ using Content.Shared.Damage;
 using Content.Shared.Damage.Prototypes;
 using Content.Shared.Drunk;
 using Content.Shared.FixedPoint;
+using Content.Shared.HealthExaminable;
 using Content.Shared.Mobs.Systems;
 using Content.Shared.Popups;
 using Content.Shared.Rejuvenate;
index 26e83c5586e00c12708ffb7e60dc909abc1d38cc..39d5d9d27f328e633338ae7c7cf4b4b1aa5bc2eb 100644 (file)
@@ -40,4 +40,10 @@ public sealed partial class IdCardComponent : Component
     /// </summary>
     [DataField, ViewVariables(VVAccess.ReadWrite)]
     public bool BypassLogging;
+
+    [DataField]
+    public LocId NameLocId = "access-id-card-component-owner-name-job-title-text";
+
+    [DataField]
+    public LocId FullNameLocId = "access-id-card-component-owner-full-name-job-title-text";
 }
diff --git a/Content.Shared/Access/Components/IdExaminableComponent.cs b/Content.Shared/Access/Components/IdExaminableComponent.cs
new file mode 100644 (file)
index 0000000..87d3e03
--- /dev/null
@@ -0,0 +1,6 @@
+using Content.Shared.Access.Systems;
+
+namespace Content.Shared.Access.Components;
+
+[RegisterComponent, Access(typeof(IdExaminableSystem))]
+public sealed partial class IdExaminableComponent : Component;
similarity index 85%
rename from Content.Server/Access/Systems/IdExaminableSystem.cs
rename to Content.Shared/Access/Systems/IdExaminableSystem.cs
index c2231605e4a84321457ae47fbd3a795bf077ebba..333272e27acd10ad72ccfa53ea71a95721a358cf 100644 (file)
@@ -1,4 +1,3 @@
-using Content.Server.Access.Components;
 using Content.Shared.Access.Components;
 using Content.Shared.Examine;
 using Content.Shared.Inventory;
@@ -6,7 +5,7 @@ using Content.Shared.PDA;
 using Content.Shared.Verbs;
 using Robust.Shared.Utility;
 
-namespace Content.Server.Access.Systems;
+namespace Content.Shared.Access.Systems;
 
 public sealed class IdExaminableSystem : EntitySystem
 {
@@ -22,7 +21,7 @@ public sealed class IdExaminableSystem : EntitySystem
     private void OnGetExamineVerbs(EntityUid uid, IdExaminableComponent component, GetVerbsEvent<ExamineVerb> args)
     {
         var detailsRange = _examineSystem.IsInDetailsRange(args.User, uid);
-        var info = GetInfo(uid) ?? Loc.GetString("id-examinable-component-verb-no-id");
+        var info = GetMessage(uid);
 
         var verb = new ExamineVerb()
         {
@@ -41,7 +40,12 @@ public sealed class IdExaminableSystem : EntitySystem
         args.Verbs.Add(verb);
     }
 
-    private string? GetInfo(EntityUid uid)
+    public string GetMessage(EntityUid uid)
+    {
+        return GetInfo(uid) ?? Loc.GetString("id-examinable-component-verb-no-id");
+    }
+
+    public string? GetInfo(EntityUid uid)
     {
         if (_inventorySystem.TryGetSlotEntity(uid, "id", out var idUid))
         {
@@ -65,9 +69,9 @@ public sealed class IdExaminableSystem : EntitySystem
         var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
 
         var val = string.IsNullOrWhiteSpace(id.FullName)
-            ? Loc.GetString("access-id-card-component-owner-name-job-title-text",
+            ? Loc.GetString(id.NameLocId,
                 ("jobSuffix", jobSuffix))
-            : Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
+            : Loc.GetString(id.FullNameLocId,
                 ("fullName", id.FullName),
                 ("jobSuffix", jobSuffix));
 
index 11a61c7bf30cf7daacc73d283f5c8c6449057065..bfde70f5041cc5195899a410849be94f67dd11c5 100644 (file)
@@ -207,9 +207,9 @@ public abstract class SharedIdCardSystem : EntitySystem
         var jobSuffix = string.IsNullOrWhiteSpace(id.JobTitle) ? string.Empty : $" ({id.JobTitle})";
 
         var val = string.IsNullOrWhiteSpace(id.FullName)
-            ? Loc.GetString("access-id-card-component-owner-name-job-title-text",
+            ? Loc.GetString(id.NameLocId,
                 ("jobSuffix", jobSuffix))
-            : Loc.GetString("access-id-card-component-owner-full-name-job-title-text",
+            : Loc.GetString(id.FullNameLocId,
                 ("fullName", id.FullName),
                 ("jobSuffix", jobSuffix));
         _metaSystem.SetEntityName(uid, val);
similarity index 64%
rename from Content.Server/HealthExaminable/HealthExaminableComponent.cs
rename to Content.Shared/HealthExaminable/HealthExaminableComponent.cs
index 3f434a93cfed1ae6c1b5adb945794fb2507994d1..e63a4cde15dc357a19507675cb679fd8fd786a88 100644 (file)
@@ -1,8 +1,8 @@
 using Content.Shared.Damage.Prototypes;
 using Content.Shared.FixedPoint;
-using Robust.Shared.Serialization.TypeSerializers.Implementations.Custom.Prototype.Set;
+using Robust.Shared.Prototypes;
 
-namespace Content.Server.HealthExaminable;
+namespace Content.Shared.HealthExaminable;
 
 [RegisterComponent, Access(typeof(HealthExaminableSystem))]
 public sealed partial class HealthExaminableComponent : Component
@@ -10,14 +10,14 @@ public sealed partial class HealthExaminableComponent : Component
     public List<FixedPoint2> Thresholds = new()
         { FixedPoint2.New(10), FixedPoint2.New(25), FixedPoint2.New(50), FixedPoint2.New(75) };
 
-    [DataField("examinableTypes", required: true, customTypeSerializer:typeof(PrototypeIdHashSetSerializer<DamageTypePrototype>))]
-    public HashSet<string> ExaminableTypes = default!;
+    [DataField(required: true)]
+    public HashSet<ProtoId<DamageTypePrototype>> ExaminableTypes = default!;
 
     /// <summary>
     ///     Health examine text is automatically generated through creating loc string IDs, in the form:
     ///     `health-examine-[prefix]-[type]-[threshold]`
     ///     This part determines the prefix.
     /// </summary>
-    [DataField("locPrefix")]
+    [DataField]
     public string LocPrefix = "carbon";
 }
similarity index 95%
rename from Content.Server/HealthExaminable/HealthExaminableSystem.cs
rename to Content.Shared/HealthExaminable/HealthExaminableSystem.cs
index ed69a1c096a095744161995c9e03cc77f77ad33e..141f3be51265ef1e13488de26e0c12216e72a987 100644 (file)
@@ -5,7 +5,7 @@ using Content.Shared.IdentityManagement;
 using Content.Shared.Verbs;
 using Robust.Shared.Utility;
 
-namespace Content.Server.HealthExaminable;
+namespace Content.Shared.HealthExaminable;
 
 public sealed class HealthExaminableSystem : EntitySystem
 {
@@ -42,7 +42,7 @@ public sealed class HealthExaminableSystem : EntitySystem
         args.Verbs.Add(verb);
     }
 
-    private FormattedMessage CreateMarkup(EntityUid uid, HealthExaminableComponent component, DamageableComponent damage)
+    public FormattedMessage CreateMarkup(EntityUid uid, HealthExaminableComponent component, DamageableComponent damage)
     {
         var msg = new FormattedMessage();