]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Add puller sanity test (#24885)
authormetalgearsloth <31366439+metalgearsloth@users.noreply.github.com>
Sat, 3 Feb 2024 01:51:05 +0000 (12:51 +1100)
committerGitHub <noreply@github.com>
Sat, 3 Feb 2024 01:51:05 +0000 (12:51 +1100)
* Add puller sanity test

* weh

* NRTs

Content.IntegrationTests/Tests/Puller/PullerTest.cs [new file with mode: 0644]
Resources/Prototypes/Entities/Mobs/NPCs/animals.yml

diff --git a/Content.IntegrationTests/Tests/Puller/PullerTest.cs b/Content.IntegrationTests/Tests/Puller/PullerTest.cs
new file mode 100644 (file)
index 0000000..ba91f54
--- /dev/null
@@ -0,0 +1,45 @@
+using Content.Shared.Hands.Components;
+using Content.Shared.Prototypes;
+using Content.Shared.Pulling.Components;
+using Robust.Shared.GameObjects;
+using Robust.Shared.Prototypes;
+
+namespace Content.IntegrationTests.Tests.Puller;
+
+#nullable enable
+
+[TestFixture]
+public sealed class PullerTest
+{
+    /// <summary>
+    /// Checks that needsHands on PullerComponent is not set on mobs that don't even have hands.
+    /// </summary>
+    [Test]
+    public async Task PullerSanityTest()
+    {
+        await using var pair = await PoolManager.GetServerClient();
+        var server = pair.Server;
+
+        var compFactory = server.ResolveDependency<IComponentFactory>();
+        var protoManager = server.ResolveDependency<IPrototypeManager>();
+
+        await server.WaitAssertion(() =>
+        {
+            Assert.Multiple(() =>
+            {
+                foreach (var proto in protoManager.EnumeratePrototypes<EntityPrototype>())
+                {
+                    if (!proto.TryGetComponent(out SharedPullerComponent? puller))
+                        continue;
+
+                    if (!puller.NeedsHands)
+                        continue;
+
+                    Assert.That(proto.HasComponent<HandsComponent>(compFactory), $"Found puller {proto} with NeedsHand pulling but has no hands?");
+                }
+            });
+        });
+
+        await pair.CleanReturnAsync();
+    }
+}
index 07df41119a0f1b5a0495650cdf360bdfb7b80c54..6087123b4334300d75fbd8e5853dbcab89f08c93 100644 (file)
@@ -58,8 +58,6 @@
     damage:
       types:
         Piercing: 5
-  - type: Puller
-    needsHands: true
   - type: Tag
     tags:
     - VimPilot
   - type: HTN
     rootTask:
       task: SimpleHostileCompound
-  - type: Puller
-    needsHands: true
   - type: ZombieImmune
 
 - type: entity
     accent: chicken
   - type: SentienceTarget
     flavorKind: station-event-random-sentience-flavor-organic
-  - type: Puller
-    needsHands: true
   - type: NpcFactionMember
     factions:
     - Passive
-    
+
 - type: entity
   parent: MobChicken
   id: MobChicken1
         Base: dead-1
       Dead:
         Base: dead-1
-        
+
 - type: entity
   parent: MobChicken
   id: MobChicken2
     prototype: Mothroach
   - type: TypingIndicator
     proto: moth
-  - type: Puller
-    needsHands: true
   - type: Destructible
     thresholds:
     - trigger:
     bloodMaxVolume: 0.1
   - type: MobPrice
     price: 50
-  - type: Puller
-    needsHands: true
 
 - type: entity
   name: cow
       path: /Audio/Animals/goose_honk.ogg
   - type: Bloodstream
     bloodMaxVolume: 100
-  - type: Puller
   - type: NpcFactionMember
     factions:
     - Passive
   - type: HTN
     rootTask:
       task: SimpleHostileCompound
-  - type: Puller
 
 - type: entity
   name: kangaroo
   - type: GhostTakeoverAvailable
   - type: Loadout
     prototypes: [SyndicateOperativeGearMonkey]
-  
+
 - type: entity
   id: MobMonkeySyndicateAgent
   parent: MobBaseSyndicateMonkey
   - type: CanEscapeInventory
   - type: MobPrice
     price: 50
-  - type: Puller
-    needsHands: true
   - type: BadFood
   - type: NonSpreaderZombie
   - type: PreventSpiller
   - type: Damageable
     damageContainer: Biological
     damageModifierSet: Scale
-  - type: Puller
-    needsHands: true
   - type: Tag
     tags:
     - VimPilot
       path: /Audio/Animals/frog_ribbit.ogg
   - type: Bloodstream
     bloodMaxVolume: 50
-  - type: Puller
-    needsHands: true
   - type: Tag
     tags:
     - VimPilot
   - type: Damageable
     damageContainer: Biological
     damageModifierSet: Scale
-  - type: Puller
-    needsHands: true
 
 # Code unique spider prototypes or combine them all into one spider and get a
 # random sprite state when you spawn it.
       gender: epicene
   - type: SentienceTarget
     flavorKind: station-event-random-sentience-flavor-corgi
-  - type: Puller
   - type: MobPrice
     price: 200
   - type: Tag