public override void OnNPCUpdate(NPCBase npc) { Assert.IsFalse(pathingThreadIsQueued); if (pathingThreadResult != EPathResult.None) { var resultRead = pathingThreadResult; pathingThreadResult = EPathResult.None; switch (resultRead) { case EPathResult.AdjustPosition: npc.SetPosition(pathingThreadPathStart); npc.state.SetCooldown(npc.oneOverSpeed); return; case EPathResult.NotFoundPath: OnFailGoal(npc); return; case EPathResult.NotFoundViaNavMesh: { // try to find it via the direct method instead if (StorageFactory.CrateTracker.TryGetClosestInColony(npc.Colony, npc.Position, out var directGoal)) { CrateLocation = directGoal; if (PathingManager.TryGetClosestPositionWorldNotAt(directGoal, npc.Position, out bool result, out var directGoalStanding) && result) { crateLocationStanding = directGoalStanding; QueuePathThreadActionWithGoal(npc); } else { OnFailGoal(npc, false); } } else { if (ServerManager.BlockEntityTracker.BannerTracker.TryGetClosest(npc.Position, out var banner)) { CrateLocation = banner.Position; crateLocationStanding = banner.Position; QueuePathThreadActionWithGoal(npc); } else { OnFailGoal(npc); } } return; }