]> git.smokeofanarchy.ru Git - space-station-14.git/commitdiff
Fix error when manually adding ChasingWalkComponent to an entity (#30207)
authorTayrtahn <tayrtahn@gmail.com>
Sun, 21 Jul 2024 16:17:03 +0000 (12:17 -0400)
committerGitHub <noreply@github.com>
Sun, 21 Jul 2024 16:17:03 +0000 (12:17 -0400)
Content.Server/Physics/Components/ChasingWalkComponent.cs
Content.Server/Physics/Controllers/ChasingWalkSystem.cs

index 222c9d64db8dbe427b5a3ac723f1ca36ffd6d838..819fd80939926fe5899d82eac2aff2541f86b9b5 100644 (file)
@@ -65,7 +65,7 @@ public sealed partial class ChasingWalkComponent : Component
     /// The component that the entity is chasing
     /// </summary>
     [DataField(required: true)]
-    public ComponentRegistry ChasingComponent = default!;
+    public ComponentRegistry ChasingComponent = [];
 
     /// <summary>
     /// The maximum radius in which the entity chooses the target component to follow
index 618dd4156fc03a1a1e96ece15544e18858c6a6c0..fa55ce024e445151b716a7ff2ffe28b509e7b3cb 100644 (file)
@@ -61,6 +61,9 @@ public sealed class ChasingWalkSystem : VirtualController
 
     private void ChangeTarget(EntityUid uid, ChasingWalkComponent component)
     {
+        if (component.ChasingComponent.Count <= 0)
+            return;
+
         //We find our coordinates and calculate the radius of the target search.
         var xform = Transform(uid);
         var range = component.MaxChaseRadius;