diff --git a/Content.Server/NPC/HTN/HTNSystem.cs b/Content.Server/NPC/HTN/HTNSystem.cs index 0a65549b802..acb0f22983d 100644 --- a/Content.Server/NPC/HTN/HTNSystem.cs +++ b/Content.Server/NPC/HTN/HTNSystem.cs @@ -13,7 +13,6 @@ using JetBrains.Annotations; using Robust.Shared.CPUJob.JobQueues; using Robust.Shared.CPUJob.JobQueues.Queues; -using Robust.Shared.Map.Components; using Robust.Shared.Player; using Robust.Shared.Prototypes; using Robust.Shared.Utility; @@ -32,7 +31,7 @@ public sealed class HTNSystem : EntitySystem private EntityQuery _xformQuery; private EntityQuery _loadedQuery; - private EntityQuery _mapQuery; + private EntityQuery _mapQuery; private readonly JobQueue _planQueue = new(0.004); @@ -44,7 +43,7 @@ public override void Initialize() base.Initialize(); _xformQuery = GetEntityQuery(); _loadedQuery = GetEntityQuery(); - _mapQuery = GetEntityQuery(); + _mapQuery = GetEntityQuery(); SubscribeLocalEvent(_npc.OnMobStateChange); SubscribeLocalEvent(_npc.OnNPCMapInit); SubscribeLocalEvent(_npc.OnPlayerNPCAttach); @@ -265,10 +264,10 @@ private bool IsNPCActive(HTNComponent component) /*return _physics.GetCollidingEntities(xform.MapID, Box2.CenteredAround(_transform.GetWorldPosition(xform), new(12))).Any(physicsComponent => physicsComponent.);*/ - if (!_mapQuery.HasComponent(xform.MapUid)) + if (!_mapQuery.TryGetComponent(xform.MapUid, out var worldComponent)) return true; - return _loadedQuery.HasComponent(_world.GetOrCreateChunk(WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored(), xform.MapUid!.Value)); + return _loadedQuery.HasComponent(_world.GetOrCreateChunk(WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored(), xform.MapUid!.Value, worldComponent)); } private void AppendDebugText(HTNTask task, StringBuilder text, List planBtr, List btr, ref int level)