Skip to content
This repository has been archived by the owner on Nov 1, 2024. It is now read-only.

Commit

Permalink
Clean
Browse files Browse the repository at this point in the history
  • Loading branch information
FireNameFN committed Apr 27, 2024
1 parent 7823f9e commit 9f5d89b
Showing 1 changed file with 2 additions and 9 deletions.
11 changes: 2 additions & 9 deletions Content.Server/NPC/HTN/HTNSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,6 @@ public sealed class HTNSystem : EntitySystem
[Dependency] private readonly IPrototypeManager _prototypeManager = default!;
[Dependency] private readonly NPCSystem _npc = default!;
[Dependency] private readonly NPCUtilitySystem _utility = default!;
//[Dependency] private readonly SharedPhysicsSystem _physics = default!;
//[Dependency] private readonly SharedTransformSystem _transform = default!;
[Dependency] private readonly WorldControllerSystem _world = default!;

private EntityQuery<TransformComponent> _xformQuery;
Expand Down Expand Up @@ -259,15 +257,10 @@ public void UpdateNPC(ref int count, int maxUpdates, float frameTime)

private bool IsNPCActive(HTNComponent component)
{
if (!_xformQuery.TryGetComponent(component.Owner, out TransformComponent? xform))
if (!_xformQuery.TryGetComponent(component.Owner, out TransformComponent? xform) || !_mapQuery.TryGetComponent(xform.MapUid, out var worldComponent))
return true;

/*return _physics.GetCollidingEntities(xform.MapID, Box2.CenteredAround(_transform.GetWorldPosition(xform), new(12))).Any(physicsComponent => physicsComponent.);*/

if (!_mapQuery.TryGetComponent(xform.MapUid, out var worldComponent))
return true;

return _loadedQuery.HasComponent(_world.GetOrCreateChunk(WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored(), xform.MapUid!.Value, worldComponent));
return _loadedQuery.HasComponent(_world.GetOrCreateChunk(WorldGen.WorldToChunkCoords(xform.WorldPosition).Floored(), xform.MapUid.Value, worldComponent));
}

private void AppendDebugText(HTNTask task, StringBuilder text, List<int> planBtr, List<int> btr, ref int level)
Expand Down

0 comments on commit 9f5d89b

Please sign in to comment.