isaacscript-common 59.5.0 → 59.7.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.
@@ -7642,6 +7642,24 @@ export declare function getSubPlayerParent(subPlayer: EntitySubPlayer): EntityPl
7642
7642
  */
7643
7643
  export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
7644
7644
 
7645
+ /**
7646
+ * Helper function to get the grid indexes on the surrounding tiles from the provided grid index.
7647
+ *
7648
+ * There are always 8 grid indexes returned (e.g. top-left + top + top-right + left + right +
7649
+ * bottom-left + bottom + right), even if the computed values would be negative or otherwise
7650
+ * invalid.
7651
+ */
7652
+ export declare function getSurroundingGridIndexes(gridIndex: int): [
7653
+ topLeft: int,
7654
+ top: int,
7655
+ topRight: int,
7656
+ left: int,
7657
+ right: int,
7658
+ bottomLeft: int,
7659
+ bottom: int,
7660
+ bottomRight: int
7661
+ ];
7662
+
7645
7663
  /**
7646
7664
  * Helper function to determine how many heart containers that Tainted Magdalene has that will not
7647
7665
  * be automatically depleted over time. By default, this is 2, but this function will return 4 so
@@ -8654,6 +8672,30 @@ export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupB
8654
8672
  */
8655
8673
  export declare function isBeastRoom(roomData: RoomConfig): boolean;
8656
8674
 
8675
+ /**
8676
+ * Helper function to check if the current game frame count is lower than a specific game frame
8677
+ * count.
8678
+ *
8679
+ * This returns false if the submitted game frame count is null or undefined.
8680
+ */
8681
+ export declare function isBeforeGameFrame(gameFrameCount: int | null | undefined): boolean;
8682
+
8683
+ /**
8684
+ * Helper function to check if the current render frame count is lower than a specific render frame
8685
+ * count.
8686
+ *
8687
+ * This returns false if the submitted render frame count is null or undefined.
8688
+ */
8689
+ export declare function isBeforeRenderFrame(renderFrameCount: int | null | undefined): boolean;
8690
+
8691
+ /**
8692
+ * Helper function to check if the current room frame count is lower than a specific room frame
8693
+ * count.
8694
+ *
8695
+ * This returns false if the submitted room frame count is null or undefined.
8696
+ */
8697
+ export declare function isBeforeRoomFrame(roomFrameCount: int | null | undefined): boolean;
8698
+
8657
8699
  /**
8658
8700
  * Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you
8659
8701
  * need to adjust UI elements to account for Bethany's soul charges or Tainted Bethany's blood
@@ -9198,6 +9240,12 @@ export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
9198
9240
  */
9199
9241
  export declare function isGridEntityXMLType(num: number): num is GridEntityXMLType;
9200
9242
 
9243
+ /**
9244
+ * Helper function to check if the provided grid index has a door on it or if the surrounding 8 grid
9245
+ * indexes have a door on it.
9246
+ */
9247
+ export declare function isGridIndexAdjacentToDoor(gridIndex: int): boolean;
9248
+
9201
9249
  /** For `PickupVariant.HEART` (10). */
9202
9250
  export declare function isHeart(pickup: EntityPickup): pickup is EntityPickupHeart;
9203
9251
 
@@ -14432,6 +14480,30 @@ export declare function onFirstFloor(): boolean;
14432
14480
  */
14433
14481
  export declare function onGameFrame(gameFrameCount: int | null | undefined): boolean;
14434
14482
 
14483
+ /**
14484
+ * Helper function to check if the current game frame count is equal to or lower than a specific
14485
+ * game frame count.
14486
+ *
14487
+ * This returns false if the submitted game frame count is null or undefined.
14488
+ */
14489
+ export declare function onOrBeforeGameFrame(gameFrameCount: int | null | undefined): boolean;
14490
+
14491
+ /**
14492
+ * Helper function to check if the current render frame count is equal to or lower than a specific
14493
+ * render frame count.
14494
+ *
14495
+ * This returns false if the submitted render frame count is null or undefined.
14496
+ */
14497
+ export declare function onOrBeforeRenderFrame(renderFrameCount: int | null | undefined): boolean;
14498
+
14499
+ /**
14500
+ * Helper function to check if the current room frame count is equal to or lower than a specific
14501
+ * room frame count.
14502
+ *
14503
+ * This returns false if the submitted room frame count is null or undefined.
14504
+ */
14505
+ export declare function onOrBeforeRoomFrame(roomFrameCount: int | null | undefined): boolean;
14506
+
14435
14507
  /**
14436
14508
  * Helper function to check if the current game frame count is equal to or higher than a specific
14437
14509
  * game frame count.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 59.5.0
3
+ isaacscript-common 59.7.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -19091,6 +19091,28 @@ function ____exports.getElapsedRoomFramesSince(self, roomFrameCount)
19091
19091
  local thisRoomFrameCount = room:GetFrameCount()
19092
19092
  return thisRoomFrameCount - roomFrameCount
19093
19093
  end
19094
+ function ____exports.isBeforeGameFrame(self, gameFrameCount)
19095
+ if gameFrameCount == nil or gameFrameCount == nil then
19096
+ return false
19097
+ end
19098
+ local thisGameFrameCount = game:GetFrameCount()
19099
+ return thisGameFrameCount < gameFrameCount
19100
+ end
19101
+ function ____exports.isBeforeRenderFrame(self, renderFrameCount)
19102
+ if renderFrameCount == nil or renderFrameCount == nil then
19103
+ return false
19104
+ end
19105
+ local thisRenderFrameCount = Isaac.GetFrameCount()
19106
+ return thisRenderFrameCount < renderFrameCount
19107
+ end
19108
+ function ____exports.isBeforeRoomFrame(self, roomFrameCount)
19109
+ if roomFrameCount == nil or roomFrameCount == nil then
19110
+ return false
19111
+ end
19112
+ local room = game:GetRoom()
19113
+ local thisGameFrameCount = room:GetFrameCount()
19114
+ return thisGameFrameCount < roomFrameCount
19115
+ end
19094
19116
  function ____exports.isPastGameFrame(self, gameFrameCount)
19095
19117
  if gameFrameCount == nil or gameFrameCount == nil then
19096
19118
  return false
@@ -19103,7 +19125,7 @@ function ____exports.isPastRenderFrame(self, renderFrameCount)
19103
19125
  return false
19104
19126
  end
19105
19127
  local thisRenderFrameCount = Isaac.GetFrameCount()
19106
- return thisRenderFrameCount >= renderFrameCount
19128
+ return thisRenderFrameCount > renderFrameCount
19107
19129
  end
19108
19130
  function ____exports.isPastRoomFrame(self, roomFrameCount)
19109
19131
  if roomFrameCount == nil or roomFrameCount == nil then
@@ -19120,6 +19142,28 @@ function ____exports.onGameFrame(self, gameFrameCount)
19120
19142
  local thisGameFrameCount = game:GetFrameCount()
19121
19143
  return thisGameFrameCount == gameFrameCount
19122
19144
  end
19145
+ function ____exports.onOrBeforeGameFrame(self, gameFrameCount)
19146
+ if gameFrameCount == nil or gameFrameCount == nil then
19147
+ return false
19148
+ end
19149
+ local thisGameFrameCount = game:GetFrameCount()
19150
+ return thisGameFrameCount <= gameFrameCount
19151
+ end
19152
+ function ____exports.onOrBeforeRenderFrame(self, renderFrameCount)
19153
+ if renderFrameCount == nil or renderFrameCount == nil then
19154
+ return false
19155
+ end
19156
+ local thisRenderFrameCount = Isaac.GetFrameCount()
19157
+ return thisRenderFrameCount <= renderFrameCount
19158
+ end
19159
+ function ____exports.onOrBeforeRoomFrame(self, roomFrameCount)
19160
+ if roomFrameCount == nil or roomFrameCount == nil then
19161
+ return false
19162
+ end
19163
+ local room = game:GetRoom()
19164
+ local thisGameFrameCount = room:GetFrameCount()
19165
+ return thisGameFrameCount >= roomFrameCount
19166
+ end
19123
19167
  function ____exports.onOrPastGameFrame(self, gameFrameCount)
19124
19168
  if gameFrameCount == nil or gameFrameCount == nil then
19125
19169
  return false
@@ -28923,6 +28967,20 @@ function getRockPNGName(self)
28923
28967
  end
28924
28968
  until true
28925
28969
  end
28970
+ function ____exports.getSurroundingGridIndexes(self, gridIndex)
28971
+ local room = game:GetRoom()
28972
+ local gridWidth = room:GetGridWidth()
28973
+ return {
28974
+ gridIndex - gridWidth - 1,
28975
+ gridIndex - gridWidth,
28976
+ gridIndex - gridWidth + 1,
28977
+ gridIndex - 1,
28978
+ gridIndex + 1,
28979
+ gridIndex + gridWidth - 1,
28980
+ gridIndex + gridWidth,
28981
+ gridIndex + gridWidth + 1
28982
+ }
28983
+ end
28926
28984
  function ____exports.getTopLeftWallGridIndex(self)
28927
28985
  local room = game:GetRoom()
28928
28986
  local roomShape = room:GetRoomShape()
@@ -29173,18 +29231,8 @@ function ____exports.getRockPNGPath(self)
29173
29231
  end
29174
29232
  function ____exports.getSurroundingGridEntities(self, gridEntity)
29175
29233
  local room = game:GetRoom()
29176
- local gridWidth = room:GetGridWidth()
29177
29234
  local gridIndex = gridEntity:GetGridIndex()
29178
- local surroundingGridIndexes = {
29179
- gridIndex - 1,
29180
- gridIndex + 1,
29181
- gridIndex - gridWidth - 1,
29182
- gridIndex - gridWidth,
29183
- gridIndex - gridWidth + 1,
29184
- gridIndex + gridWidth - 1,
29185
- gridIndex + gridWidth,
29186
- gridIndex + gridWidth + 1
29187
- }
29235
+ local surroundingGridIndexes = ____exports.getSurroundingGridIndexes(nil, gridIndex)
29188
29236
  local surroundingGridEntities = {}
29189
29237
  for ____, surroundingGridIndex in ipairs(surroundingGridIndexes) do
29190
29238
  local surroundingGridEntity = room:GetGridEntity(surroundingGridIndex)
@@ -29213,6 +29261,24 @@ end
29213
29261
  function ____exports.isGridEntityXMLType(self, num)
29214
29262
  return GRID_ENTITY_XML_TYPES_SET:has(num)
29215
29263
  end
29264
+ function ____exports.isGridIndexAdjacentToDoor(self, gridIndex)
29265
+ local room = game:GetRoom()
29266
+ local surroundingGridIndexes = ____exports.getSurroundingGridIndexes(nil, gridIndex)
29267
+ local gridIndexes = {
29268
+ gridIndex,
29269
+ table.unpack(surroundingGridIndexes)
29270
+ }
29271
+ for ____, gridIndexToInspect in ipairs(gridIndexes) do
29272
+ local gridEntity = room:GetGridEntity(gridIndexToInspect)
29273
+ if gridEntity ~= nil then
29274
+ local door = gridEntity:ToDoor()
29275
+ if door ~= nil then
29276
+ return true
29277
+ end
29278
+ end
29279
+ end
29280
+ return false
29281
+ end
29216
29282
  function ____exports.isPoopGridEntityXMLType(self, gridEntityXMLType)
29217
29283
  return POOP_GRID_ENTITY_XML_TYPES_SET:has(gridEntityXMLType)
29218
29284
  end
@@ -38056,7 +38122,7 @@ local ISCFeature = ____ISCFeature.ISCFeature
38056
38122
  local ____entities = require("src.functions.entities")
38057
38123
  local getEntityID = ____entities.getEntityID
38058
38124
  local ____frames = require("src.functions.frames")
38059
- local isPastRoomFrame = ____frames.isPastRoomFrame
38125
+ local onOrBeforeRoomFrame = ____frames.onOrBeforeRoomFrame
38060
38126
  local ____roomData = require("src.functions.roomData")
38061
38127
  local getRoomListIndex = ____roomData.getRoomListIndex
38062
38128
  local ____stage = require("src.functions.stage")
@@ -38115,7 +38181,7 @@ function PickupIndexCreation.prototype.setPickupIndex(self, pickup)
38115
38181
  local pickupIndexFromLevelData = self:getPickupIndexFromPreviousData(pickup)
38116
38182
  local room = game:GetRoom()
38117
38183
  local isFirstVisit = room:IsFirstVisit()
38118
- if pickupIndexFromLevelData ~= nil and not isFirstVisit and not isPastRoomFrame(nil, 0) then
38184
+ if pickupIndexFromLevelData ~= nil and not isFirstVisit and onOrBeforeRoomFrame(nil, 0) then
38119
38185
  v.room.pickupIndexes:set(ptrHash, pickupIndexFromLevelData)
38120
38186
  return
38121
38187
  end
@@ -42429,6 +42495,7 @@ local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
42429
42495
  local ____easing = require("src.functions.easing")
42430
42496
  local easeOutSine = ____easing.easeOutSine
42431
42497
  local ____frames = require("src.functions.frames")
42498
+ local isBeforeRenderFrame = ____frames.isBeforeRenderFrame
42432
42499
  local isPastRoomFrame = ____frames.isPastRoomFrame
42433
42500
  local onOrPastRenderFrame = ____frames.onOrPastRenderFrame
42434
42501
  local ____log = require("src.functions.log")
@@ -42589,7 +42656,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
42589
42656
  return
42590
42657
  end
42591
42658
  local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
42592
- if not onOrPastRenderFrame(nil, renderFrameScreenBlack) then
42659
+ if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
42593
42660
  return
42594
42661
  end
42595
42662
  v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
@@ -42634,7 +42701,7 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
42634
42701
  return
42635
42702
  end
42636
42703
  local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
42637
- if not onOrPastRenderFrame(nil, renderFrameScreenBlack) then
42704
+ if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
42638
42705
  return
42639
42706
  end
42640
42707
  v.run.state = StageTravelState.PIXELATION_TO_ROOM
@@ -1 +1 @@
1
- {"version":3,"file":"CustomTrapdoors.d.ts","sourceRoot":"","sources":["../../../../../src/classes/features/other/CustomTrapdoors.ts"],"names":[],"mappings":"AAAA,OAAO,EAOL,UAAU,EAKV,SAAS,EACV,MAAM,8BAA8B,CAAC;AAmCtC,OAAO,EAAE,OAAO,EAAE,MAAM,uBAAuB,CAAC;AAkDhD,qBAAa,eAAgB,SAAQ,OAAO;IAC1C,qCAAqC;IACrC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAO/B;IAKJ;;;;;OAKG;IACH,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAY;IAExC,OAAO,CAAC,QAAQ,CAAC,kBAAkB,CAAqB;IACxD,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,aAAa,CAAgB;IAC9C,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAiB;IAChD,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAC5C,OAAO,CAAC,QAAQ,CAAC,WAAW,CAAc;IAC1C,OAAO,CAAC,QAAQ,CAAC,YAAY,CAAe;IAmD5C,OAAO,CAAC,QAAQ,CAAC,UAAU,CAMzB;IAEF,OAAO,CAAC,2BAA2B;IA+BnC,OAAO,CAAC,8BAA8B;IAiDtC,OAAO,CAAC,6BAA6B;IAsBrC,OAAO,CAAC,kBAAkB;IAqB1B,OAAO,CAAC,4BAA4B;IA+CpC,OAAO,CAAC,iCAAiC;IAqBzC,OAAO,CAAC,eAAe;IAoBvB,OAAO,CAAC,QAAQ,CAAC,kCAAkC,CAcjD;IAEF,OAAO,CAAC,4BAA4B;IAcpC,OAAO,CAAC,kBAAkB;IAc1B,OAAO,CAAC,sBAAsB;IAkB9B,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AAS,CAAC,EAAE,OAAO,GAClB,UAAU;CAsDd"}
@@ -41,6 +41,7 @@ local TrapdoorAnimation = ____TrapdoorAnimation.TrapdoorAnimation
41
41
  local ____easing = require("src.functions.easing")
42
42
  local easeOutSine = ____easing.easeOutSine
43
43
  local ____frames = require("src.functions.frames")
44
+ local isBeforeRenderFrame = ____frames.isBeforeRenderFrame
44
45
  local isPastRoomFrame = ____frames.isPastRoomFrame
45
46
  local onOrPastRenderFrame = ____frames.onOrPastRenderFrame
46
47
  local ____log = require("src.functions.log")
@@ -202,7 +203,7 @@ function CustomTrapdoors.prototype.checkPixelationToBlackComplete(self)
202
203
  return
203
204
  end
204
205
  local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
205
- if not onOrPastRenderFrame(nil, renderFrameScreenBlack) then
206
+ if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
206
207
  return
207
208
  end
208
209
  v.run.state = StageTravelState.WAITING_FOR_FIRST_PIXELATION_TO_END
@@ -247,7 +248,7 @@ function CustomTrapdoors.prototype.checkSecondPixelationHalfWay(self)
247
248
  return
248
249
  end
249
250
  local renderFrameScreenBlack = v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES
250
- if not onOrPastRenderFrame(nil, renderFrameScreenBlack) then
251
+ if isBeforeRenderFrame(nil, renderFrameScreenBlack) then
251
252
  return
252
253
  end
253
254
  v.run.state = StageTravelState.PIXELATION_TO_ROOM
@@ -20,7 +20,7 @@ local ISCFeature = ____ISCFeature.ISCFeature
20
20
  local ____entities = require("src.functions.entities")
21
21
  local getEntityID = ____entities.getEntityID
22
22
  local ____frames = require("src.functions.frames")
23
- local isPastRoomFrame = ____frames.isPastRoomFrame
23
+ local onOrBeforeRoomFrame = ____frames.onOrBeforeRoomFrame
24
24
  local ____roomData = require("src.functions.roomData")
25
25
  local getRoomListIndex = ____roomData.getRoomListIndex
26
26
  local ____stage = require("src.functions.stage")
@@ -79,7 +79,7 @@ function PickupIndexCreation.prototype.setPickupIndex(self, pickup)
79
79
  local pickupIndexFromLevelData = self:getPickupIndexFromPreviousData(pickup)
80
80
  local room = game:GetRoom()
81
81
  local isFirstVisit = room:IsFirstVisit()
82
- if pickupIndexFromLevelData ~= nil and not isFirstVisit and not isPastRoomFrame(nil, 0) then
82
+ if pickupIndexFromLevelData ~= nil and not isFirstVisit and onOrBeforeRoomFrame(nil, 0) then
83
83
  v.room.pickupIndexes:set(ptrHash, pickupIndexFromLevelData)
84
84
  return
85
85
  end
@@ -2,6 +2,27 @@
2
2
  export declare function getElapsedGameFramesSince(gameFrameCount: int): int;
3
3
  export declare function getElapsedRenderFramesSince(renderFrameCount: int): int;
4
4
  export declare function getElapsedRoomFramesSince(roomFrameCount: int): int;
5
+ /**
6
+ * Helper function to check if the current game frame count is lower than a specific game frame
7
+ * count.
8
+ *
9
+ * This returns false if the submitted game frame count is null or undefined.
10
+ */
11
+ export declare function isBeforeGameFrame(gameFrameCount: int | null | undefined): boolean;
12
+ /**
13
+ * Helper function to check if the current render frame count is lower than a specific render frame
14
+ * count.
15
+ *
16
+ * This returns false if the submitted render frame count is null or undefined.
17
+ */
18
+ export declare function isBeforeRenderFrame(renderFrameCount: int | null | undefined): boolean;
19
+ /**
20
+ * Helper function to check if the current room frame count is lower than a specific room frame
21
+ * count.
22
+ *
23
+ * This returns false if the submitted room frame count is null or undefined.
24
+ */
25
+ export declare function isBeforeRoomFrame(roomFrameCount: int | null | undefined): boolean;
5
26
  /**
6
27
  * Helper function to check if the current game frame count is higher than a specific game frame
7
28
  * count.
@@ -30,6 +51,27 @@ export declare function isPastRoomFrame(roomFrameCount: int | null | undefined):
30
51
  * This returns false if the submitted game frame count is null or undefined.
31
52
  */
32
53
  export declare function onGameFrame(gameFrameCount: int | null | undefined): boolean;
54
+ /**
55
+ * Helper function to check if the current game frame count is equal to or lower than a specific
56
+ * game frame count.
57
+ *
58
+ * This returns false if the submitted game frame count is null or undefined.
59
+ */
60
+ export declare function onOrBeforeGameFrame(gameFrameCount: int | null | undefined): boolean;
61
+ /**
62
+ * Helper function to check if the current render frame count is equal to or lower than a specific
63
+ * render frame count.
64
+ *
65
+ * This returns false if the submitted render frame count is null or undefined.
66
+ */
67
+ export declare function onOrBeforeRenderFrame(renderFrameCount: int | null | undefined): boolean;
68
+ /**
69
+ * Helper function to check if the current room frame count is equal to or lower than a specific
70
+ * room frame count.
71
+ *
72
+ * This returns false if the submitted room frame count is null or undefined.
73
+ */
74
+ export declare function onOrBeforeRoomFrame(roomFrameCount: int | null | undefined): boolean;
33
75
  /**
34
76
  * Helper function to check if the current game frame count is equal to or higher than a specific
35
77
  * game frame count.
@@ -1 +1 @@
1
- {"version":3,"file":"frames.d.ts","sourceRoot":"","sources":["../../../src/functions/frames.ts"],"names":[],"mappings":";AAEA,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,CAGlE;AAED,wBAAgB,2BAA2B,CAAC,gBAAgB,EAAE,GAAG,GAAG,GAAG,CAGtE;AAED,wBAAgB,yBAAyB,CAAC,cAAc,EAAE,GAAG,GAAG,GAAG,CAIlE;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,gBAAgB,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAST;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAO3E;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,mBA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AE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAST;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAO3E;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,qBAAqB,CACnC,gBAAgB,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAST;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CACjC,gBAAgB,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAC/B,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACrC,OAAO,CAST;AAED;;;;;GAKG;AACH,wBAAgB,aAAa,CAC3B,gBAAgB,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GACvC,OAAO,CAOT;AAED;;;;;GAKG;AACH,wBAAgB,WAAW,CAAC,cAAc,EAAE,GAAG,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO,CAS3E"}
@@ -14,6 +14,40 @@ function ____exports.getElapsedRoomFramesSince(self, roomFrameCount)
14
14
  local thisRoomFrameCount = room:GetFrameCount()
15
15
  return thisRoomFrameCount - roomFrameCount
16
16
  end
17
+ --- Helper function to check if the current game frame count is lower than a specific game frame
18
+ -- count.
19
+ --
20
+ -- This returns false if the submitted game frame count is null or undefined.
21
+ function ____exports.isBeforeGameFrame(self, gameFrameCount)
22
+ if gameFrameCount == nil or gameFrameCount == nil then
23
+ return false
24
+ end
25
+ local thisGameFrameCount = game:GetFrameCount()
26
+ return thisGameFrameCount < gameFrameCount
27
+ end
28
+ --- Helper function to check if the current render frame count is lower than a specific render frame
29
+ -- count.
30
+ --
31
+ -- This returns false if the submitted render frame count is null or undefined.
32
+ function ____exports.isBeforeRenderFrame(self, renderFrameCount)
33
+ if renderFrameCount == nil or renderFrameCount == nil then
34
+ return false
35
+ end
36
+ local thisRenderFrameCount = Isaac.GetFrameCount()
37
+ return thisRenderFrameCount < renderFrameCount
38
+ end
39
+ --- Helper function to check if the current room frame count is lower than a specific room frame
40
+ -- count.
41
+ --
42
+ -- This returns false if the submitted room frame count is null or undefined.
43
+ function ____exports.isBeforeRoomFrame(self, roomFrameCount)
44
+ if roomFrameCount == nil or roomFrameCount == nil then
45
+ return false
46
+ end
47
+ local room = game:GetRoom()
48
+ local thisGameFrameCount = room:GetFrameCount()
49
+ return thisGameFrameCount < roomFrameCount
50
+ end
17
51
  --- Helper function to check if the current game frame count is higher than a specific game frame
18
52
  -- count.
19
53
  --
@@ -34,7 +68,7 @@ function ____exports.isPastRenderFrame(self, renderFrameCount)
34
68
  return false
35
69
  end
36
70
  local thisRenderFrameCount = Isaac.GetFrameCount()
37
- return thisRenderFrameCount >= renderFrameCount
71
+ return thisRenderFrameCount > renderFrameCount
38
72
  end
39
73
  --- Helper function to check if the current room frame count is higher than a specific room frame
40
74
  -- count.
@@ -59,6 +93,40 @@ function ____exports.onGameFrame(self, gameFrameCount)
59
93
  local thisGameFrameCount = game:GetFrameCount()
60
94
  return thisGameFrameCount == gameFrameCount
61
95
  end
96
+ --- Helper function to check if the current game frame count is equal to or lower than a specific
97
+ -- game frame count.
98
+ --
99
+ -- This returns false if the submitted game frame count is null or undefined.
100
+ function ____exports.onOrBeforeGameFrame(self, gameFrameCount)
101
+ if gameFrameCount == nil or gameFrameCount == nil then
102
+ return false
103
+ end
104
+ local thisGameFrameCount = game:GetFrameCount()
105
+ return thisGameFrameCount <= gameFrameCount
106
+ end
107
+ --- Helper function to check if the current render frame count is equal to or lower than a specific
108
+ -- render frame count.
109
+ --
110
+ -- This returns false if the submitted render frame count is null or undefined.
111
+ function ____exports.onOrBeforeRenderFrame(self, renderFrameCount)
112
+ if renderFrameCount == nil or renderFrameCount == nil then
113
+ return false
114
+ end
115
+ local thisRenderFrameCount = Isaac.GetFrameCount()
116
+ return thisRenderFrameCount <= renderFrameCount
117
+ end
118
+ --- Helper function to check if the current room frame count is equal to or lower than a specific
119
+ -- room frame count.
120
+ --
121
+ -- This returns false if the submitted room frame count is null or undefined.
122
+ function ____exports.onOrBeforeRoomFrame(self, roomFrameCount)
123
+ if roomFrameCount == nil or roomFrameCount == nil then
124
+ return false
125
+ end
126
+ local room = game:GetRoom()
127
+ local thisGameFrameCount = room:GetFrameCount()
128
+ return thisGameFrameCount >= roomFrameCount
129
+ end
62
130
  --- Helper function to check if the current game frame count is equal to or higher than a specific
63
131
  -- game frame count.
64
132
  --
@@ -116,6 +116,23 @@ export declare function getRockPNGPath(): string;
116
116
  * rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
117
117
  */
118
118
  export declare function getSurroundingGridEntities(gridEntity: GridEntity): GridEntity[];
119
+ /**
120
+ * Helper function to get the grid indexes on the surrounding tiles from the provided grid index.
121
+ *
122
+ * There are always 8 grid indexes returned (e.g. top-left + top + top-right + left + right +
123
+ * bottom-left + bottom + right), even if the computed values would be negative or otherwise
124
+ * invalid.
125
+ */
126
+ export declare function getSurroundingGridIndexes(gridIndex: int): [
127
+ topLeft: int,
128
+ top: int,
129
+ topRight: int,
130
+ left: int,
131
+ right: int,
132
+ bottomLeft: int,
133
+ bottom: int,
134
+ bottomRight: int
135
+ ];
119
136
  /**
120
137
  * Helper function to get the top left wall in the current room.
121
138
  *
@@ -149,6 +166,11 @@ export declare function isGridEntityBroken(gridEntity: GridEntity): boolean;
149
166
  * the `PRE_ROOM_ENTITY_SPAWN` callback for narrowing the type of the first argument.
150
167
  */
151
168
  export declare function isGridEntityXMLType(num: number): num is GridEntityXMLType;
169
+ /**
170
+ * Helper function to check if the provided grid index has a door on it or if the surrounding 8 grid
171
+ * indexes have a door on it.
172
+ */
173
+ export declare function isGridIndexAdjacentToDoor(gridIndex: int): boolean;
152
174
  /** Helper function to see if a `GridEntityXMLType` is some kind of poop. */
153
175
  export declare function isPoopGridEntityXMLType(gridEntityXMLType: GridEntityXMLType): boolean;
154
176
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"gridEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/gridEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,8BAA8B,CAAC;AACtE,OAAO,EAIL,cAAc,EAIf,MAAM,8BAA8B,CAAC;AAYtC,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,wBAAwB,CAAC;AAC5D,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AA0C1D;;;;GAIG;AACH,wBAAgB,wBAAwB,CACtC,iBAAiB,EAAE,iBAAiB,EACpC,oBAAoB,EAAE,GAAG,GACxB,CAAC,cAAc,EAAE,GAAG,CAAC,GAAG,SAAS,CAenC;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CACjC,cAAc,EAAE,cAAc,EAC9B,OAAO,SAAK,GACX,OAAO,CAiBT;AAED;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,GAAG,EAAE,CAKzC;AAED;;;;;;;;;GASG;AACH,wBAAgB,kCAAkC,CAChD,UAAU,EAAE,UAAU,GACrB,MAAM,EAAE,CAoBV;AAED,qFAAqF;AACrF,wBAAgB,+BAA+B,CAC7C,YAAY,EAAE,YAAY,GACzB,CAAC,cAAc,EAAE,cAAc,EAAE,OAAO,EAAE,GAAG,CAAC,CAuBhD;AAED;;;;;;;;;;;;;;;;;;;;;;;;;GAyBG;AACH,wBAAgB,eAAe,CAC7B,GAAG,eA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EAAE,CAAC,EAAE,EACjB,UAAU,EAAE,OAAO,EACnB,GAAG,CAAC,EAAE,GAAG,GACR,CAAC,EAAE,CAoBL;AAED;;;;;;;;;;;;;GAaG;AACH,wBAAgB,gBAAgB,CAC9B,qBAAqB,EAAE,UAAU,GAAG,GAAG,EACvC,UAAU,EAAE,OAAO,GAClB,IAAI,CAqCN;AAED;;;;;;GAMG;AACH,wBAAgB,sBAAsB,CAAC,UAAU,EAAE,UAAU,GAAG,IAAI,CAGnE;AAED;;;;;;GAMG;AACH,wBAAgB,iBAAiB,CAC/B,UAAU,EAAE,UAAU,EACtB,cAAc,EAAE,cAAc,GAC7B,IAAI,CAmBN;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,gBAAgB,EAAE,GAAG,GAAG,OAAO,CAwD7D;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAC7B,cAAc,EAAE,cAAc,EAC9B,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAExB;AAED;;;;;;;GAOG;AACH,wBAAgB,0BAA0B,CACxC,cAAc,EAAE,cAAc,EAC9B,OAAO,EAAE,GAAG,EACZ,mBAAmB,EAAE,GAAG,GAAG,MAAM,GAChC,UAAU,GAAG,SAAS,CAgCxB;AAED;;;GAGG;AACH,wBAAgB,eAAe,CAAC,SAAS,EAAE,GAAG,GAAG,UAAU,GAAG,SAAS,CAkBtE"}
@@ -340,6 +340,25 @@ function getRockPNGName(self)
340
340
  end
341
341
  until true
342
342
  end
343
+ --- Helper function to get the grid indexes on the surrounding tiles from the provided grid index.
344
+ --
345
+ -- There are always 8 grid indexes returned (e.g. top-left + top + top-right + left + right +
346
+ -- bottom-left + bottom + right), even if the computed values would be negative or otherwise
347
+ -- invalid.
348
+ function ____exports.getSurroundingGridIndexes(self, gridIndex)
349
+ local room = game:GetRoom()
350
+ local gridWidth = room:GetGridWidth()
351
+ return {
352
+ gridIndex - gridWidth - 1,
353
+ gridIndex - gridWidth,
354
+ gridIndex - gridWidth + 1,
355
+ gridIndex - 1,
356
+ gridIndex + 1,
357
+ gridIndex + gridWidth - 1,
358
+ gridIndex + gridWidth,
359
+ gridIndex + gridWidth + 1
360
+ }
361
+ end
343
362
  --- Helper function to get the grid index of the top left wall. (This will depend on what the current
344
363
  -- room shape is.)
345
364
  --
@@ -683,18 +702,8 @@ end
683
702
  -- rocks (e.g. top-left + top + top-right + left + right + bottom-left + bottom + right).
684
703
  function ____exports.getSurroundingGridEntities(self, gridEntity)
685
704
  local room = game:GetRoom()
686
- local gridWidth = room:GetGridWidth()
687
705
  local gridIndex = gridEntity:GetGridIndex()
688
- local surroundingGridIndexes = {
689
- gridIndex - 1,
690
- gridIndex + 1,
691
- gridIndex - gridWidth - 1,
692
- gridIndex - gridWidth,
693
- gridIndex - gridWidth + 1,
694
- gridIndex + gridWidth - 1,
695
- gridIndex + gridWidth,
696
- gridIndex + gridWidth + 1
697
- }
706
+ local surroundingGridIndexes = ____exports.getSurroundingGridIndexes(nil, gridIndex)
698
707
  local surroundingGridEntities = {}
699
708
  for ____, surroundingGridIndex in ipairs(surroundingGridIndexes) do
700
709
  local surroundingGridEntity = room:GetGridEntity(surroundingGridIndex)
@@ -737,6 +746,26 @@ end
737
746
  function ____exports.isGridEntityXMLType(self, num)
738
747
  return GRID_ENTITY_XML_TYPES_SET:has(num)
739
748
  end
749
+ --- Helper function to check if the provided grid index has a door on it or if the surrounding 8 grid
750
+ -- indexes have a door on it.
751
+ function ____exports.isGridIndexAdjacentToDoor(self, gridIndex)
752
+ local room = game:GetRoom()
753
+ local surroundingGridIndexes = ____exports.getSurroundingGridIndexes(nil, gridIndex)
754
+ local gridIndexes = {
755
+ gridIndex,
756
+ table.unpack(surroundingGridIndexes)
757
+ }
758
+ for ____, gridIndexToInspect in ipairs(gridIndexes) do
759
+ local gridEntity = room:GetGridEntity(gridIndexToInspect)
760
+ if gridEntity ~= nil then
761
+ local door = gridEntity:ToDoor()
762
+ if door ~= nil then
763
+ return true
764
+ end
765
+ end
766
+ end
767
+ return false
768
+ end
740
769
  --- Helper function to see if a `GridEntityXMLType` is some kind of poop.
741
770
  function ____exports.isPoopGridEntityXMLType(self, gridEntityXMLType)
742
771
  return POOP_GRID_ENTITY_XML_TYPES_SET:has(gridEntityXMLType)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "59.5.0",
3
+ "version": "59.7.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -22,6 +22,7 @@ import { StageTravelState } from "../../../enums/private/StageTravelState";
22
22
  import { TrapdoorAnimation } from "../../../enums/private/TrapdoorAnimation";
23
23
  import { easeOutSine } from "../../../functions/easing";
24
24
  import {
25
+ isBeforeRenderFrame,
25
26
  isPastRoomFrame,
26
27
  onOrPastRenderFrame,
27
28
  } from "../../../functions/frames";
@@ -224,7 +225,7 @@ export class CustomTrapdoors extends Feature {
224
225
 
225
226
  const renderFrameScreenBlack =
226
227
  v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES;
227
- if (!onOrPastRenderFrame(renderFrameScreenBlack)) {
228
+ if (isBeforeRenderFrame(renderFrameScreenBlack)) {
228
229
  return;
229
230
  }
230
231
 
@@ -317,7 +318,7 @@ export class CustomTrapdoors extends Feature {
317
318
 
318
319
  const renderFrameScreenBlack =
319
320
  v.run.stateRenderFrame + PIXELATION_TO_BLACK_FRAMES;
320
- if (!onOrPastRenderFrame(renderFrameScreenBlack)) {
321
+ if (isBeforeRenderFrame(renderFrameScreenBlack)) {
321
322
  return;
322
323
  }
323
324
 
@@ -7,7 +7,7 @@ import { game } from "../../../core/cachedClasses";
7
7
  import { Exported } from "../../../decorators";
8
8
  import { ISCFeature } from "../../../enums/ISCFeature";
9
9
  import { getEntityID } from "../../../functions/entities";
10
- import { isPastRoomFrame } from "../../../functions/frames";
10
+ import { onOrBeforeRoomFrame } from "../../../functions/frames";
11
11
  import { getRoomListIndex } from "../../../functions/roomData";
12
12
  import { onAscent } from "../../../functions/stage";
13
13
  import { vectorEquals } from "../../../functions/vector";
@@ -97,7 +97,7 @@ export class PickupIndexCreation extends Feature {
97
97
  if (
98
98
  pickupIndexFromLevelData !== undefined &&
99
99
  !isFirstVisit &&
100
- !isPastRoomFrame(0)
100
+ onOrBeforeRoomFrame(0)
101
101
  ) {
102
102
  v.room.pickupIndexes.set(ptrHash, pickupIndexFromLevelData);
103
103
  return;
@@ -16,6 +16,59 @@ export function getElapsedRoomFramesSince(roomFrameCount: int): int {
16
16
  return thisRoomFrameCount - roomFrameCount;
17
17
  }
18
18
 
19
+ /**
20
+ * Helper function to check if the current game frame count is lower than a specific game frame
21
+ * count.
22
+ *
23
+ * This returns false if the submitted game frame count is null or undefined.
24
+ */
25
+ export function isBeforeGameFrame(
26
+ gameFrameCount: int | null | undefined,
27
+ ): boolean {
28
+ if (gameFrameCount === null || gameFrameCount === undefined) {
29
+ return false;
30
+ }
31
+
32
+ const thisGameFrameCount = game.GetFrameCount();
33
+ return thisGameFrameCount < gameFrameCount;
34
+ }
35
+
36
+ /**
37
+ * Helper function to check if the current render frame count is lower than a specific render frame
38
+ * count.
39
+ *
40
+ * This returns false if the submitted render frame count is null or undefined.
41
+ */
42
+ export function isBeforeRenderFrame(
43
+ renderFrameCount: int | null | undefined,
44
+ ): boolean {
45
+ if (renderFrameCount === null || renderFrameCount === undefined) {
46
+ return false;
47
+ }
48
+
49
+ const thisRenderFrameCount = Isaac.GetFrameCount();
50
+ return thisRenderFrameCount < renderFrameCount;
51
+ }
52
+
53
+ /**
54
+ * Helper function to check if the current room frame count is lower than a specific room frame
55
+ * count.
56
+ *
57
+ * This returns false if the submitted room frame count is null or undefined.
58
+ */
59
+ export function isBeforeRoomFrame(
60
+ roomFrameCount: int | null | undefined,
61
+ ): boolean {
62
+ if (roomFrameCount === null || roomFrameCount === undefined) {
63
+ return false;
64
+ }
65
+
66
+ const room = game.GetRoom();
67
+
68
+ const thisGameFrameCount = room.GetFrameCount();
69
+ return thisGameFrameCount < roomFrameCount;
70
+ }
71
+
19
72
  /**
20
73
  * Helper function to check if the current game frame count is higher than a specific game frame
21
74
  * count.
@@ -47,7 +100,7 @@ export function isPastRenderFrame(
47
100
  }
48
101
 
49
102
  const thisRenderFrameCount = Isaac.GetFrameCount();
50
- return thisRenderFrameCount >= renderFrameCount;
103
+ return thisRenderFrameCount > renderFrameCount;
51
104
  }
52
105
 
53
106
  /**
@@ -84,6 +137,59 @@ export function onGameFrame(gameFrameCount: int | null | undefined): boolean {
84
137
  return thisGameFrameCount === gameFrameCount;
85
138
  }
86
139
 
140
+ /**
141
+ * Helper function to check if the current game frame count is equal to or lower than a specific
142
+ * game frame count.
143
+ *
144
+ * This returns false if the submitted game frame count is null or undefined.
145
+ */
146
+ export function onOrBeforeGameFrame(
147
+ gameFrameCount: int | null | undefined,
148
+ ): boolean {
149
+ if (gameFrameCount === null || gameFrameCount === undefined) {
150
+ return false;
151
+ }
152
+
153
+ const thisGameFrameCount = game.GetFrameCount();
154
+ return thisGameFrameCount <= gameFrameCount;
155
+ }
156
+
157
+ /**
158
+ * Helper function to check if the current render frame count is equal to or lower than a specific
159
+ * render frame count.
160
+ *
161
+ * This returns false if the submitted render frame count is null or undefined.
162
+ */
163
+ export function onOrBeforeRenderFrame(
164
+ renderFrameCount: int | null | undefined,
165
+ ): boolean {
166
+ if (renderFrameCount === null || renderFrameCount === undefined) {
167
+ return false;
168
+ }
169
+
170
+ const thisRenderFrameCount = Isaac.GetFrameCount();
171
+ return thisRenderFrameCount <= renderFrameCount;
172
+ }
173
+
174
+ /**
175
+ * Helper function to check if the current room frame count is equal to or lower than a specific
176
+ * room frame count.
177
+ *
178
+ * This returns false if the submitted room frame count is null or undefined.
179
+ */
180
+ export function onOrBeforeRoomFrame(
181
+ roomFrameCount: int | null | undefined,
182
+ ): boolean {
183
+ if (roomFrameCount === null || roomFrameCount === undefined) {
184
+ return false;
185
+ }
186
+
187
+ const room = game.GetRoom();
188
+
189
+ const thisGameFrameCount = room.GetFrameCount();
190
+ return thisGameFrameCount >= roomFrameCount;
191
+ }
192
+
87
193
  /**
88
194
  * Helper function to check if the current game frame count is equal to or higher than a specific
89
195
  * game frame count.
@@ -690,21 +690,9 @@ export function getSurroundingGridEntities(
690
690
  gridEntity: GridEntity,
691
691
  ): GridEntity[] {
692
692
  const room = game.GetRoom();
693
- const gridWidth = room.GetGridWidth();
694
693
  const gridIndex = gridEntity.GetGridIndex();
695
694
 
696
- const surroundingGridIndexes: int[] = [
697
- gridIndex - 1, // Left
698
- gridIndex + 1, // Right
699
-
700
- gridIndex - gridWidth - 1, // Top-left
701
- gridIndex - gridWidth, // Top
702
- gridIndex - gridWidth + 1, // Top-right
703
-
704
- gridIndex + gridWidth - 1, // Bottom-left
705
- gridIndex + gridWidth, // Bottom
706
- gridIndex + gridWidth + 1, // Bottom-right
707
- ];
695
+ const surroundingGridIndexes = getSurroundingGridIndexes(gridIndex);
708
696
 
709
697
  const surroundingGridEntities: GridEntity[] = [];
710
698
  for (const surroundingGridIndex of surroundingGridIndexes) {
@@ -717,6 +705,42 @@ export function getSurroundingGridEntities(
717
705
  return surroundingGridEntities;
718
706
  }
719
707
 
708
+ /**
709
+ * Helper function to get the grid indexes on the surrounding tiles from the provided grid index.
710
+ *
711
+ * There are always 8 grid indexes returned (e.g. top-left + top + top-right + left + right +
712
+ * bottom-left + bottom + right), even if the computed values would be negative or otherwise
713
+ * invalid.
714
+ */
715
+ export function getSurroundingGridIndexes(
716
+ gridIndex: int,
717
+ ): [
718
+ topLeft: int,
719
+ top: int,
720
+ topRight: int,
721
+ left: int,
722
+ right: int,
723
+ bottomLeft: int,
724
+ bottom: int,
725
+ bottomRight: int,
726
+ ] {
727
+ const room = game.GetRoom();
728
+ const gridWidth = room.GetGridWidth();
729
+
730
+ return [
731
+ gridIndex - gridWidth - 1, // Top-left
732
+ gridIndex - gridWidth, // Top
733
+ gridIndex - gridWidth + 1, // Top-right
734
+
735
+ gridIndex - 1, // Left
736
+ gridIndex + 1, // Right
737
+
738
+ gridIndex + gridWidth - 1, // Bottom-left
739
+ gridIndex + gridWidth, // Bottom
740
+ gridIndex + gridWidth + 1, // Bottom-right
741
+ ];
742
+ }
743
+
720
744
  /**
721
745
  * Helper function to get the top left wall in the current room.
722
746
  *
@@ -785,6 +809,28 @@ export function isGridEntityXMLType(num: number): num is GridEntityXMLType {
785
809
  return GRID_ENTITY_XML_TYPES_SET.has(num); // eslint-disable-line isaacscript/strict-enums
786
810
  }
787
811
 
812
+ /**
813
+ * Helper function to check if the provided grid index has a door on it or if the surrounding 8 grid
814
+ * indexes have a door on it.
815
+ */
816
+ export function isGridIndexAdjacentToDoor(gridIndex: int): boolean {
817
+ const room = game.GetRoom();
818
+ const surroundingGridIndexes = getSurroundingGridIndexes(gridIndex);
819
+ const gridIndexes = [gridIndex, ...surroundingGridIndexes];
820
+
821
+ for (const gridIndexToInspect of gridIndexes) {
822
+ const gridEntity = room.GetGridEntity(gridIndexToInspect);
823
+ if (gridEntity !== undefined) {
824
+ const door = gridEntity.ToDoor();
825
+ if (door !== undefined) {
826
+ return true;
827
+ }
828
+ }
829
+ }
830
+
831
+ return false;
832
+ }
833
+
788
834
  /** Helper function to see if a `GridEntityXMLType` is some kind of poop. */
789
835
  export function isPoopGridEntityXMLType(
790
836
  gridEntityXMLType: GridEntityXMLType,