isaacscript-common 9.16.0 → 9.16.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.
|
@@ -53,7 +53,8 @@ export declare function getAllRoomGridIndexes(): int[];
|
|
|
53
53
|
export declare function getNewRoomCandidate(seedOrRNG?: Seed | RNG): [adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int] | undefined;
|
|
54
54
|
/**
|
|
55
55
|
* Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
56
|
-
* a valid spot to insert a brand new room on the floor.
|
|
56
|
+
* a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
|
|
57
|
+
* connected to any other existing rooms on the floor.)
|
|
57
58
|
*
|
|
58
59
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
59
60
|
* @returns A array of tuples of `DoorSlot` and room grid index.
|
|
@@ -63,7 +64,8 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
|
|
|
63
64
|
* Helper function to search through all of the rooms on the floor for a spot to insert a brand new
|
|
64
65
|
* room.
|
|
65
66
|
*
|
|
66
|
-
* @returns A array of tuples
|
|
67
|
+
* @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
|
|
68
|
+
* room grid index.
|
|
67
69
|
*/
|
|
68
70
|
export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
69
71
|
adjacentRoomGridIndex: int,
|
|
@@ -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;AA8BtC;;;;;GAKG;AACH,wBAAgB,kCAAkC,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,EAAE,CAK7E;AAED;;;;;;GAMG;AACH,wBAAgB,qCAAqC,CACnD,a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jB,OAAO,CAqBT;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAGzD;AAED;;;;;;GAMG;AACH,wBAAgB,gBAAgB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,OAAO,CAM7D;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,OAAO,CAAC,SAAS,CAAC,EAAE,IAAI,GAAG,GAAG,GAAG,GAAG,GAAG,SAAS,CAmD/D;AAED;;;GAGG;AACH,wBAAgB,UAAU,CAAC,aAAa,EAAE,GAAG,GAAG,OAAO,CAGtD;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,CAAC,EAAE,GAAG,CAAC,CAKtE"}
|
|
@@ -47,16 +47,15 @@ local ____roomShape = require("functions.roomShape")
|
|
|
47
47
|
local getGridIndexDelta = ____roomShape.getGridIndexDelta
|
|
48
48
|
local ____types = require("functions.types")
|
|
49
49
|
local asNumber = ____types.asNumber
|
|
50
|
-
--- Helper function to get only the adjacent room grid indexes that
|
|
51
|
-
-- room data).
|
|
50
|
+
--- Helper function to get only the adjacent room grid indexes that exist (i.e. have room data).
|
|
52
51
|
--
|
|
53
52
|
-- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
54
53
|
-- that function for more information.
|
|
55
|
-
function ____exports.
|
|
54
|
+
function ____exports.getAdjacentExistingRoomGridIndexes(self, roomGridIndex)
|
|
56
55
|
local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
|
|
57
56
|
return __TS__ArrayFilter(
|
|
58
57
|
adjacentRoomGridIndexes,
|
|
59
|
-
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex)
|
|
58
|
+
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) ~= nil end
|
|
60
59
|
)
|
|
61
60
|
end
|
|
62
61
|
--- Helper function to get all of the room grid indexes that are adjacent to a given room grid index
|
|
@@ -87,7 +86,8 @@ function ____exports.getAdjacentRoomGridIndexes(self, roomGridIndex)
|
|
|
87
86
|
)
|
|
88
87
|
end
|
|
89
88
|
--- Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
90
|
-
-- a valid spot to insert a brand new room on the floor.
|
|
89
|
+
-- a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
|
|
90
|
+
-- connected to any other existing rooms on the floor.)
|
|
91
91
|
--
|
|
92
92
|
-- @param roomGridIndex Optional. Default is the current room index.
|
|
93
93
|
-- @returns A array of tuples of `DoorSlot` and room grid index.
|
|
@@ -122,7 +122,8 @@ end
|
|
|
122
122
|
--- Helper function to search through all of the rooms on the floor for a spot to insert a brand new
|
|
123
123
|
-- room.
|
|
124
124
|
--
|
|
125
|
-
-- @returns A array of tuples
|
|
125
|
+
-- @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
|
|
126
|
+
-- room grid index.
|
|
126
127
|
function ____exports.getNewRoomCandidatesForLevel(self)
|
|
127
128
|
local rooms = getRoomsInsideGrid(nil)
|
|
128
129
|
local normalRooms = __TS__ArrayFilter(
|
|
@@ -214,8 +215,8 @@ end
|
|
|
214
215
|
--
|
|
215
216
|
-- @param roomGridIndex Optional. Default is the current room index.
|
|
216
217
|
function ____exports.isDeadEnd(self, roomGridIndex)
|
|
217
|
-
local
|
|
218
|
-
return #
|
|
218
|
+
local adjacentExistingRoomGridIndexes = ____exports.getAdjacentExistingRoomGridIndexes(nil, roomGridIndex)
|
|
219
|
+
return #adjacentExistingRoomGridIndexes == 1
|
|
219
220
|
end
|
|
220
221
|
--- Helper function to determine if a given room grid index is inside of the normal 13x13 level grid.
|
|
221
222
|
--
|
|
@@ -239,15 +240,16 @@ local UP = -LEVEL_GRID_ROW_WIDTH
|
|
|
239
240
|
local RIGHT = 1
|
|
240
241
|
local DOWN = LEVEL_GRID_ROW_WIDTH
|
|
241
242
|
ADJACENT_ROOM_GRID_INDEX_DELTAS = {LEFT, UP, RIGHT, DOWN}
|
|
242
|
-
--- Helper function to get only the adjacent room grid indexes that exist (i.e.
|
|
243
|
+
--- Helper function to get only the adjacent room grid indexes that do not exist (i.e. do not have
|
|
244
|
+
-- room data).
|
|
243
245
|
--
|
|
244
246
|
-- This is just a filtering of the results of the `getAdjacentExistingRoomGridIndexes` function. See
|
|
245
247
|
-- that function for more information.
|
|
246
|
-
function ____exports.
|
|
248
|
+
function ____exports.getAdjacentNonExistingRoomGridIndexes(self, roomGridIndex)
|
|
247
249
|
local adjacentRoomGridIndexes = ____exports.getAdjacentRoomGridIndexes(nil, roomGridIndex)
|
|
248
250
|
return __TS__ArrayFilter(
|
|
249
251
|
adjacentRoomGridIndexes,
|
|
250
|
-
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex)
|
|
252
|
+
function(____, adjacentRoomGridIndex) return getRoomData(nil, adjacentRoomGridIndex) == nil end
|
|
251
253
|
)
|
|
252
254
|
end
|
|
253
255
|
--- Helper function to get the room safe grid index for every room on the entire floor.
|
package/dist/index.d.ts
CHANGED
|
@@ -3667,7 +3667,8 @@ export declare function getNewRoomCandidate(seedOrRNG?: Seed | RNG): [adjacentRo
|
|
|
3667
3667
|
|
|
3668
3668
|
/**
|
|
3669
3669
|
* Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
3670
|
-
* a valid spot to insert a brand new room on the floor.
|
|
3670
|
+
* a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
|
|
3671
|
+
* connected to any other existing rooms on the floor.)
|
|
3671
3672
|
*
|
|
3672
3673
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
3673
3674
|
* @returns A array of tuples of `DoorSlot` and room grid index.
|
|
@@ -3678,7 +3679,8 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
|
|
|
3678
3679
|
* Helper function to search through all of the rooms on the floor for a spot to insert a brand new
|
|
3679
3680
|
* room.
|
|
3680
3681
|
*
|
|
3681
|
-
* @returns A array of tuples
|
|
3682
|
+
* @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
|
|
3683
|
+
* room grid index.
|
|
3682
3684
|
*/
|
|
3683
3685
|
export declare function getNewRoomCandidatesForLevel(): Array<[
|
|
3684
3686
|
adjacentRoomGridIndex: int,
|
package/package.json
CHANGED
|
@@ -138,7 +138,8 @@ export function getNewRoomCandidate(
|
|
|
138
138
|
|
|
139
139
|
/**
|
|
140
140
|
* Helper function to iterate through the possible doors for a room and see if any of them would be
|
|
141
|
-
* a valid spot to insert a brand new room on the floor.
|
|
141
|
+
* a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
|
|
142
|
+
* connected to any other existing rooms on the floor.)
|
|
142
143
|
*
|
|
143
144
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
144
145
|
* @returns A array of tuples of `DoorSlot` and room grid index.
|
|
@@ -148,10 +149,14 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
148
149
|
): Array<[doorSlot: DoorSlot, roomGridIndex: int]> {
|
|
149
150
|
const roomDescriptor = getRoomDescriptor(roomGridIndex);
|
|
150
151
|
|
|
152
|
+
// First, handle the case of rooms outside of the grid, which obviously cannot have any possible
|
|
153
|
+
// adjacent new room candidates.
|
|
151
154
|
if (!isRoomInsideGrid(roomDescriptor.SafeGridIndex)) {
|
|
152
155
|
return [];
|
|
153
156
|
}
|
|
154
157
|
|
|
158
|
+
// Rooms without data are non-existent, so they obviously cannot have any possible adjacent new
|
|
159
|
+
// room candidates.
|
|
155
160
|
const roomData = roomDescriptor.Data;
|
|
156
161
|
if (roomData === undefined) {
|
|
157
162
|
return [];
|
|
@@ -193,16 +198,22 @@ export function getNewRoomCandidatesBesideRoom(
|
|
|
193
198
|
* Helper function to search through all of the rooms on the floor for a spot to insert a brand new
|
|
194
199
|
* room.
|
|
195
200
|
*
|
|
196
|
-
* @returns A array of tuples
|
|
201
|
+
* @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
|
|
202
|
+
* room grid index.
|
|
197
203
|
*/
|
|
198
204
|
export function getNewRoomCandidatesForLevel(): Array<
|
|
199
205
|
[adjacentRoomGridIndex: int, doorSlot: DoorSlot, newRoomGridIndex: int]
|
|
200
206
|
> {
|
|
207
|
+
// We want to iterate over every room on the floor and search for potential new room spots.
|
|
201
208
|
const rooms = getRoomsInsideGrid();
|
|
209
|
+
|
|
210
|
+
// However, we want to filter out special rooms because they are supposed to be dead ends.
|
|
202
211
|
const normalRooms = rooms.filter(
|
|
203
212
|
(room) =>
|
|
204
213
|
room.Data !== undefined &&
|
|
205
214
|
room.Data.Type === RoomType.DEFAULT &&
|
|
215
|
+
// The mirror room and the mineshaft entrance count as normal rooms, but those are supposed to
|
|
216
|
+
// be dead ends as well.
|
|
206
217
|
room.Data.Subtype !== asNumber(DownpourRoomSubType.MIRROR) &&
|
|
207
218
|
room.Data.Subtype !== asNumber(MinesRoomSubType.MINESHAFT_ENTRANCE),
|
|
208
219
|
);
|
|
@@ -385,10 +396,10 @@ export function getRoomShapeAdjacentNonExistingGridIndexes(
|
|
|
385
396
|
* @param roomGridIndex Optional. Default is the current room index.
|
|
386
397
|
*/
|
|
387
398
|
export function isDeadEnd(roomGridIndex?: int): boolean {
|
|
388
|
-
const
|
|
389
|
-
|
|
399
|
+
const adjacentExistingRoomGridIndexes =
|
|
400
|
+
getAdjacentExistingRoomGridIndexes(roomGridIndex);
|
|
390
401
|
|
|
391
|
-
return
|
|
402
|
+
return adjacentExistingRoomGridIndexes.length === 1;
|
|
392
403
|
}
|
|
393
404
|
|
|
394
405
|
export function isDoorSlotValidAtGridIndex(
|