isaacscript-common 16.1.0 → 16.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +6 -6
- package/dist/isaacscript-common.lua +12 -5
- package/dist/src/classes/features/other/extraConsoleCommands/subroutines.lua +0 -1
- package/dist/src/functions/levelGrid.d.ts +5 -5
- package/dist/src/functions/levelGrid.d.ts.map +1 -1
- package/dist/src/functions/levelGrid.lua +11 -3
- package/dist/src/functions/map.d.ts +1 -1
- package/dist/src/functions/map.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/functions/levelGrid.ts +10 -11
- package/src/functions/map.ts +3 -1
package/dist/index.d.ts
CHANGED
|
@@ -1422,7 +1422,7 @@ export declare function copyIsaacAPIClass<T extends CopyableIsaacAPIClass>(isaac
|
|
|
1422
1422
|
export declare function copyKColor(kColor: KColor): KColor;
|
|
1423
1423
|
|
|
1424
1424
|
/** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
|
|
1425
|
-
export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
1425
|
+
export declare function copyMap<K, V>(oldMap: Map<K, V> | ReadonlyMap<K, V>): Map<K, V>;
|
|
1426
1426
|
|
|
1427
1427
|
/** Helper function to copy an `RNG` Isaac API class. */
|
|
1428
1428
|
export declare function copyRNG(rng: RNG): RNG;
|
|
@@ -5843,7 +5843,7 @@ export declare function getRocks(variant?: number): GridEntityRock[];
|
|
|
5843
5843
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
5844
5844
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
5845
5845
|
*/
|
|
5846
|
-
export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int):
|
|
5846
|
+
export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int): ReadonlyMap<DoorSlot, int>;
|
|
5847
5847
|
|
|
5848
5848
|
/**
|
|
5849
5849
|
* Helper function to get the set of allowed door slots for the room at the supplied grid index.
|
|
@@ -5987,7 +5987,7 @@ export declare function getRoomShape(roomGridIndex?: int): RoomShape | undefined
|
|
|
5987
5987
|
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
5988
5988
|
* that function for more information.
|
|
5989
5989
|
*/
|
|
5990
|
-
export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
5990
|
+
export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
5991
5991
|
|
|
5992
5992
|
/**
|
|
5993
5993
|
* Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
@@ -5997,7 +5997,7 @@ export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridInde
|
|
|
5997
5997
|
*
|
|
5998
5998
|
* @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
5999
5999
|
*/
|
|
6000
|
-
export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape):
|
|
6000
|
+
export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
6001
6001
|
|
|
6002
6002
|
/**
|
|
6003
6003
|
* Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
@@ -6008,7 +6008,7 @@ export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape
|
|
|
6008
6008
|
* @param roomShape The shape of the room.
|
|
6009
6009
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
6010
6010
|
*/
|
|
6011
|
-
export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
6011
|
+
export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
6012
6012
|
|
|
6013
6013
|
/**
|
|
6014
6014
|
* Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
@@ -6017,7 +6017,7 @@ export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int,
|
|
|
6017
6017
|
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
6018
6018
|
* that function for more information.
|
|
6019
6019
|
*/
|
|
6020
|
-
export declare function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
6020
|
+
export declare function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
6021
6021
|
|
|
6022
6022
|
/**
|
|
6023
6023
|
* Helper function to see if a given room shape will grant a single charge or a double charge to the
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
--[[
|
|
2
2
|
|
|
3
|
-
isaacscript-common 16.1.
|
|
3
|
+
isaacscript-common 16.1.1
|
|
4
4
|
|
|
5
5
|
This is the "isaacscript-common" library, which was created with the IsaacScript tool.
|
|
6
6
|
|
|
@@ -42885,8 +42885,8 @@ return ____exports
|
|
|
42885
42885
|
local ____lualib = require("lualib_bundle")
|
|
42886
42886
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
42887
42887
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
42888
|
-
local Map = ____lualib.Map
|
|
42889
42888
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
42889
|
+
local Map = ____lualib.Map
|
|
42890
42890
|
local __TS__New = ____lualib.__TS__New
|
|
42891
42891
|
local Set = ____lualib.Set
|
|
42892
42892
|
local ____exports = {}
|
|
@@ -42914,6 +42914,8 @@ local ____flag = require("src.functions.flag")
|
|
|
42914
42914
|
local addFlag = ____flag.addFlag
|
|
42915
42915
|
local hasFlag = ____flag.hasFlag
|
|
42916
42916
|
local removeFlag = ____flag.removeFlag
|
|
42917
|
+
local ____map = require("src.functions.map")
|
|
42918
|
+
local copyMap = ____map.copyMap
|
|
42917
42919
|
local ____rng = require("src.functions.rng")
|
|
42918
42920
|
local getRandomSeed = ____rng.getRandomSeed
|
|
42919
42921
|
local isRNG = ____rng.isRNG
|
|
@@ -42998,7 +43000,10 @@ function ____exports.getNewRoomCandidatesForLevel(self)
|
|
|
42998
43000
|
return newRoomCandidates
|
|
42999
43001
|
end
|
|
43000
43002
|
function ____exports.getRoomShapeAdjacentExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
43001
|
-
local roomShapeAdjacentGridIndexes =
|
|
43003
|
+
local roomShapeAdjacentGridIndexes = copyMap(
|
|
43004
|
+
nil,
|
|
43005
|
+
____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
43006
|
+
)
|
|
43002
43007
|
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
43003
43008
|
local doorSlot = ____value[1]
|
|
43004
43009
|
local roomGridIndex = ____value[2]
|
|
@@ -43026,7 +43031,10 @@ function ____exports.getRoomShapeAdjacentGridIndexes(self, safeRoomGridIndex, ro
|
|
|
43026
43031
|
return adjacentGridIndexes
|
|
43027
43032
|
end
|
|
43028
43033
|
function ____exports.getRoomShapeAdjacentNonExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
43029
|
-
local roomShapeAdjacentGridIndexes =
|
|
43034
|
+
local roomShapeAdjacentGridIndexes = copyMap(
|
|
43035
|
+
nil,
|
|
43036
|
+
____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
43037
|
+
)
|
|
43030
43038
|
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
43031
43039
|
local doorSlot = ____value[1]
|
|
43032
43040
|
local roomGridIndex = ____value[2]
|
|
@@ -44689,7 +44697,6 @@ return ____exports
|
|
|
44689
44697
|
end,
|
|
44690
44698
|
["src.classes.features.other.extraConsoleCommands.subroutines"] = function(...)
|
|
44691
44699
|
local ____lualib = require("lualib_bundle")
|
|
44692
|
-
local Map = ____lualib.Map
|
|
44693
44700
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
44694
44701
|
local ____exports = {}
|
|
44695
44702
|
local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
|
|
@@ -82,7 +82,7 @@ export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
|
82
82
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
83
83
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
84
84
|
*/
|
|
85
|
-
export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int):
|
|
85
|
+
export declare function getRoomAdjacentGridIndexes(roomGridIndex?: int): ReadonlyMap<DoorSlot, int>;
|
|
86
86
|
/**
|
|
87
87
|
* Helper function to get an array of all of the safe grid indexes for rooms that match the
|
|
88
88
|
* specified room type.
|
|
@@ -100,7 +100,7 @@ export declare function getRoomGridIndexesForType(...roomTypes: RoomType[]): int
|
|
|
100
100
|
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
101
101
|
* that function for more information.
|
|
102
102
|
*/
|
|
103
|
-
export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
103
|
+
export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
104
104
|
/**
|
|
105
105
|
* Helper function to get the room grid index delta that each hypothetical door in a given room
|
|
106
106
|
* shape would go to.
|
|
@@ -109,7 +109,7 @@ export declare function getRoomShapeAdjacentExistingGridIndexes(safeRoomGridInde
|
|
|
109
109
|
*
|
|
110
110
|
* @returns A map of `DoorSlot` to the corresponding room grid index delta.
|
|
111
111
|
*/
|
|
112
|
-
export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape):
|
|
112
|
+
export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
113
113
|
/**
|
|
114
114
|
* Helper function to get the room grid index that each hypothetical door in a given room shape
|
|
115
115
|
* would go to. (This will not include room grid indexes that are outside of the grid.)
|
|
@@ -119,7 +119,7 @@ export declare function getRoomShapeAdjacentGridIndexDeltas(roomShape: RoomShape
|
|
|
119
119
|
* @param roomShape The shape of the room.
|
|
120
120
|
* @returns A map of `DoorSlot` to the corresponding room grid index.
|
|
121
121
|
*/
|
|
122
|
-
export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
122
|
+
export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
123
123
|
/**
|
|
124
124
|
* Helper function to get only the adjacent room grid indexes for a room shape that do not exist
|
|
125
125
|
* (i.e. do not have room data).
|
|
@@ -127,7 +127,7 @@ export declare function getRoomShapeAdjacentGridIndexes(safeRoomGridIndex: int,
|
|
|
127
127
|
* This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
128
128
|
* that function for more information.
|
|
129
129
|
*/
|
|
130
|
-
export declare function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape):
|
|
130
|
+
export declare function getRoomShapeAdjacentNonExistingGridIndexes(safeRoomGridIndex: int, roomShape: RoomShape): ReadonlyMap<DoorSlot, int>;
|
|
131
131
|
/**
|
|
132
132
|
* Helper function to check if the given room grid index is a dead end. Specifically, this is
|
|
133
133
|
* defined as having only one adjacent room that exists.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EAEL,QAAQ,EAKR,SAAS,EACT,QAAQ,EACT,MAAM,8BAA8B,CAAC;
|
|
1
|
+
{"version":3,"file":"levelGrid.d.ts","sourceRoot":"","sources":["../../../src/functions/levelGrid.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAEH,OAAO,EA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
@@ -1,8 +1,8 @@
|
|
|
1
1
|
local ____lualib = require("lualib_bundle")
|
|
2
2
|
local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
|
|
3
3
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
4
|
-
local Map = ____lualib.Map
|
|
5
4
|
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
5
|
+
local Map = ____lualib.Map
|
|
6
6
|
local __TS__New = ____lualib.__TS__New
|
|
7
7
|
local Set = ____lualib.Set
|
|
8
8
|
local ____exports = {}
|
|
@@ -30,6 +30,8 @@ local ____flag = require("src.functions.flag")
|
|
|
30
30
|
local addFlag = ____flag.addFlag
|
|
31
31
|
local hasFlag = ____flag.hasFlag
|
|
32
32
|
local removeFlag = ____flag.removeFlag
|
|
33
|
+
local ____map = require("src.functions.map")
|
|
34
|
+
local copyMap = ____map.copyMap
|
|
33
35
|
local ____rng = require("src.functions.rng")
|
|
34
36
|
local getRandomSeed = ____rng.getRandomSeed
|
|
35
37
|
local isRNG = ____rng.isRNG
|
|
@@ -147,7 +149,10 @@ end
|
|
|
147
149
|
-- This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
148
150
|
-- that function for more information.
|
|
149
151
|
function ____exports.getRoomShapeAdjacentExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
150
|
-
local roomShapeAdjacentGridIndexes =
|
|
152
|
+
local roomShapeAdjacentGridIndexes = copyMap(
|
|
153
|
+
nil,
|
|
154
|
+
____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
155
|
+
)
|
|
151
156
|
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
152
157
|
local doorSlot = ____value[1]
|
|
153
158
|
local roomGridIndex = ____value[2]
|
|
@@ -193,7 +198,10 @@ end
|
|
|
193
198
|
-- This is just a filtering of the results of the `getRoomShapeAdjacentGridIndexes` function. See
|
|
194
199
|
-- that function for more information.
|
|
195
200
|
function ____exports.getRoomShapeAdjacentNonExistingGridIndexes(self, safeRoomGridIndex, roomShape)
|
|
196
|
-
local roomShapeAdjacentGridIndexes =
|
|
201
|
+
local roomShapeAdjacentGridIndexes = copyMap(
|
|
202
|
+
nil,
|
|
203
|
+
____exports.getRoomShapeAdjacentGridIndexes(nil, safeRoomGridIndex, roomShape)
|
|
204
|
+
)
|
|
197
205
|
for ____, ____value in __TS__Iterator(roomShapeAdjacentGridIndexes:entries()) do
|
|
198
206
|
local doorSlot = ____value[1]
|
|
199
207
|
local roomGridIndex = ____value[2]
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
/// <reference types="isaac-typescript-definitions" />
|
|
3
3
|
import { DefaultMap } from "../classes/DefaultMap";
|
|
4
4
|
/** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
|
|
5
|
-
export declare function copyMap<K, V>(oldMap: Map<K, V>): Map<K, V>;
|
|
5
|
+
export declare function copyMap<K, V>(oldMap: Map<K, V> | ReadonlyMap<K, V>): Map<K, V>;
|
|
6
6
|
/**
|
|
7
7
|
* Helper function to get the value from a `DefaultMap` that corresponds to an entity, assuming that
|
|
8
8
|
* the map uses `PtrHash` as an index.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/functions/map.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,
|
|
1
|
+
{"version":3,"file":"map.d.ts","sourceRoot":"","sources":["../../../src/functions/map.ts"],"names":[],"mappings":";;AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,uBAAuB,CAAC;AAInD,mGAAmG;AACnG,wBAAgB,OAAO,CAAC,CAAC,EAAE,CAAC,EAC1B,MAAM,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,GAAG,WAAW,CAAC,CAAC,EAAE,CAAC,CAAC,GACpC,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,CAOX;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EAAE,CAAC,SAAS,OAAO,EAAE,EACtD,GAAG,EAAE,UAAU,CAAC,OAAO,EAAE,CAAC,EAAE,CAAC,CAAC,EAC9B,MAAM,EAAE,MAAM,EACd,GAAG,SAAS,EAAE,CAAC,GACd,CAAC,CAGH;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAAC,CAAC,EACjC,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAEN;AAED;;;;;;;;;;;;;;;;;;GAkBG;AACH,wBAAgB,kBAAkB,CAAC,CAAC,EAClC,UAAU,EAAE,MAAM,EAClB,GAAG,EAAE,WAAW,CAAC,MAAM,EAAE,CAAC,CAAC,GAC1B,CAAC,MAAM,EAAE,CAAC,CAAC,GAAG,SAAS,CAgBzB;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,CAAC,EAC1B,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC,EACpB,MAAM,EAAE,MAAM,EACd,KAAK,EAAE,CAAC,GACP,IAAI,CAGN;AAED,4DAA4D;AAC5D,wBAAgB,MAAM,CACpB,GAAG,EAAE,GAAG,CAAC,OAAO,EAAE,MAAM,CAAC,GAAG,WAAW,CAAC,OAAO,EAAE,MAAM,CAAC,GACvD,MAAM,CAGR"}
|
package/package.json
CHANGED
|
@@ -27,6 +27,7 @@ import { ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA } from "../objects/roomSha
|
|
|
27
27
|
import { getRandomArrayElement } from "./array";
|
|
28
28
|
import { doorSlotToDoorSlotFlag } from "./doors";
|
|
29
29
|
import { addFlag, hasFlag, removeFlag } from "./flag";
|
|
30
|
+
import { copyMap } from "./map";
|
|
30
31
|
import { getRandomSeed, isRNG, newRNG } from "./rng";
|
|
31
32
|
import {
|
|
32
33
|
getRoomAllowedDoors,
|
|
@@ -244,7 +245,7 @@ export function getNewRoomCandidatesForLevel(): Array<
|
|
|
244
245
|
*/
|
|
245
246
|
export function getRoomAdjacentGridIndexes(
|
|
246
247
|
roomGridIndex?: int,
|
|
247
|
-
):
|
|
248
|
+
): ReadonlyMap<DoorSlot, int> {
|
|
248
249
|
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
249
250
|
|
|
250
251
|
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
@@ -294,10 +295,9 @@ export function getRoomGridIndexesForType(...roomTypes: RoomType[]): int[] {
|
|
|
294
295
|
export function getRoomShapeAdjacentExistingGridIndexes(
|
|
295
296
|
safeRoomGridIndex: int,
|
|
296
297
|
roomShape: RoomShape,
|
|
297
|
-
):
|
|
298
|
-
const roomShapeAdjacentGridIndexes =
|
|
299
|
-
safeRoomGridIndex,
|
|
300
|
-
roomShape,
|
|
298
|
+
): ReadonlyMap<DoorSlot, int> {
|
|
299
|
+
const roomShapeAdjacentGridIndexes = copyMap(
|
|
300
|
+
getRoomShapeAdjacentGridIndexes(safeRoomGridIndex, roomShape),
|
|
301
301
|
);
|
|
302
302
|
|
|
303
303
|
for (const [
|
|
@@ -323,7 +323,7 @@ export function getRoomShapeAdjacentExistingGridIndexes(
|
|
|
323
323
|
*/
|
|
324
324
|
export function getRoomShapeAdjacentGridIndexDeltas(
|
|
325
325
|
roomShape: RoomShape,
|
|
326
|
-
):
|
|
326
|
+
): ReadonlyMap<DoorSlot, int> {
|
|
327
327
|
return ROOM_SHAPE_TO_DOOR_SLOTS_TO_GRID_INDEX_DELTA[roomShape];
|
|
328
328
|
}
|
|
329
329
|
|
|
@@ -339,7 +339,7 @@ export function getRoomShapeAdjacentGridIndexDeltas(
|
|
|
339
339
|
export function getRoomShapeAdjacentGridIndexes(
|
|
340
340
|
safeRoomGridIndex: int,
|
|
341
341
|
roomShape: RoomShape,
|
|
342
|
-
):
|
|
342
|
+
): ReadonlyMap<DoorSlot, int> {
|
|
343
343
|
const roomShapeAdjacentGridIndexDeltas =
|
|
344
344
|
getRoomShapeAdjacentGridIndexDeltas(roomShape);
|
|
345
345
|
|
|
@@ -364,10 +364,9 @@ export function getRoomShapeAdjacentGridIndexes(
|
|
|
364
364
|
export function getRoomShapeAdjacentNonExistingGridIndexes(
|
|
365
365
|
safeRoomGridIndex: int,
|
|
366
366
|
roomShape: RoomShape,
|
|
367
|
-
):
|
|
368
|
-
const roomShapeAdjacentGridIndexes =
|
|
369
|
-
safeRoomGridIndex,
|
|
370
|
-
roomShape,
|
|
367
|
+
): ReadonlyMap<DoorSlot, int> {
|
|
368
|
+
const roomShapeAdjacentGridIndexes = copyMap(
|
|
369
|
+
getRoomShapeAdjacentGridIndexes(safeRoomGridIndex, roomShape),
|
|
371
370
|
);
|
|
372
371
|
|
|
373
372
|
for (const [
|
package/src/functions/map.ts
CHANGED
|
@@ -3,7 +3,9 @@ import { sumArray } from "./array";
|
|
|
3
3
|
import { getPartialMatch } from "./string";
|
|
4
4
|
|
|
5
5
|
/** Helper function to copy a map. (You can also use a Map constructor to accomplish this task.) */
|
|
6
|
-
export function copyMap<K, V>(
|
|
6
|
+
export function copyMap<K, V>(
|
|
7
|
+
oldMap: Map<K, V> | ReadonlyMap<K, V>,
|
|
8
|
+
): Map<K, V> {
|
|
7
9
|
const newMap = new Map<K, V>();
|
|
8
10
|
for (const [key, value] of oldMap.entries()) {
|
|
9
11
|
newMap.set(key, value);
|