]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add missing DataDefinition constructors (#14603)
authorLeon Friedrich <60421075+ElectroJr@users.noreply.github.com>
Sun, 12 Mar 2023 23:37:24 +0000 (12:37 +1300)
committerGitHub <noreply@github.com>
Sun, 12 Mar 2023 23:37:24 +0000 (16:37 -0700)
Content.Server/Fax/FaxMachineComponent.cs
Content.Shared/Humanoid/HumanoidCharacterAppearance.cs
Content.Shared/Humanoid/Markings/Marking.cs
Content.Shared/Humanoid/Prototypes/HumanoidProfilePrototype.cs
Content.Shared/Preferences/HumanoidCharacterProfile.cs
Content.Tests/Server/Preferences/ServerDbSqliteTests.cs

index 25ceaf179c22413221c895de3a2843928d24cc45..edbc7576504aa6f33fa1fec2baa55874854e33fb 100644 (file)
@@ -123,20 +123,24 @@ public sealed class FaxMachineComponent : Component
 [DataDefinition]
 public sealed class FaxPrintout
 {
-    [DataField("name")]
-    public string Name { get; }
+    [DataField("name", required: true)]
+    public string Name { get; } = default!;
 
-    [DataField("content")]
-    public string Content { get; }
+    [DataField("content", required: true)]
+    public string Content { get; } = default!;
 
-    [DataField("prototypeId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>))]
-    public string PrototypeId { get; }
+    [DataField("prototypeId", customTypeSerializer: typeof(PrototypeIdSerializer<EntityPrototype>), required: true)]
+    public string PrototypeId { get; } = default!;
 
     [DataField("stampState")]
     public string? StampState { get; }
 
     [DataField("stampedBy")]
-    public List<string> StampedBy { get; }
+    public List<string> StampedBy { get; } = new();
+
+    private FaxPrintout()
+    {
+    }
 
     public FaxPrintout(string content, string name, string? prototypeId, string? stampState = null, List<string>? stampedBy = null)
     {
index 5d000fd2706cc439a2365b68553fc50721b22854..4682f302aff8531bb4367b80793f5d8e65a515a2 100644 (file)
@@ -84,17 +84,16 @@ namespace Content.Shared.Humanoid
             return new(HairStyleId, HairColor, FacialHairStyleId, FacialHairColor, EyeColor, SkinColor, newMarkings);
         }
 
-        public static HumanoidCharacterAppearance Default()
+        public HumanoidCharacterAppearance() : this(
+            HairStyles.DefaultHairStyle,
+            Color.Black,
+            HairStyles.DefaultFacialHairStyle,
+            Color.Black,
+            Color.Black,
+            Humanoid.SkinColor.ValidHumanSkinTone,
+            new ()
+        )
         {
-            return new(
-                HairStyles.DefaultHairStyle,
-                Color.Black,
-                HairStyles.DefaultFacialHairStyle,
-                Color.Black,
-                Color.Black,
-                Humanoid.SkinColor.ValidHumanSkinTone,
-                new ()
-            );
         }
 
         public static HumanoidCharacterAppearance DefaultWithSpecies(string species)
index c7d5cb6184dd8dafca2c604bc2cf6983387ac0ad..1b97939a92933b5c3f4aa7997134818ef7819809 100644 (file)
@@ -12,7 +12,11 @@ namespace Content.Shared.Humanoid.Markings
         [DataField("markingColor")]
         private List<Color> _markingColors = new();
 
-        private Marking(string markingId,
+        private Marking()
+        {
+        }
+
+        public Marking(string markingId,
             List<Color> markingColors)
         {
             MarkingId = markingId;
@@ -45,7 +49,7 @@ namespace Content.Shared.Humanoid.Markings
         /// <summary>
         ///     ID of the marking prototype.
         /// </summary>
-        [DataField("markingId")]
+        [DataField("markingId", required: true)]
         public string MarkingId { get; } = default!;
 
         /// <summary>
index f2177db9f1814f237d13513abf207e466a69dbb5..a70042e22ff75d69de35d105bfbb1f9265c42e70 100644 (file)
@@ -14,5 +14,5 @@ public sealed class HumanoidProfilePrototype : IPrototype
     public Dictionary<HumanoidVisualLayers, CustomBaseLayerInfo> CustomBaseLayers = new();
 
     [DataField("profile")]
-    public HumanoidCharacterProfile Profile { get; } = HumanoidCharacterProfile.Default();
+    public HumanoidCharacterProfile Profile { get; } = new();
 }
index 6057588d3c938add5d5efccc1d0fffc33ab93ce3..ecacf14a096fd91870a58d01774aa7c2fd84f562 100644 (file)
@@ -102,25 +102,24 @@ namespace Content.Shared.Preferences
         ///     Defaults to <see cref="SharedHumanoidAppearanceSystem.DefaultSpecies"/> for the species.
         /// </summary>
         /// <returns></returns>
-        public static HumanoidCharacterProfile Default()
+        public HumanoidCharacterProfile() : this(
+            "John Doe",
+            "",
+            SharedHumanoidAppearanceSystem.DefaultSpecies,
+            18,
+            Sex.Male,
+            Gender.Male,
+            new HumanoidCharacterAppearance(),
+            ClothingPreference.Jumpsuit,
+            BackpackPreference.Backpack,
+            new Dictionary<string, JobPriority>
+            {
+                {SharedGameTicker.FallbackOverflowJob, JobPriority.High}
+            },
+            PreferenceUnavailableMode.SpawnAsOverflow,
+            new List<string>(),
+            new List<string>())
         {
-            return new(
-                "John Doe",
-                "",
-                SharedHumanoidAppearanceSystem.DefaultSpecies,
-                18,
-                Sex.Male,
-                Gender.Male,
-                HumanoidCharacterAppearance.Default(),
-                ClothingPreference.Jumpsuit,
-                BackpackPreference.Backpack,
-                new Dictionary<string, JobPriority>
-                {
-                    {SharedGameTicker.FallbackOverflowJob, JobPriority.High}
-                },
-                PreferenceUnavailableMode.SpawnAsOverflow,
-                new List<string>(),
-                new List<string>());
         }
 
         /// <summary>
index 8117922d4379cffb2a145ff0629d1b8c9ad4a139..125a895740bc036e012858d0536409e46cd61481 100644 (file)
@@ -106,7 +106,7 @@ namespace Content.Tests.Server.Preferences
             var prototypeManager = IoCManager.Resolve<IPrototypeManager>();
             prototypeManager.Initialize();
             prototypeManager.LoadFromStream(new StringReader(Prototypes));
-            await db.InitPrefsAsync(username, HumanoidCharacterProfile.Default());
+            await db.InitPrefsAsync(username, new HumanoidCharacterProfile());
             await db.SaveCharacterSlotAsync(username, CharlieCharlieson(), 1);
             await db.SaveSelectedCharacterIndexAsync(username, 1);
             await db.SaveCharacterSlotAsync(username, null, 1);