diff --git a/dist/index.d.ts b/dist/index.d.ts index 359e968..b69ffcc 100644 --- a/dist/index.d.ts +++ b/dist/index.d.ts @@ -1825,9 +1825,9 @@ interface LookAtResultMatrix { }; } -interface LookForAtAreaResultMatrix { +interface LookForAtAreaResultMatrix { [y: number]: { - [x: number]: Array>; + [x: number]: T[]; }; } @@ -4546,7 +4546,7 @@ interface Room { bottom: number, right: number, asArray?: false, - ): LookForAtAreaResultMatrix; + ): LookForAtAreaResultMatrix; /** * Get the given objets in the supplied area. * @param type One of the LOOK_* constants diff --git a/dist/screeps-tests.ts b/dist/screeps-tests.ts index 15b1a81..dda67c7 100644 --- a/dist/screeps-tests.ts +++ b/dist/screeps-tests.ts @@ -908,13 +908,23 @@ function resources(o: GenericStore): ResourceConstant[] { const x = flags[10]; const y = x[11]; const entry = y[0]; - entry.flag.remove(); + entry.remove(); const creeps = room.lookForAtArea(LOOK_CREEPS, 10, 10, 20, 20, true); creeps[0].x; creeps[0].y; creeps[0].creep.move(TOP); + + // #252 + const structuresMatrix = room.lookForAtArea(LOOK_STRUCTURES, 10, 10, 20, 20); + + structuresMatrix[15][15].find((s) => s.structureType === STRUCTURE_CONTROLLER); + + // #252 with explicit isArray=false + const structuresMatrix2 = room.lookForAtArea(LOOK_STRUCTURES, 10, 10, 20, 20, false); + + structuresMatrix2[15][15].find((s) => s.structureType === STRUCTURE_CONTROLLER); } // StoreDefinition diff --git a/src/helpers.ts b/src/helpers.ts index 5461fda..78d5faa 100644 --- a/src/helpers.ts +++ b/src/helpers.ts @@ -226,9 +226,9 @@ interface LookAtResultMatrix { }; } -interface LookForAtAreaResultMatrix { +interface LookForAtAreaResultMatrix { [y: number]: { - [x: number]: Array>; + [x: number]: T[]; }; } diff --git a/src/room.ts b/src/room.ts index 1d88878..13a6871 100644 --- a/src/room.ts +++ b/src/room.ts @@ -247,7 +247,7 @@ interface Room { bottom: number, right: number, asArray?: false, - ): LookForAtAreaResultMatrix; + ): LookForAtAreaResultMatrix; /** * Get the given objets in the supplied area. * @param type One of the LOOK_* constants