Skip to content

Commit 33e49ed

Browse files
authored
Merge pull request #29 from valerian/tuplesArraysFix
replaced erroneous 1-tuples with proper arrays where relevant
2 parents 91891f9 + 46cbb04 commit 33e49ed

File tree

4 files changed

+11
-11
lines changed

4 files changed

+11
-11
lines changed

dist/screeps.d.ts

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -926,7 +926,7 @@ interface FindPathOpts {
926926
ignoreCreeps?: boolean;
927927
ignoreDestructibleStructures?: boolean;
928928
ignoreRoads?: boolean;
929-
ignore?: [any | RoomPosition];
929+
ignore?: any[] | RoomPosition[];
930930
avoid?: any[] | RoomPosition[];
931931
maxOps?: number;
932932
heuristicWeight?: number;
@@ -992,10 +992,10 @@ declare class GameMap {
992992
* @param toRoom Finish room name or room object.
993993
* @returns the route array or ERR_NO_PATH code
994994
*/
995-
findRoute(fromRoom: string | Room, toRoom: string | Room): [{
995+
findRoute(fromRoom: string | Room, toRoom: string | Room): {
996996
exit: string;
997997
room: string;
998-
}] | number;
998+
}[] | number;
999999
/**
10001000
* Get the linear distance (in rooms) between two rooms. You can use this function to estimate the energy cost of
10011001
* sending resources through terminals, or using observers and nukes.
@@ -1277,7 +1277,7 @@ declare class RoomPosition {
12771277
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
12781278
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
12791279
*/
1280-
findClosestByPath<T>(objects: [T | RoomPosition], opts?: {
1280+
findClosestByPath<T>(objects: T[] | RoomPosition[], opts?: {
12811281
filter?: any | string;
12821282
algorithm?: string;
12831283
}): T;
@@ -1294,7 +1294,7 @@ declare class RoomPosition {
12941294
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
12951295
* @param opts An object containing one of the following options: filter
12961296
*/
1297-
findClosestByRange<T>(objects: [T | RoomPosition], opts?: {
1297+
findClosestByRange<T>(objects: T[] | RoomPosition[], opts?: {
12981298
filter: any | string;
12991299
}): T;
13001300
/**
@@ -1313,7 +1313,7 @@ declare class RoomPosition {
13131313
* @param range The range distance.
13141314
* @param opts See Room.find.
13151315
*/
1316-
findInRange<T>(objects: [T | RoomPosition], range: number, opts?: {
1316+
findInRange<T>(objects: T[] | RoomPosition[], range: number, opts?: {
13171317
filter?: any | string;
13181318
algorithm?: string;
13191319
}): T[];

src/helpers.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ interface FindPathOpts {
7373
ignoreCreeps?: boolean;
7474
ignoreDestructibleStructures?: boolean;
7575
ignoreRoads?: boolean;
76-
ignore?: [any|RoomPosition];
76+
ignore?: any[]|RoomPosition[];
7777
avoid?: any[]|RoomPosition[];
7878
maxOps?: number;
7979
heuristicWeight?: number;

src/map.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ declare class GameMap {
2525
* @param toRoom Finish room name or room object.
2626
* @returns the route array or ERR_NO_PATH code
2727
*/
28-
findRoute(fromRoom: string|Room, toRoom: string|Room): [{exit: string, room: string}]|number;
28+
findRoute(fromRoom: string|Room, toRoom: string|Room): {exit: string, room: string}[]|number;
2929
/**
3030
* Get the linear distance (in rooms) between two rooms. You can use this function to estimate the energy cost of
3131
* sending resources through terminals, or using observers and nukes.

src/room-position.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ declare class RoomPosition {
4646
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
4747
* @param opts An object containing pathfinding options (see Room.findPath), or one of the following: filter, algorithm
4848
*/
49-
findClosestByPath<T>(objects: [T|RoomPosition], opts?: {filter?: any|string, algorithm?: string}): T;
49+
findClosestByPath<T>(objects: T[]|RoomPosition[], opts?: {filter?: any|string, algorithm?: string}): T;
5050
/**
5151
* Find an object with the shortest linear distance from the given position.
5252
* @param type See Room.find.
@@ -58,7 +58,7 @@ declare class RoomPosition {
5858
* @param objects An array of room's objects or RoomPosition objects that the search should be executed against.
5959
* @param opts An object containing one of the following options: filter
6060
*/
61-
findClosestByRange<T>(objects: [T|RoomPosition], opts?: {filter: any|string }): T;
61+
findClosestByRange<T>(objects: T[]|RoomPosition[], opts?: {filter: any|string }): T;
6262
/**
6363
* Find all objects in the specified linear range.
6464
* @param type See Room.find.
@@ -72,7 +72,7 @@ declare class RoomPosition {
7272
* @param range The range distance.
7373
* @param opts See Room.find.
7474
*/
75-
findInRange<T>(objects: [T|RoomPosition], range: number, opts?: {filter?: any|string, algorithm?: string}): T[];
75+
findInRange<T>(objects: T[]|RoomPosition[], range: number, opts?: {filter?: any|string, algorithm?: string}): T[];
7676
/**
7777
* Find an optimal path to the specified position using A* search algorithm. This method is a shorthand for Room.findPath. If the target is in another room, then the corresponding exit will be used as a target.
7878
* @param x X position in the room.

0 commit comments

Comments
 (0)