isaacscript-common 9.16.0 → 9.17.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.
@@ -1 +1 @@
1
- {"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,CAIN"}
1
+ {"version":3,"file":"postPurchase.d.ts","sourceRoot":"","sources":["../../../src/callbacks/subscriptions/postPurchase.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAE7D,oBAAY,8BAA8B,GAAG;IAC3C,QAAQ,EAAE,CAAC,MAAM,EAAE,YAAY,EAAE,MAAM,EAAE,YAAY,KAAK,IAAI;IAC9D,aAAa,CAAC,EAAE,aAAa;IAC7B,aAAa,CAAC,EAAE,GAAG;CACpB,CAAC;AAIF,wBAAgB,4BAA4B,IAAI,OAAO,CAEtD;AAED,wBAAgB,oBAAoB,CAClC,GAAG,IAAI,EAAE,8BAA8B,GACtC,IAAI,CAEN;AAED,wBAAgB,gBAAgB,CAC9B,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,GACnB,IAAI,CAwBN"}
@@ -10,7 +10,18 @@ end
10
10
  function ____exports.postPurchaseFire(self, player, pickup)
11
11
  for ____, ____value in ipairs(subscriptions) do
12
12
  local callback = ____value[1]
13
- callback(nil, player, pickup)
13
+ local callbackPickupVariant = ____value[2]
14
+ local callbackPickupSubType = ____value[3]
15
+ do
16
+ if callbackPickupVariant ~= nil and callbackPickupVariant ~= pickup.Variant then
17
+ goto __continue5
18
+ end
19
+ if callbackPickupSubType ~= nil and callbackPickupSubType ~= pickup.SubType then
20
+ goto __continue5
21
+ end
22
+ callback(nil, player, pickup)
23
+ end
24
+ ::__continue5::
14
25
  end
15
26
  end
16
27
  return ____exports
@@ -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 of adjacent room grid index, `DoorSlot`, and new room grid index.
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;;;;;GA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AE,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 do not exist (i.e. do not have
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.getAdjacentNonExistingRoomGridIndexes(self, roomGridIndex)
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) == nil end
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 of adjacent room grid index, `DoorSlot`, and new room grid index.
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 adjacentNonExistingRoomGridIndexes = ____exports.getAdjacentNonExistingRoomGridIndexes(nil, roomGridIndex)
218
- return #adjacentNonExistingRoomGridIndexes == 1
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. have room data).
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.getAdjacentExistingRoomGridIndexes(self, roomGridIndex)
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) ~= nil end
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.
@@ -3,6 +3,14 @@
3
3
  import { HealthType } from "../enums/HealthType";
4
4
  import { PlayerHealth } from "../interfaces/PlayerHealth";
5
5
  export declare function addPlayerHealthType(player: EntityPlayer, healthType: HealthType, numHearts: int): void;
6
+ /**
7
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
8
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
9
+ * eternal hearts.)
10
+ *
11
+ * This function's name matches the existing `EntityPlayer` methods.
12
+ */
13
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
6
14
  /**
7
15
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
8
16
  *
@@ -1 +1 @@
1
- {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAK1E;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAKzE;AAED;;;;GAIG;AACH,wBAAgB,4BAA4B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAYtE;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK9D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,YAAY,CA2ElE;AAED,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,GACrB,GAAG,CAmDL;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAKzD;AAED;;;GAGG;AACH,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,UAAU,CAoDnE;AAED;;;;;GAKG;AACH,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAqCrE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,GAAG,CAK7D;AAED;;;;;;;;;GASG;AACH,wBAAgB,wCAAwC,CACtD,MAAM,EAAE,YAAY,GACnB,GAAG,CAML;AAED,sDAAsD;AACtD,wBAAgB,eAAe,IAAI,YAAY,CAc9C;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED,wBAAgB,oCAAoC,CAClD,MAAM,EAAE,YAAY,GACnB,IAAI,CAQN;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAMjE;AAED,wBAAgB,qBAAqB,CAAC,MAAM,EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
1
+ {"version":3,"file":"playerHealth.d.ts","sourceRoot":"","sources":["../../src/functions/playerHealth.ts"],"names":[],"mappings":";;AAQA,OAAO,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAiB,MAAM,4BAA4B,CAAC;AAQzE,wBAAgB,mBAAmB,CACjC,MAAM,EAAE,YAAY,EACpB,UAAU,EAAE,UAAU,EACtB,SAAS,EAAE,GAAG,GACb,IAAI,CA+CN;AAED;;;;;;GAMG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,YA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EAAE,YAAY,GAAG,IAAI,CAwBhE;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAC7B,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,YAAY,GACzB,IAAI,CAsHN;AAED;;;;;;;;;GASG;AACH,wBAAgB,sDAAsD,CACpE,MAAM,EAAE,YAAY,EACpB,YAAY,EAAE,KAAK,GAClB,OAAO,CAyBT"}
@@ -135,25 +135,25 @@ function ____exports.setPlayerHealth(self, player, playerHealth)
135
135
  addAmount = 1
136
136
  end
137
137
  repeat
138
- local ____switch71 = soulHeartType
139
- local ____cond71 = ____switch71 == HeartSubType.SOUL
140
- if ____cond71 then
138
+ local ____switch72 = soulHeartType
139
+ local ____cond72 = ____switch72 == HeartSubType.SOUL
140
+ if ____cond72 then
141
141
  do
142
142
  player:AddSoulHearts(addAmount)
143
143
  soulHeartsRemaining = soulHeartsRemaining - addAmount
144
144
  break
145
145
  end
146
146
  end
147
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BLACK
148
- if ____cond71 then
147
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BLACK
148
+ if ____cond72 then
149
149
  do
150
150
  player:AddBlackHearts(addAmount)
151
151
  soulHeartsRemaining = soulHeartsRemaining - addAmount
152
152
  break
153
153
  end
154
154
  end
155
- ____cond71 = ____cond71 or ____switch71 == HeartSubType.BONE
156
- if ____cond71 then
155
+ ____cond72 = ____cond72 or ____switch72 == HeartSubType.BONE
156
+ if ____cond72 then
157
157
  do
158
158
  player:AddBoneHearts(addAmount)
159
159
  break
@@ -271,6 +271,17 @@ function ____exports.addPlayerHealthType(self, player, healthType, numHearts)
271
271
  end
272
272
  until true
273
273
  end
274
+ --- Helper function to see if the provided player can pick up an eternal heart. (If a player already
275
+ -- has an eternal heart and full heart containers, they are not able to pick up any additional
276
+ -- eternal hearts.)
277
+ --
278
+ -- This function's name matches the existing `EntityPlayer` methods.
279
+ function ____exports.canPickEternalHearts(self, player)
280
+ local eternalHearts = player:GetEternalHearts()
281
+ local maxHearts = player:GetMaxHearts()
282
+ local heartLimit = player:GetHeartLimit()
283
+ return eternalHearts == 0 or maxHearts ~= heartLimit
284
+ end
274
285
  --- Returns whether or not all of the player's soul-heart-type hearts are black hearts.
275
286
  --
276
287
  -- Note that this function does not consider red heart containers.
@@ -385,57 +396,57 @@ function ____exports.getPlayerHealth(self, player)
385
396
  end
386
397
  function ____exports.getPlayerHealthType(self, player, healthType)
387
398
  repeat
388
- local ____switch28 = healthType
389
- local ____cond28 = ____switch28 == HealthType.RED
390
- if ____cond28 then
399
+ local ____switch29 = healthType
400
+ local ____cond29 = ____switch29 == HealthType.RED
401
+ if ____cond29 then
391
402
  do
392
403
  return ____exports.getPlayerHearts(nil, player)
393
404
  end
394
405
  end
395
- ____cond28 = ____cond28 or ____switch28 == HealthType.SOUL
396
- if ____cond28 then
406
+ ____cond29 = ____cond29 or ____switch29 == HealthType.SOUL
407
+ if ____cond29 then
397
408
  do
398
409
  return ____exports.getPlayerSoulHearts(nil, player)
399
410
  end
400
411
  end
401
- ____cond28 = ____cond28 or ____switch28 == HealthType.ETERNAL
402
- if ____cond28 then
412
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ETERNAL
413
+ if ____cond29 then
403
414
  do
404
415
  return player:GetEternalHearts()
405
416
  end
406
417
  end
407
- ____cond28 = ____cond28 or ____switch28 == HealthType.BLACK
408
- if ____cond28 then
418
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BLACK
419
+ if ____cond29 then
409
420
  do
410
421
  return ____exports.getPlayerBlackHearts(nil, player)
411
422
  end
412
423
  end
413
- ____cond28 = ____cond28 or ____switch28 == HealthType.GOLDEN
414
- if ____cond28 then
424
+ ____cond29 = ____cond29 or ____switch29 == HealthType.GOLDEN
425
+ if ____cond29 then
415
426
  do
416
427
  return player:GetGoldenHearts()
417
428
  end
418
429
  end
419
- ____cond28 = ____cond28 or ____switch28 == HealthType.BONE
420
- if ____cond28 then
430
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BONE
431
+ if ____cond29 then
421
432
  do
422
433
  return player:GetBoneHearts()
423
434
  end
424
435
  end
425
- ____cond28 = ____cond28 or ____switch28 == HealthType.ROTTEN
426
- if ____cond28 then
436
+ ____cond29 = ____cond29 or ____switch29 == HealthType.ROTTEN
437
+ if ____cond29 then
427
438
  do
428
439
  return player:GetRottenHearts()
429
440
  end
430
441
  end
431
- ____cond28 = ____cond28 or ____switch28 == HealthType.BROKEN
432
- if ____cond28 then
442
+ ____cond29 = ____cond29 or ____switch29 == HealthType.BROKEN
443
+ if ____cond29 then
433
444
  do
434
445
  return player:GetBrokenHearts()
435
446
  end
436
447
  end
437
- ____cond28 = ____cond28 or ____switch28 == HealthType.MAX_HEARTS
438
- if ____cond28 then
448
+ ____cond29 = ____cond29 or ____switch29 == HealthType.MAX_HEARTS
449
+ if ____cond29 then
439
450
  do
440
451
  return player:GetMaxHearts()
441
452
  end
package/dist/index.d.ts CHANGED
@@ -607,6 +607,15 @@ export declare function calculateStageType(stage: LevelStage): StageType;
607
607
  */
608
608
  export declare function calculateStageTypeRepentance(stage: LevelStage): StageType;
609
609
 
610
+ /**
611
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
612
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
613
+ * eternal hearts.)
614
+ *
615
+ * This function's name matches the existing `EntityPlayer` methods.
616
+ */
617
+ export declare function canPickEternalHearts(player: EntityPlayer): boolean;
618
+
610
619
  /**
611
620
  * Helper function to determine if a player will destroy a rock/pot/skull if they walk over it.
612
621
  *
@@ -3667,7 +3676,8 @@ export declare function getNewRoomCandidate(seedOrRNG?: Seed | RNG): [adjacentRo
3667
3676
 
3668
3677
  /**
3669
3678
  * 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.
3679
+ * a valid spot to insert a brand new room on the floor. (Any potential new rooms cannot be
3680
+ * connected to any other existing rooms on the floor.)
3671
3681
  *
3672
3682
  * @param roomGridIndex Optional. Default is the current room index.
3673
3683
  * @returns A array of tuples of `DoorSlot` and room grid index.
@@ -3678,7 +3688,8 @@ export declare function getNewRoomCandidatesBesideRoom(roomGridIndex?: int): Arr
3678
3688
  * Helper function to search through all of the rooms on the floor for a spot to insert a brand new
3679
3689
  * room.
3680
3690
  *
3681
- * @returns A array of tuples of adjacent room grid index, `DoorSlot`, and new room grid index.
3691
+ * @returns A array of tuples containing the adjacent room grid index, the `DoorSlot`, and the new
3692
+ * room grid index.
3682
3693
  */
3683
3694
  export declare function getNewRoomCandidatesForLevel(): Array<[
3684
3695
  adjacentRoomGridIndex: int,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "9.16.0",
3
+ "version": "9.17.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,7 +22,27 @@ export function postPurchaseFire(
22
22
  player: EntityPlayer,
23
23
  pickup: EntityPickup,
24
24
  ): void {
25
- for (const [callback] of subscriptions) {
25
+ for (const [
26
+ callback,
27
+ callbackPickupVariant,
28
+ callbackPickupSubType,
29
+ ] of subscriptions) {
30
+ // Handle the optional 2nd callback argument.
31
+ if (
32
+ callbackPickupVariant !== undefined &&
33
+ callbackPickupVariant !== pickup.Variant
34
+ ) {
35
+ continue;
36
+ }
37
+
38
+ // Handle the optional 3rd callback argument.
39
+ if (
40
+ callbackPickupSubType !== undefined &&
41
+ callbackPickupSubType !== pickup.SubType
42
+ ) {
43
+ continue;
44
+ }
45
+
26
46
  callback(player, pickup);
27
47
  }
28
48
  }
@@ -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 of adjacent room grid index, `DoorSlot`, and new room grid index.
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 adjacentNonExistingRoomGridIndexes =
389
- getAdjacentNonExistingRoomGridIndexes(roomGridIndex);
399
+ const adjacentExistingRoomGridIndexes =
400
+ getAdjacentExistingRoomGridIndexes(roomGridIndex);
390
401
 
391
- return adjacentNonExistingRoomGridIndexes.length === 1;
402
+ return adjacentExistingRoomGridIndexes.length === 1;
392
403
  }
393
404
 
394
405
  export function isDoorSlotValidAtGridIndex(
@@ -68,6 +68,21 @@ export function addPlayerHealthType(
68
68
  }
69
69
  }
70
70
 
71
+ /**
72
+ * Helper function to see if the provided player can pick up an eternal heart. (If a player already
73
+ * has an eternal heart and full heart containers, they are not able to pick up any additional
74
+ * eternal hearts.)
75
+ *
76
+ * This function's name matches the existing `EntityPlayer` methods.
77
+ */
78
+ export function canPickEternalHearts(player: EntityPlayer): boolean {
79
+ const eternalHearts = player.GetEternalHearts();
80
+ const maxHearts = player.GetMaxHearts();
81
+ const heartLimit = player.GetHeartLimit();
82
+
83
+ return eternalHearts === 0 || maxHearts !== heartLimit;
84
+ }
85
+
71
86
  /**
72
87
  * Returns whether or not all of the player's soul-heart-type hearts are black hearts.
73
88
  *