]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Cleanup prototype instantiation in `DamageTest` (#38639)
authorTayrtahn <tayrtahn@gmail.com>
Sat, 28 Jun 2025 18:12:36 +0000 (14:12 -0400)
committerGitHub <noreply@github.com>
Sat, 28 Jun 2025 18:12:36 +0000 (20:12 +0200)
Cleanup prototype instantiation in DamageTest

Content.Tests/Shared/DamageTest.cs

index 88beca8841c853047638f39976b80b0268cd7ee3..58fa8fbde39dcc81720fc18a2c2c15930ce0a87a 100644 (file)
@@ -4,7 +4,6 @@ using NUnit.Framework;
 using Robust.Shared.IoC;
 using Robust.Shared.Prototypes;
 using Robust.Shared.Serialization.Manager;
-using System.Collections.Generic;
 using Content.Shared.FixedPoint;
 
 namespace Content.Tests.Shared
@@ -16,23 +15,6 @@ namespace Content.Tests.Shared
     [TestOf(typeof(DamageGroupPrototype))]
     public sealed class DamageTest : ContentUnitTest
     {
-
-        private static Dictionary<string, float> _resistanceCoefficientDict = new()
-        {
-            // "missing" blunt entry
-            { "Piercing", -2 },// Turn Piercing into Healing
-            { "Slash", 3 },
-            { "Radiation", 1.5f },
-        };
-
-        private static Dictionary<string, float> _resistanceReductionDict = new()
-        {
-            { "Blunt", - 5 },
-            // "missing" piercing entry
-            { "Slash", 8 },
-            { "Radiation", 0.5f },  // Fractional adjustment
-        };
-
         private IPrototypeManager _prototypeManager;
 
         private DamageSpecifier _damageSpec;
@@ -139,11 +121,7 @@ namespace Content.Tests.Shared
             DamageSpecifier damageSpec = 10 * new DamageSpecifier(_damageSpec);
 
             // Create a modifier set
-            DamageModifierSetPrototype modifierSet = new()
-            {
-                Coefficients = _resistanceCoefficientDict,
-                FlatReduction = _resistanceReductionDict
-            };
+            var modifierSet = _prototypeManager.Index<DamageModifierSetPrototype>("ModifierTestSet");
 
             //damage is initially   20 / 20 / 10 / 30
             //Each time we subtract -5 /  0 /  8 /  0.5
@@ -289,6 +267,17 @@ namespace Content.Tests.Shared
   flatReductions:
     Blunt: 5
 
+- type: damageModifierSet
+  id: ModifierTestSet
+  coefficients:
+    Piercing: -2
+    Slash: 3
+    Radiation: 1.5
+  flatReductions:
+    Blunt: -5
+    Slash: 8
+    Radiation: 0.5
+
 - type: damageContainer
   id: Biological
   supportedGroups: