isaacscript-common 33.9.3 → 33.11.0

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.
@@ -6670,13 +6670,12 @@ export declare function getRoomDescriptorsForType(...roomTypes: RoomType[]): Roo
6670
6670
  export declare function getRoomDisplayFlags(roomGridIndex?: int, minimapAPI?: boolean): BitFlags<DisplayFlag>;
6671
6671
 
6672
6672
  /**
6673
- * Helper function to get the grid index of the current room.
6673
+ * Helper function to get the safe grid index of the current room. (The safe grid index is defined
6674
+ * as the top-left 1x1 section that the room overlaps with, or the top-right 1x1 section of a
6675
+ * `RoomType.SHAPE_LTL` room.)
6674
6676
  *
6675
- * - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
6676
- * the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
6677
- * overlaps with, or the top-right 1x1 section of a `RoomType.SHAPE_LTL` room.)
6678
- * - If the current room is outside of the grid, it will return the index from the
6679
- * `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
6677
+ * Under the hood, this function uses the `Level.GetCurrentRoomDesc` method. (In Afterbirth+, this
6678
+ * method was bugged for rooms outside of the grid, but it is now fixed.)
6680
6679
  *
6681
6680
  * Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
6682
6681
  * will return the specific 1x1 quadrant that the player entered the room at. For most situations,
@@ -8601,6 +8600,15 @@ export declare function isMinibossRoomOf(roomData: RoomConfig, minibossID: Minib
8601
8600
  */
8602
8601
  export declare function isMirrorRoom(roomData: RoomConfig): boolean;
8603
8602
 
8603
+ /**
8604
+ * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
8605
+ * ground, a wall, or a grid entity.
8606
+ *
8607
+ * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
8608
+ * die if they hit an enemy, but they will die if they hit a wall or object.)
8609
+ */
8610
+ export declare function isMissedTear(tear: EntityTear): boolean;
8611
+
8604
8612
  /** Returns true for any card or rune added by a mod. */
8605
8613
  export declare function isModdedCardType(cardType: CardType): boolean;
8606
8614
 
@@ -8822,10 +8830,10 @@ export declare function isRoomType(roomData: RoomConfig, ...roomTypes: RoomType[
8822
8830
  /**
8823
8831
  * Helper function to check if a given room is visible on the minimap.
8824
8832
  *
8825
- * @param roomGridIndex The room to check.
8833
+ * @param roomGridIndexOrRoomDescriptor The room to check.
8826
8834
  * @param minimapAPI Optional. Whether MinimapAPI should be used, if present. Default is true.
8827
8835
  */
8828
- export declare function isRoomVisible(roomGridIndex: int, minimapAPI?: boolean): boolean;
8836
+ export declare function isRoomVisible(roomGridIndexOrRoomDescriptor: int | RoomDescriptor, minimapAPI?: boolean): boolean;
8829
8837
 
8830
8838
  /** Returns true for cards that have `CardType.RUNE`. */
8831
8839
  export declare function isRune(cardType: CardType): boolean;
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 33.9.3
3
+ isaacscript-common 33.11.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -20710,7 +20710,7 @@ ____exports.COLLECTIBLE_TYPE_TO_NAME_MAP = __TS__New(ReadonlyMap, {
20710
20710
  {653, "Vade Retro"},
20711
20711
  {654, "False PHD"},
20712
20712
  {655, "Spin to Win"},
20713
- {656, "Damocles"},
20713
+ {656, "Damocles (Passive)"},
20714
20714
  {657, "Vasculitis"},
20715
20715
  {658, "Giant Cell"},
20716
20716
  {659, "Tropicamide"},
@@ -26764,11 +26764,6 @@ function ____exports.getRoomDescriptorReadOnly(self)
26764
26764
  return level:GetCurrentRoomDesc()
26765
26765
  end
26766
26766
  function ____exports.getRoomGridIndex(self)
26767
- local level = game:GetLevel()
26768
- local currentRoomIndex = level:GetCurrentRoomIndex()
26769
- if currentRoomIndex < 0 then
26770
- return currentRoomIndex
26771
- end
26772
26767
  local roomDescriptor = ____exports.getRoomDescriptorReadOnly(nil)
26773
26768
  return roomDescriptor.SafeGridIndex
26774
26769
  end
@@ -30876,6 +30871,9 @@ function ____exports.addTearsStat(self, player, tearsStat)
30876
30871
  local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
30877
30872
  player.MaxFireDelay = newMaxFireDelay
30878
30873
  end
30874
+ function ____exports.isMissedTear(self, tear)
30875
+ return tear:IsDead()
30876
+ end
30879
30877
  function ____exports.isTearFromFamiliar(self, tear, familiarVariant, subType)
30880
30878
  if tear.FrameCount == 0 then
30881
30879
  error("Failed to check if the given tear was from a player since the tear's frame count was equal to 0. (The \"isTearFromFamiliar\" function must only be used in the \"POST_TEAR_INIT_VERY_LATE\" callback or on frame 1 and onwards.)")
@@ -53786,6 +53784,8 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
53786
53784
  local getRoomGridIndex = ____roomData.getRoomGridIndex
53787
53785
  local ____rooms = require("src.functions.rooms")
53788
53786
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
53787
+ local ____types = require("src.functions.types")
53788
+ local isNumber = ____types.isNumber
53789
53789
  local ____utils = require("src.functions.utils")
53790
53790
  local assertDefined = ____utils.assertDefined
53791
53791
  function ____exports.getRoomDisplayFlags(self, roomGridIndex, minimapAPI)
@@ -53878,10 +53878,11 @@ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
53878
53878
  minimapAPIRoomDescriptor.Hidden = true
53879
53879
  end
53880
53880
  end
53881
- function ____exports.isRoomVisible(self, roomGridIndex, minimapAPI)
53881
+ function ____exports.isRoomVisible(self, roomGridIndexOrRoomDescriptor, minimapAPI)
53882
53882
  if minimapAPI == nil then
53883
53883
  minimapAPI = true
53884
53884
  end
53885
+ local roomGridIndex = isNumber(nil, roomGridIndexOrRoomDescriptor) and roomGridIndexOrRoomDescriptor or roomGridIndexOrRoomDescriptor.SafeGridIndex
53885
53886
  local roomDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
53886
53887
  return roomDisplayFlags ~= DisplayFlagZero
53887
53888
  end
@@ -65,10 +65,10 @@ export declare function hideRoomOnMinimap(roomGridIndex: int): void;
65
65
  /**
66
66
  * Helper function to check if a given room is visible on the minimap.
67
67
  *
68
- * @param roomGridIndex The room to check.
68
+ * @param roomGridIndexOrRoomDescriptor The room to check.
69
69
  * @param minimapAPI Optional. Whether MinimapAPI should be used, if present. Default is true.
70
70
  */
71
- export declare function isRoomVisible(roomGridIndex: int, minimapAPI?: boolean): boolean;
71
+ export declare function isRoomVisible(roomGridIndexOrRoomDescriptor: int | RoomDescriptor, minimapAPI?: boolean): boolean;
72
72
  /**
73
73
  * Helper function to set the minimap `DisplayFlag` value for every room on the floor at once.
74
74
  *
@@ -1 +1 @@
1
- {"version":3,"file":"minimap.d.ts","sourceRoot":"","sources":["../../../src/functions/minimap.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAQhE;;;;;;;;;;GAUG;AACH,wBAAgB,kBAAkB,CAChC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,WAAW,EAAE,WAAW,EACxB,gBAAgB,UAAO,GACtB,IAAI,CAIN;AAED;;;;;;;GAOG;AACH,wBAAgB,sBAAsB,IAAI,IAAI,CAE7C;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,qBAAqB,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAE9D;AAED;;;;;;;GAOG;AACH,wBAAgB,oBAAoB,CAClC,UAAU,UAAO,GAChB,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,CAUjC;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,CAAC,EAAE,GAAG,EACnB,UAAU,UAAO,GAChB,QAAQ,CAAC,WAAW,CAAC,CAiBvB;AAED;;;;;;;;GAQG;AACH,wBAAgB,iBAAiB,CAAC,aAAa,EAAE,GAAG,GAAG,IAAI,CAe1D;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,aAAa,EAAE,GAAG,EAAE,UAAU,UAAO,GAAG,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AAE,GAAG,GAAG,cAAc,EACnD,UAAU,UAAO,GAChB,OAAO,CAOT;AAED;;;;;;;GAOG;AACH,wBAAgB,kBAAkB,CAAC,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,GAAG,IAAI,CAW5E;AAED;;;;;;;;;GASG;AACH,wBAAgB,oBAAoB,CAClC,eAAe,EAAE,GAAG,CAAC,GAAG,EAAE,QAAQ,CAAC,WAAW,CAAC,CAAC,GAC/C,IAAI,CAWN;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,mBAAmB,CACjC,aAAa,EAAE,GAAG,GAAG,SAAS,EAC9B,YAAY,EAAE,QAAQ,CAAC,WAAW,CAAC,EACnC,gBAAgB,UAAO,GACtB,IAAI,CAsBN"}
@@ -14,6 +14,8 @@ local getRoomDescriptor = ____roomData.getRoomDescriptor
14
14
  local getRoomGridIndex = ____roomData.getRoomGridIndex
15
15
  local ____rooms = require("src.functions.rooms")
16
16
  local getRoomsInsideGrid = ____rooms.getRoomsInsideGrid
17
+ local ____types = require("src.functions.types")
18
+ local isNumber = ____types.isNumber
17
19
  local ____utils = require("src.functions.utils")
18
20
  local assertDefined = ____utils.assertDefined
19
21
  --- Helper function to get a particular room's minimap display flags (e.g. whether it is visible and
@@ -170,12 +172,13 @@ function ____exports.hideRoomOnMinimap(self, roomGridIndex)
170
172
  end
171
173
  --- Helper function to check if a given room is visible on the minimap.
172
174
  --
173
- -- @param roomGridIndex The room to check.
175
+ -- @param roomGridIndexOrRoomDescriptor The room to check.
174
176
  -- @param minimapAPI Optional. Whether MinimapAPI should be used, if present. Default is true.
175
- function ____exports.isRoomVisible(self, roomGridIndex, minimapAPI)
177
+ function ____exports.isRoomVisible(self, roomGridIndexOrRoomDescriptor, minimapAPI)
176
178
  if minimapAPI == nil then
177
179
  minimapAPI = true
178
180
  end
181
+ local roomGridIndex = isNumber(nil, roomGridIndexOrRoomDescriptor) and roomGridIndexOrRoomDescriptor or roomGridIndexOrRoomDescriptor.SafeGridIndex
179
182
  local roomDisplayFlags = ____exports.getRoomDisplayFlags(nil, roomGridIndex, minimapAPI)
180
183
  return roomDisplayFlags ~= DisplayFlagZero
181
184
  end
@@ -18,13 +18,12 @@ export declare function getRoomDescriptor(roomGridIndex?: int): RoomDescriptor;
18
18
  */
19
19
  export declare function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor>;
20
20
  /**
21
- * Helper function to get the grid index of the current room.
21
+ * Helper function to get the safe grid index of the current room. (The safe grid index is defined
22
+ * as the top-left 1x1 section that the room overlaps with, or the top-right 1x1 section of a
23
+ * `RoomType.SHAPE_LTL` room.)
22
24
  *
23
- * - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
24
- * the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
25
- * overlaps with, or the top-right 1x1 section of a `RoomType.SHAPE_LTL` room.)
26
- * - If the current room is outside of the grid, it will return the index from the
27
- * `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
25
+ * Under the hood, this function uses the `Level.GetCurrentRoomDesc` method. (In Afterbirth+, this
26
+ * method was bugged for rooms outside of the grid, but it is now fixed.)
28
27
  *
29
28
  * Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
30
29
  * will return the specific 1x1 quadrant that the player entered the room at. For most situations,
@@ -1 +1 @@
1
- {"version":3,"file":"roomData.d.ts","sourceRoot":"","sources":["../../../src/functions/roomData.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,QAAQ,EACR,SAAS,EACT,QAAQ,EACR,OAAO,EACR,MAAM,8BAA8B,CAAC;AAMtC;;;GAGG;AACH,wBAAgB,mBAAmB,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,GAAG,CAAC,QAAQ,CAAC,CAgBtE;AAGD,wBAAgB,WAAW,IAAI,UAAU,CAAC;AAC1C,wBAAgB,WAAW,CAAC,aAAa,CAAC,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAAC;AAYzE;;;;GAIG;AACH,wBAAgB,iBAA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,QAAQ,EAAE,UAAU,GAAG,IAAI,CAG1E"}
@@ -33,13 +33,12 @@ function ____exports.getRoomDescriptorReadOnly(self)
33
33
  local level = game:GetLevel()
34
34
  return level:GetCurrentRoomDesc()
35
35
  end
36
- --- Helper function to get the grid index of the current room.
36
+ --- Helper function to get the safe grid index of the current room. (The safe grid index is defined
37
+ -- as the top-left 1x1 section that the room overlaps with, or the top-right 1x1 section of a
38
+ -- `RoomType.SHAPE_LTL` room.)
37
39
  --
38
- -- - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
39
- -- the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
40
- -- overlaps with, or the top-right 1x1 section of a `RoomType.SHAPE_LTL` room.)
41
- -- - If the current room is outside of the grid, it will return the index from the
42
- -- `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
40
+ -- Under the hood, this function uses the `Level.GetCurrentRoomDesc` method. (In Afterbirth+, this
41
+ -- method was bugged for rooms outside of the grid, but it is now fixed.)
43
42
  --
44
43
  -- Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
45
44
  -- will return the specific 1x1 quadrant that the player entered the room at. For most situations,
@@ -48,11 +47,6 @@ end
48
47
  -- Data structures that store data per room should use the room's `ListIndex` instead of
49
48
  -- `SafeGridIndex`, since the former is unique across different dimensions.
50
49
  function ____exports.getRoomGridIndex(self)
51
- local level = game:GetLevel()
52
- local currentRoomIndex = level:GetCurrentRoomIndex()
53
- if currentRoomIndex < 0 then
54
- return currentRoomIndex
55
- end
56
50
  local roomDescriptor = ____exports.getRoomDescriptorReadOnly(nil)
57
51
  return roomDescriptor.SafeGridIndex
58
52
  end
@@ -31,6 +31,14 @@ export declare function getFireDelay(tearsStat: float): float;
31
31
  * this function.
32
32
  */
33
33
  export declare function getTearsStat(fireDelay: float): float;
34
+ /**
35
+ * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
36
+ * ground, a wall, or a grid entity.
37
+ *
38
+ * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
39
+ * die if they hit an enemy, but they will die if they hit a wall or object.)
40
+ */
41
+ export declare function isMissedTear(tear: EntityTear): boolean;
34
42
  /**
35
43
  * Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
36
44
  * is determined by looking at the parent.
@@ -1 +1 @@
1
- {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,eAAe,EACjC,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAuBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
1
+ {"version":3,"file":"tears.d.ts","sourceRoot":"","sources":["../../../src/functions/tears.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAEpE;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,YAAY,CAAC,MAAM,EAAE,YAAY,EAAE,SAAS,EAAE,KAAK,GAAG,IAAI,CAKzE;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;GAKG;AACH,wBAAgB,YAAY,CAAC,SAAS,EAAE,KAAK,GAAG,KAAK,CAEpD;AAED;;;;;;GAMG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAEtD;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,UAAU,EAChB,eAAe,CAAC,EAAE,eAAe,EACjC,OAAO,CAAC,EAAE,GAAG,GACZ,OAAO,CAuBT;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAAC,IAAI,EAAE,UAAU,GAAG,OAAO,CAgB1D"}
@@ -34,6 +34,14 @@ function ____exports.addTearsStat(self, player, tearsStat)
34
34
  local newMaxFireDelay = ____exports.getFireDelay(nil, newTearsStat)
35
35
  player.MaxFireDelay = newMaxFireDelay
36
36
  end
37
+ --- Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
38
+ -- ground, a wall, or a grid entity.
39
+ --
40
+ -- Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
41
+ -- die if they hit an enemy, but they will die if they hit a wall or object.)
42
+ function ____exports.isMissedTear(self, tear)
43
+ return tear:IsDead()
44
+ end
37
45
  --- Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
38
46
  -- is determined by looking at the parent.
39
47
  --
@@ -657,7 +657,7 @@ ____exports.COLLECTIBLE_TYPE_TO_NAME_MAP = __TS__New(ReadonlyMap, {
657
657
  {653, "Vade Retro"},
658
658
  {654, "False PHD"},
659
659
  {655, "Spin to Win"},
660
- {656, "Damocles"},
660
+ {656, "Damocles (Passive)"},
661
661
  {657, "Vasculitis"},
662
662
  {658, "Giant Cell"},
663
663
  {659, "Tropicamide"},
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "33.9.3",
3
+ "version": "33.11.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -4,6 +4,7 @@ import { game } from "../core/cachedClasses";
4
4
  import { addFlag } from "./flag";
5
5
  import { getRoomDescriptor, getRoomGridIndex } from "./roomData";
6
6
  import { getRoomsInsideGrid } from "./rooms";
7
+ import { isNumber } from "./types";
7
8
  import { assertDefined } from "./utils";
8
9
 
9
10
  /**
@@ -137,11 +138,18 @@ export function hideRoomOnMinimap(roomGridIndex: int): void {
137
138
  /**
138
139
  * Helper function to check if a given room is visible on the minimap.
139
140
  *
140
- * @param roomGridIndex The room to check.
141
+ * @param roomGridIndexOrRoomDescriptor The room to check.
141
142
  * @param minimapAPI Optional. Whether MinimapAPI should be used, if present. Default is true.
142
143
  */
143
- export function isRoomVisible(roomGridIndex: int, minimapAPI = true): boolean {
144
+ export function isRoomVisible(
145
+ roomGridIndexOrRoomDescriptor: int | RoomDescriptor,
146
+ minimapAPI = true,
147
+ ): boolean {
148
+ const roomGridIndex = isNumber(roomGridIndexOrRoomDescriptor)
149
+ ? roomGridIndexOrRoomDescriptor
150
+ : roomGridIndexOrRoomDescriptor.SafeGridIndex;
144
151
  const roomDisplayFlags = getRoomDisplayFlags(roomGridIndex, minimapAPI);
152
+
145
153
  return roomDisplayFlags !== DisplayFlagZero;
146
154
  }
147
155
 
@@ -70,13 +70,12 @@ export function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor> {
70
70
  }
71
71
 
72
72
  /**
73
- * Helper function to get the grid index of the current room.
73
+ * Helper function to get the safe grid index of the current room. (The safe grid index is defined
74
+ * as the top-left 1x1 section that the room overlaps with, or the top-right 1x1 section of a
75
+ * `RoomType.SHAPE_LTL` room.)
74
76
  *
75
- * - If the current room is inside of the grid, this function will return the `SafeGridIndex` from
76
- * the room descriptor. (The safe grid index is defined as the top-left 1x1 section that the room
77
- * overlaps with, or the top-right 1x1 section of a `RoomType.SHAPE_LTL` room.)
78
- * - If the current room is outside of the grid, it will return the index from the
79
- * `Level.GetCurrentRoomIndex` method (since `SafeGridIndex` is bugged for these cases).
77
+ * Under the hood, this function uses the `Level.GetCurrentRoomDesc` method. (In Afterbirth+, this
78
+ * method was bugged for rooms outside of the grid, but it is now fixed.)
80
79
  *
81
80
  * Use this function instead of the `Level.GetCurrentRoomIndex` method directly because the latter
82
81
  * will return the specific 1x1 quadrant that the player entered the room at. For most situations,
@@ -86,16 +85,6 @@ export function getRoomDescriptorReadOnly(): Readonly<RoomDescriptor> {
86
85
  * `SafeGridIndex`, since the former is unique across different dimensions.
87
86
  */
88
87
  export function getRoomGridIndex(): int {
89
- const level = game.GetLevel();
90
- const currentRoomIndex = level.GetCurrentRoomIndex();
91
-
92
- // Both `RoomDescriptor.GridIndex` and `RoomDescriptor.SafeGridIndex` will always be equal to -1
93
- // for rooms outside of the grid. Thus, we revert to using the `Level.GetCurrentRoomIndex` method
94
- // for these cases.
95
- if (currentRoomIndex < 0) {
96
- return currentRoomIndex;
97
- }
98
-
99
88
  const roomDescriptor = getRoomDescriptorReadOnly();
100
89
  return roomDescriptor.SafeGridIndex;
101
90
  }
@@ -44,6 +44,17 @@ export function getTearsStat(fireDelay: float): float {
44
44
  return 30 / (fireDelay + 1);
45
45
  }
46
46
 
47
+ /**
48
+ * Helper function to check if a tear hit an enemy. A tear is considered to be missed if it hit the
49
+ * ground, a wall, or a grid entity.
50
+ *
51
+ * Under the hood, this function uses the `Entity.IsDead` method to determine this. (Tears will not
52
+ * die if they hit an enemy, but they will die if they hit a wall or object.)
53
+ */
54
+ export function isMissedTear(tear: EntityTear): boolean {
55
+ return tear.IsDead();
56
+ }
57
+
47
58
  /**
48
59
  * Helper function to check if a given tear is from a familiar (as opposed to e.g. a player). This
49
60
  * is determined by looking at the parent.
@@ -661,7 +661,7 @@ export const COLLECTIBLE_TYPE_TO_NAME_MAP = new ReadonlyMap<
661
661
  [653, "Vade Retro"],
662
662
  [654, "False PHD"],
663
663
  [655, "Spin to Win"],
664
- [656, "Damocles"],
664
+ [656, "Damocles (Passive)"],
665
665
  [657, "Vasculitis"],
666
666
  [658, "Giant Cell"],
667
667
  [659, "Tropicamide"],