From: Tayrtahn Date: Sun, 21 Jul 2024 16:17:03 +0000 (-0400) Subject: Fix error when manually adding ChasingWalkComponent to an entity (#30207) X-Git-Url: https://git.smokeofanarchy.ru/gitweb.cgi?a=commitdiff_plain;h=3e3cfdb9489c3d50a6e25b55874a0271d9f7987a;p=space-station-14.git Fix error when manually adding ChasingWalkComponent to an entity (#30207) --- diff --git a/Content.Server/Physics/Components/ChasingWalkComponent.cs b/Content.Server/Physics/Components/ChasingWalkComponent.cs index 222c9d64db..819fd80939 100644 --- a/Content.Server/Physics/Components/ChasingWalkComponent.cs +++ b/Content.Server/Physics/Components/ChasingWalkComponent.cs @@ -65,7 +65,7 @@ public sealed partial class ChasingWalkComponent : Component /// The component that the entity is chasing /// [DataField(required: true)] - public ComponentRegistry ChasingComponent = default!; + public ComponentRegistry ChasingComponent = []; /// /// The maximum radius in which the entity chooses the target component to follow diff --git a/Content.Server/Physics/Controllers/ChasingWalkSystem.cs b/Content.Server/Physics/Controllers/ChasingWalkSystem.cs index 618dd4156f..fa55ce024e 100644 --- a/Content.Server/Physics/Controllers/ChasingWalkSystem.cs +++ b/Content.Server/Physics/Controllers/ChasingWalkSystem.cs @@ -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;