isaacscript-common 1.2.87 → 1.2.90

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.
@@ -19,16 +19,16 @@ export declare function fireProjectiles(npc: EntityNPC, position: Vector, veloci
19
19
  * This function will not include bosses on an internal blacklist, such as Death's scythes or Big
20
20
  * Horn holes.
21
21
  */
22
- export declare function getAliveBosses(): EntityNPC[];
22
+ export declare function getAliveBosses(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
23
23
  /**
24
24
  * Helper function to get all of the non-dead NPCs in the room.
25
25
  *
26
26
  * This function will not include NPCs on an internal blacklist, such as Death's scythes or Big Horn
27
27
  * holes.
28
28
  */
29
- export declare function getAliveNPCs(): EntityNPC[];
29
+ export declare function getAliveNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
30
30
  /** Helper function to get all of the bosses in the room. */
31
- export declare function getBosses(): EntityNPC[];
31
+ export declare function getBosses(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
32
32
  /** The same thing as the `getEntities()` function, but returns only NPCs. */
33
33
  export declare function getNPCs(matchingEntityType?: EntityType | int, matchingVariant?: int, matchingSubType?: int, ignoreFriendly?: boolean): EntityNPC[];
34
34
  /**
@@ -14,8 +14,17 @@ local getFilteredNewEntities = ____entity.getFilteredNewEntities
14
14
  local removeEntities = ____entity.removeEntities
15
15
  local ____entitySpecific = require("functions.entitySpecific")
16
16
  local getProjectiles = ____entitySpecific.getProjectiles
17
- function ____exports.getAliveNPCs(self)
18
- local npcs = ____exports.getNPCs(nil)
17
+ function ____exports.getAliveNPCs(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
18
+ if ignoreFriendly == nil then
19
+ ignoreFriendly = false
20
+ end
21
+ local npcs = ____exports.getNPCs(
22
+ nil,
23
+ matchingEntityType,
24
+ matchingVariant,
25
+ matchingSubType,
26
+ ignoreFriendly
27
+ )
19
28
  return __TS__ArrayFilter(
20
29
  npcs,
21
30
  function(____, npc) return not npc:IsDead() and not ____exports.isAliveExceptionNPC(nil, npc) end
@@ -99,15 +108,33 @@ function ____exports.fireProjectiles(self, npc, position, velocity, projectilesM
99
108
  local newProjectiles = getProjectiles(nil, projectileParams.Variant)
100
109
  return getFilteredNewEntities(nil, oldProjectiles, newProjectiles)
101
110
  end
102
- function ____exports.getAliveBosses(self)
103
- local aliveNPCs = ____exports.getAliveNPCs(nil)
111
+ function ____exports.getAliveBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
112
+ if ignoreFriendly == nil then
113
+ ignoreFriendly = false
114
+ end
115
+ local aliveNPCs = ____exports.getAliveNPCs(
116
+ nil,
117
+ matchingEntityType,
118
+ matchingVariant,
119
+ matchingSubType,
120
+ ignoreFriendly
121
+ )
104
122
  return __TS__ArrayFilter(
105
123
  aliveNPCs,
106
124
  function(____, aliveNPC) return aliveNPC:IsBoss() end
107
125
  )
108
126
  end
109
- function ____exports.getBosses(self)
110
- local npcs = ____exports.getNPCs(nil)
127
+ function ____exports.getBosses(self, matchingEntityType, matchingVariant, matchingSubType, ignoreFriendly)
128
+ if ignoreFriendly == nil then
129
+ ignoreFriendly = false
130
+ end
131
+ local npcs = ____exports.getNPCs(
132
+ nil,
133
+ matchingEntityType,
134
+ matchingVariant,
135
+ matchingSubType,
136
+ ignoreFriendly
137
+ )
111
138
  return __TS__ArrayFilter(
112
139
  npcs,
113
140
  function(____, npc) return npc:IsBoss() end
@@ -147,8 +147,8 @@ export declare function inBeastRoom(): boolean;
147
147
  export declare function inBossRoomOf(bossID: BossID): boolean;
148
148
  /**
149
149
  * Helper function for determining whether the current room is a crawlspace. Use this function over
150
- * comparing to `GridRooms.ROOM_DUNGEON_IDX` directly since there is a special case of the player
151
- * being in The Beast room.
150
+ * comparing to `RoomType.ROOM_DUNGEON` or `GridRooms.ROOM_DUNGEON_IDX` since there is a special
151
+ * case of the player being in a boss fight that take place in a dungeon.
152
152
  */
153
153
  export declare function inCrawlspace(): boolean;
154
154
  /**
@@ -171,6 +171,14 @@ export declare function inGenesisRoom(): boolean;
171
171
  * will only work for minibosses that have dedicated boss rooms in the "00.special rooms.stb" file.
172
172
  */
173
173
  export declare function inMinibossRoomOf(minibossID: MinibossID): boolean;
174
+ /**
175
+ * Helper function for checking if the room room is a secret shop from the Member Card collectible.
176
+ *
177
+ * Secret shops are simply copies of normal shops but with the backdrop of a secret room. In other
178
+ * words, they will have the same room type, room variant, and room sub-type of a normal shop. Thus,
179
+ * the only way to detect them is by using the grid index.
180
+ */
181
+ export declare function inSecretShop(): boolean;
174
182
  /**
175
183
  * Helper function to determine whether or not the current room is the starting room of a floor.
176
184
  * Only returns true for the starting room of the primary dimension (meaning that being in the
@@ -92,7 +92,7 @@ end
92
92
  function ____exports.inDeathCertificateArea(self)
93
93
  local roomStageID = ____exports.getRoomStageID(nil)
94
94
  local roomSubType = ____exports.getRoomSubType(nil)
95
- return roomStageID == 35 and (roomSubType == 33 or roomSubType == 33)
95
+ return roomStageID == 35 and (roomSubType == 33 or roomSubType == 34)
96
96
  end
97
97
  function ____exports.changeRoom(self, roomGridIndex)
98
98
  local game = Game()
@@ -195,9 +195,11 @@ function ____exports.inAngelShop(self)
195
195
  return roomType == RoomType.ROOM_ANGEL and roomSubType == 1
196
196
  end
197
197
  function ____exports.inBeastRoom(self)
198
- local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
198
+ local game = Game()
199
+ local room = game:GetRoom()
200
+ local roomType = room:GetType()
199
201
  local roomSubType = ____exports.getRoomSubType(nil)
200
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType == 4
202
+ return roomType == RoomType.ROOM_DUNGEON and roomSubType == 4
201
203
  end
202
204
  function ____exports.inBossRoomOf(self, bossID)
203
205
  local game = Game()
@@ -208,9 +210,11 @@ function ____exports.inBossRoomOf(self, bossID)
208
210
  return roomType == RoomType.ROOM_BOSS and roomStageID == 0 and roomSubType == bossID
209
211
  end
210
212
  function ____exports.inCrawlspace(self)
211
- local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
213
+ local game = Game()
214
+ local room = game:GetRoom()
215
+ local roomType = room:GetType()
212
216
  local roomSubType = ____exports.getRoomSubType(nil)
213
- return roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX and roomSubType ~= 4
217
+ return roomType == RoomType.ROOM_DUNGEON and roomSubType ~= 4
214
218
  end
215
219
  function ____exports.inDevilsCrownTreasureRoom(self)
216
220
  local roomDescriptor = ____exports.getCurrentRoomDescriptorReadOnly(nil)
@@ -241,6 +245,9 @@ function ____exports.inMinibossRoomOf(self, minibossID)
241
245
  local roomSubType = ____exports.getRoomSubType(nil)
242
246
  return roomType == RoomType.ROOM_MINIBOSS and roomStageID == 0 and roomSubType == minibossID
243
247
  end
248
+ function ____exports.inSecretShop(self)
249
+ return ____exports.getRoomSafeGridIndex(nil) == GridRooms.ROOM_SECRET_SHOP_IDX
250
+ end
244
251
  function ____exports.inStartingRoom(self)
245
252
  local game = Game()
246
253
  local level = game:GetLevel()
@@ -298,12 +305,12 @@ function ____exports.setRoomCleared(self)
298
305
  for ____, door in ipairs(getDoors(nil)) do
299
306
  do
300
307
  if isHiddenSecretRoomDoor(nil, door) then
301
- goto __continue56
308
+ goto __continue57
302
309
  end
303
310
  openDoorFast(nil, door)
304
311
  door.ExtraVisible = false
305
312
  end
306
- ::__continue56::
313
+ ::__continue57::
307
314
  end
308
315
  sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
309
316
  game:ShakeScreen(0)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.87",
3
+ "version": "1.2.90",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -26,7 +26,7 @@
26
26
  ],
27
27
  "devDependencies": {
28
28
  "@zamiell/typescript-to-lua": "^1.4.0",
29
- "isaac-typescript-definitions": "^1.0.354",
29
+ "isaac-typescript-definitions": "^1.0.355",
30
30
  "isaacscript-lint": "^1.0.81",
31
31
  "isaacscript-tsconfig": "^1.1.8",
32
32
  "typedoc": "^0.22.12",