-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
30 changed files
with
580 additions
and
617 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
.git | ||
.idea | ||
node_modules/ | ||
.tmp | ||
.temp | ||
.DS_Store |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,40 +1,5 @@ | ||
import { Worker } from 'worker_threads'; | ||
import { PathfindingEvents } from './events'; | ||
import { PathfindingLayer } from './layer'; | ||
import type { PathfindingTaskCallback, PathfindingTaskResult } from './task/types'; | ||
import type { PathfindingGrid, PathfindingConfig, PathfindingPoint } from './types'; | ||
export declare class Pathfinding { | ||
readonly worker: Worker; | ||
readonly events: PathfindingEvents; | ||
private readonly layers; | ||
/** | ||
* Create pathfinding worker thread. | ||
* | ||
* @param config - Pathfinding configuration | ||
*/ | ||
constructor({ loopRate, resourceLimits }?: PathfindingConfig); | ||
/** | ||
* Terminate worker thread. | ||
*/ | ||
destroy(): Promise<number>; | ||
/** | ||
* Create a new layer of grid. | ||
* | ||
* @param grid - Grid with walkable tiles | ||
*/ | ||
createLayer(grid: PathfindingGrid): PathfindingLayer; | ||
/** | ||
* Check for layer presence. | ||
* | ||
* @param id - Layer id | ||
*/ | ||
hasLayer(id: string): boolean; | ||
/** | ||
* Remove layer of grid. | ||
* | ||
* @param id - Layer id | ||
*/ | ||
removeLayer(id: string): void; | ||
private unflatPath; | ||
} | ||
export type { PathfindingGrid, PathfindingPoint, PathfindingLayer, PathfindingTaskCallback, PathfindingTaskResult, }; | ||
export { Pathfinding } from './pathfinding'; | ||
import type { PathfindingLayer } from './layer'; | ||
import type { PathfindingTaskCallback, PathfindingTaskConfig, PathfindingTaskResult } from './task/types'; | ||
import type { PathfindingGrid, PathfindingPoint } from './types'; | ||
export type { PathfindingGrid, PathfindingPoint, PathfindingLayer, PathfindingTaskCallback, PathfindingTaskConfig, PathfindingTaskResult, }; |
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { Worker } from 'worker_threads'; | ||
import { PathfindingEvents } from '../events'; | ||
import { PathfindingLayer } from '../layer'; | ||
import type { PathfindingConfig } from './types'; | ||
import type { PathfindingGrid } from '../types'; | ||
export declare class Pathfinding { | ||
readonly worker: Worker; | ||
readonly events: PathfindingEvents; | ||
private readonly layers; | ||
/** | ||
* Create pathfinding worker thread. | ||
* | ||
* @param config - Pathfinding configuration | ||
*/ | ||
constructor({ loopRate, resourceLimits }?: PathfindingConfig); | ||
/** | ||
* Terminate worker thread. | ||
*/ | ||
destroy(): Promise<number>; | ||
/** | ||
* Create a new layer of grid. | ||
* | ||
* @param grid - Grid with walkable tiles | ||
*/ | ||
createLayer(grid: PathfindingGrid): PathfindingLayer; | ||
/** | ||
* Check for layer presence. | ||
* | ||
* @param id - Layer id | ||
*/ | ||
hasLayer(id: string): boolean; | ||
/** | ||
* Remove layer of grid. | ||
* | ||
* @param id - Layer id | ||
*/ | ||
removeLayer(id: string): void; | ||
private static unflatPath; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import type { ResourceLimits } from 'worker_threads'; | ||
export type PathfindingConfig = { | ||
/** | ||
* Finding process loop rate | ||
* Default: 200 ms | ||
*/ | ||
loopRate?: number; | ||
/** | ||
* Worker resource limits | ||
*/ | ||
resourceLimits?: ResourceLimits; | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.