isaacscript-common 1.0.492 → 1.0.496

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,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostBombInitLateCallbackType = (bomb: EntityBomb) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostBombInitLateCallbackType, bombVariant?: BombVariant): void;
4
+ export declare function register(callback: PostBombInitLateCallbackType, bombVariant?: BombVariant | int): void;
5
5
  export declare function fire(bomb: EntityBomb): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostFamiliarInitLateCallbackType = (familiar: EntityFamiliar) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostFamiliarInitLateCallbackType, familiarVariant?: FamiliarVariant): void;
4
+ export declare function register(callback: PostFamiliarInitLateCallbackType, familiarVariant?: FamiliarVariant | int): void;
5
5
  export declare function fire(familiar: EntityFamiliar): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostKnifeInitLateCallbackType = (knife: EntityKnife) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostKnifeInitLateCallbackType, knifeVariant?: KnifeVariant): void;
4
+ export declare function register(callback: PostKnifeInitLateCallbackType, knifeVariant?: KnifeVariant | int): void;
5
5
  export declare function fire(knife: EntityKnife): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostLaserInitLateCallbackType = (laser: EntityLaser) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostLaserInitLateCallbackType, laserVariant?: LaserVariant): void;
4
+ export declare function register(callback: PostLaserInitLateCallbackType, laserVariant?: LaserVariant | int): void;
5
5
  export declare function fire(laser: EntityLaser): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostPickupCollectCallbackType = (pickup: EntityPickup, player: EntityPlayer) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostPickupCollectCallbackType, pickupVariant?: PickupVariant): void;
4
+ export declare function register(callback: PostPickupCollectCallbackType, pickupVariant?: PickupVariant | int): void;
5
5
  export declare function fire(pickup: EntityPickup, player: EntityPlayer): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostPickupInitLateCallbackType = (pickup: EntityPickup) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostPickupInitLateCallbackType, pickupVariant?: PickupVariant): void;
4
+ export declare function register(callback: PostPickupInitLateCallbackType, pickupVariant?: PickupVariant | int): void;
5
5
  export declare function fire(pickup: EntityPickup): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostProjectileInitLateCallbackType = (projectile: EntityProjectile) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostProjectileInitLateCallbackType, projectileVariant?: ProjectileVariant): void;
4
+ export declare function register(callback: PostProjectileInitLateCallbackType, projectileVariant?: ProjectileVariant | int): void;
5
5
  export declare function fire(projectile: EntityProjectile): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- export declare type PostPurchaseCallbackType = (player: EntityPlayer, pickupVariant: PickupVariant, pickupSubType: int, pickupPrice: int) => void;
2
+ export declare type PostPurchaseCallbackType = (player: EntityPlayer, pickupVariant: PickupVariant | int, pickupSubType: int, pickupPrice: int) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostPurchaseCallbackType, pickupVariant?: PickupVariant, pickupSubType?: int): void;
5
- export declare function fire(player: EntityPlayer, pickupVariant: PickupVariant, pickupSubType: int, pickupPrice: int): void;
4
+ export declare function register(callback: PostPurchaseCallbackType, pickupVariant?: PickupVariant | int, pickupSubType?: int): void;
5
+ export declare function fire(player: EntityPlayer, pickupVariant: PickupVariant | int, pickupSubType: int, pickupPrice: int): void;
@@ -1,5 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare type PostTearInitLateCallbackType = (tear: EntityTear) => void;
3
3
  export declare function hasSubscriptions(): boolean;
4
- export declare function register(callback: PostTearInitLateCallbackType, tearVariant?: TearVariant): void;
4
+ export declare function register(callback: PostTearInitLateCallbackType, tearVariant?: TearVariant | int): void;
5
5
  export declare function fire(tear: EntityTear): void;
@@ -9,14 +9,24 @@ export declare const BOMB_EXPLODE_FRAME = 45;
9
9
  export declare const CHARACTERS_WITH_AN_ACTIVE_ITEM: Set<PlayerType>;
10
10
  /**
11
11
  * The set of characters where red heart containers will be turned into soul hearts (e.g. Blue
12
- * Baby). This set includes The Lost and Tainted Lost.
12
+ * Baby). This includes The Lost and Tainted Lost. This does not include Keeper or Tainted Keeper.
13
13
  */
14
14
  export declare const CHARACTERS_WITH_NO_RED_HEARTS: Set<PlayerType>;
15
15
  /**
16
16
  * The set of characters where soul hearts will be automatically stripped away (e.g. Bethany). This
17
- * set includes The Lost and Tainted Lost.
17
+ * includes The Lost and Tainted Lost.
18
18
  */
19
19
  export declare const CHARACTERS_WITH_NO_SOUL_HEARTS: Set<PlayerType>;
20
+ export declare const COLORS: {
21
+ BLACK: Color;
22
+ RED: Color;
23
+ GREEN: Color;
24
+ BLUE: Color;
25
+ YELLOW: Color;
26
+ PINK: Color;
27
+ CYAN: Color;
28
+ WHITE: Color;
29
+ };
20
30
  export declare const DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE;
21
31
  /** This is also the distance that a player spawns from the door that they enter a room from. */
22
32
  export declare const DISTANCE_OF_GRID_TILE = 40;
@@ -27,6 +37,8 @@ export declare const DOOR_HITBOX_DISTANCE = 11;
27
37
  * value.
28
38
  */
29
39
  export declare const EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45;
40
+ /** As of Repentance, the final stage is floor 13 (which is the Home floor). */
41
+ export declare const FINAL_STAGE: number;
30
42
  /**
31
43
  * The random items that appear when the player has TMTRAINER are generated on the fly as they are
32
44
  * encountered by the player. The first TMTRAINER item takes the final possible 32 bit number. The
@@ -26,11 +26,28 @@ ____exports.CHARACTERS_WITH_NO_RED_HEARTS = __TS__New(Set, {
26
26
  PlayerType.PLAYER_THEFORGOTTEN_B,
27
27
  PlayerType.PLAYER_BETHANY_B
28
28
  })
29
- ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {PlayerType.PLAYER_THELOST, PlayerType.PLAYER_BETHANY, PlayerType.PLAYER_THELOST_B})
29
+ ____exports.CHARACTERS_WITH_NO_SOUL_HEARTS = __TS__New(Set, {
30
+ PlayerType.PLAYER_THELOST,
31
+ PlayerType.PLAYER_KEEPER,
32
+ PlayerType.PLAYER_BETHANY,
33
+ PlayerType.PLAYER_THELOST_B,
34
+ PlayerType.PLAYER_KEEPER_B
35
+ })
36
+ ____exports.COLORS = {
37
+ BLACK = Color(1, 1, 1),
38
+ RED = Color(1, 0, 0),
39
+ GREEN = Color(0, 1, 0),
40
+ BLUE = Color(0, 0, 1),
41
+ YELLOW = Color(1, 1, 0),
42
+ PINK = Color(1, 0, 1),
43
+ CYAN = Color(0, 1, 1),
44
+ WHITE = Color(1, 1, 1)
45
+ }
30
46
  ____exports.DEFAULT_ITEM_POOL_TYPE = ItemPoolType.POOL_TREASURE
31
47
  ____exports.DISTANCE_OF_GRID_TILE = 40
32
48
  ____exports.DOOR_HITBOX_DISTANCE = 11
33
49
  ____exports.EGGY_STATE_FRAME_OF_FINAL_SPIDER = 45
50
+ ____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
34
51
  ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
35
52
  ____exports.GENESIS_ROOM_VARIANT = 1000
36
53
  ____exports.GENESIS_ROOM_SUBTYPE = 99
@@ -56,7 +56,14 @@ export declare function isGlitchedCollectible(entity: Entity): boolean;
56
56
  */
57
57
  export declare function isPassiveCollectible(collectibleType: CollectibleType | int): boolean;
58
58
  export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
59
- export declare function removeAllCollectibles(): void;
59
+ /**
60
+ * Helper function to remove all of the collectibles in the room.
61
+ *
62
+ * @param collectibleType Optional. If specified, will only remove collectibles that match this
63
+ * collectible type.
64
+ * @param cap Optional. If specified, will only remove the given amount of collectibles.
65
+ */
66
+ export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): void;
60
67
  /**
61
68
  * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
62
69
  * frame delay before they can be picked up by a player.
@@ -7,7 +7,7 @@ local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DE
7
7
  local ____collectibleNameMap = require("maps.collectibleNameMap")
8
8
  local COLLECTIBLE_NAME_MAP = ____collectibleNameMap.COLLECTIBLE_NAME_MAP
9
9
  local ____entity = require("functions.entity")
10
- local removeAllMatchingEntities = ____entity.removeAllMatchingEntities
10
+ local removeAllPickups = ____entity.removeAllPickups
11
11
  function ____exports.setCollectibleSprite(self, collectible, pngPath)
12
12
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
13
13
  error("You cannot set a collectible sprite for pickups of variant: " .. tostring(collectible.Variant))
@@ -136,8 +136,8 @@ end
136
136
  function ____exports.isQuestCollectible(self, collectibleType)
137
137
  return ____exports.collectibleHasTag(nil, collectibleType, 32768)
138
138
  end
139
- function ____exports.removeAllCollectibles(self)
140
- removeAllMatchingEntities(nil, EntityType.ENTITY_PICKUP, PickupVariant.PICKUP_COLLECTIBLE)
139
+ function ____exports.removeAllCollectibles(self, collectibleType, cap)
140
+ removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
141
141
  end
142
142
  function ____exports.removeCollectiblePickupDelay(self, collectible)
143
143
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
@@ -152,17 +152,88 @@ export declare function getSlots(matchingVariant?: number, matchingSubType?: num
152
152
  * ```
153
153
  */
154
154
  export declare function getTears(matchingVariant?: number, matchingSubType?: number): EntityTear[];
155
- /** Removes all of the entities in the supplied array. */
156
- export declare function removeEntities(entities: Entity[]): void;
157
- export declare function removeAllBombs(): void;
158
- export declare function removeAllEffects(): void;
159
- export declare function removeAllFamiliars(): void;
160
- export declare function removeAllKnives(): void;
161
- export declare function removeAllLasers(): void;
162
- export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number): void;
163
- export declare function removeAllPickups(): void;
164
- export declare function removeAllProjectiles(): void;
165
- export declare function removeAllTears(): void;
155
+ /**
156
+ * Helper function to remove all of the entities in the supplied array.
157
+ *
158
+ * @param entities The array of entities to remove.
159
+ * @param cap Optional. If specified, will only remove the given amount of entities.
160
+ */
161
+ export declare function removeEntities(entities: Entity[], cap?: int): void;
162
+ /**
163
+ * Helper function to remove all of the bombs in the room.
164
+ *
165
+ * @param variant Optional. If specified, will only remove bombs that match this variant.
166
+ * @param subType Optional. If specified, will only remove bombs that match this sub-type.
167
+ * @param cap Optional. If specified, will only remove the given amount of bombs.
168
+ */
169
+ export declare function removeAllBombs(variant?: BombVariant | int, subType?: int, cap?: int): void;
170
+ /**
171
+ * Helper function to remove all of the effects in the room.
172
+ *
173
+ * @param variant Optional. If specified, will only remove effects that match this variant.
174
+ * @param subType Optional. If specified, will only remove effects that match this sub-type.
175
+ * @param cap Optional. If specified, will only remove the given amount of effects.
176
+ */
177
+ export declare function removeAllEffects(variant?: EffectVariant, subType?: int, cap?: int): void;
178
+ /**
179
+ * Helper function to remove all of the familiars in the room.
180
+ *
181
+ * @param variant Optional. If specified, will only remove familiars that match this variant.
182
+ * @param subType Optional. If specified, will only remove familiars that match this sub-type.
183
+ * @param cap Optional. If specified, will only remove the given amount of familiars.
184
+ */
185
+ export declare function removeAllFamiliars(variant?: FamiliarVariant | int, subType?: int, cap?: int): void;
186
+ /**
187
+ * Helper function to remove all of the knives in the room.
188
+ *
189
+ * @param variant Optional. If specified, will only remove knives that match this variant.
190
+ * @param subType Optional. If specified, will only remove knives that match this sub-type.
191
+ * @param cap Optional. If specified, will only remove the given amount of knives.
192
+ */
193
+ export declare function removeAllKnives(variant?: KnifeVariant | int, subType?: int, cap?: int): void;
194
+ /**
195
+ * Helper function to remove all of the lasers in the room.
196
+ *
197
+ * @param variant Optional. If specified, will only remove lasers that match this variant.
198
+ * @param subType Optional. If specified, will only remove lasers that match this sub-type.
199
+ * @param cap Optional. If specified, will only remove the given amount of lasers.
200
+ */
201
+ export declare function removeAllLasers(variant?: LaserVariant | int, subType?: int, cap?: int): void;
202
+ /**
203
+ * Helper function to remove all of the matching entities in the room.
204
+ *
205
+ * @param entityType The entity type to match.
206
+ * @param entityVariant Optional. The variant to match. -1 by default (which will match every
207
+ * variant).
208
+ * @param entitySubType Optional. The sub-type to match. -1 by default (which will match every
209
+ * sub-type).
210
+ * @param cap Optional. If specified, will only remove the given amount of collectibles.
211
+ */
212
+ export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): void;
213
+ /**
214
+ * Helper function to remove all of the pickups in the room.
215
+ *
216
+ * @param variant Optional. If specified, will only remove pickups that match this variant.
217
+ * @param subType Optional. If specified, will only remove pickups that match this sub-type.
218
+ * @param cap Optional. If specified, will only remove the given amount of pickups.
219
+ */
220
+ export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): void;
221
+ /**
222
+ * Helper function to remove all of the projectiles in the room.
223
+ *
224
+ * @param variant Optional. If specified, will only remove projectiles that match this variant.
225
+ * @param subType Optional. If specified, will only remove projectiles that match this sub-type.
226
+ * @param cap Optional. If specified, will only remove the given amount of projectiles.
227
+ */
228
+ export declare function removeAllProjectiles(variant?: ProjectileVariant | int, subType?: int, cap?: int): void;
229
+ /**
230
+ * Helper function to remove all of the tears in the room.
231
+ *
232
+ * @param variant Optional. If specified, will only remove tears that match this variant.
233
+ * @param subType Optional. If specified, will only remove tears that match this sub-type.
234
+ * @param cap Optional. If specified, will only remove the given amount of tears.
235
+ */
236
+ export declare function removeAllTears(variant?: TearVariant | int, subType?: int, cap?: int): void;
166
237
  /**
167
238
  * Helper function to set the position of every entity in the room based on a map of positions. If
168
239
  * an entity is found that does not have matching element in the provided map, then that entity will
@@ -210,68 +210,65 @@ function ____exports.getTears(self, matchingVariant, matchingSubType)
210
210
  end
211
211
  return tears
212
212
  end
213
- function ____exports.removeEntities(self, entities)
214
- for ____, entity in ipairs(entities) do
215
- entity:Remove()
213
+ function ____exports.removeEntities(self, entities, cap)
214
+ local numEntitiesRemoved = 0
215
+ do
216
+ local i = 0
217
+ while i < #entities do
218
+ local entity = entities[i + 1]
219
+ entity:Remove()
220
+ numEntitiesRemoved = numEntitiesRemoved + 1
221
+ if cap ~= nil and numEntitiesRemoved >= cap then
222
+ return
223
+ end
224
+ i = i + 1
225
+ end
216
226
  end
217
227
  end
218
- function ____exports.removeAllBombs(self)
219
- local bombs = ____exports.getBombs(nil)
220
- for ____, bomb in ipairs(bombs) do
221
- bomb:Remove()
222
- end
228
+ function ____exports.removeAllBombs(self, variant, subType, cap)
229
+ local bombs = ____exports.getBombs(nil, variant, subType)
230
+ ____exports.removeEntities(nil, bombs, cap)
223
231
  end
224
- function ____exports.removeAllEffects(self)
225
- local effects = ____exports.getEffects(nil)
226
- for ____, effect in ipairs(effects) do
227
- effect:Remove()
228
- end
232
+ function ____exports.removeAllEffects(self, variant, subType, cap)
233
+ local effects = ____exports.getEffects(nil, variant, subType)
234
+ ____exports.removeEntities(nil, effects, cap)
229
235
  end
230
- function ____exports.removeAllFamiliars(self)
231
- local familiars = ____exports.getFamiliars(nil)
232
- for ____, familiar in ipairs(familiars) do
233
- familiar:Remove()
234
- end
236
+ function ____exports.removeAllFamiliars(self, variant, subType, cap)
237
+ local familiars = ____exports.getFamiliars(nil, variant, subType)
238
+ ____exports.removeEntities(nil, familiars, cap)
235
239
  end
236
- function ____exports.removeAllKnives(self)
237
- local knives = ____exports.getKnives(nil)
238
- for ____, knife in ipairs(knives) do
239
- knife:Remove()
240
- end
240
+ function ____exports.removeAllKnives(self, variant, subType, cap)
241
+ local knives = ____exports.getKnives(nil, variant, subType)
242
+ ____exports.removeEntities(nil, knives, cap)
241
243
  end
242
- function ____exports.removeAllLasers(self)
243
- local lasers = ____exports.getLasers(nil)
244
- for ____, laser in ipairs(lasers) do
245
- laser:Remove()
246
- end
244
+ function ____exports.removeAllLasers(self, variant, subType, cap)
245
+ local lasers = ____exports.getLasers(nil, variant, subType)
246
+ ____exports.removeEntities(nil, lasers, cap)
247
247
  end
248
- function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType)
248
+ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
249
249
  if entityVariant == nil then
250
250
  entityVariant = -1
251
251
  end
252
252
  if entitySubType == nil then
253
253
  entitySubType = -1
254
254
  end
255
+ if cap == nil then
256
+ cap = nil
257
+ end
255
258
  local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
256
- ____exports.removeEntities(nil, entities)
259
+ ____exports.removeEntities(nil, entities, cap)
257
260
  end
258
- function ____exports.removeAllPickups(self)
259
- local pickups = ____exports.getPickups(nil)
260
- for ____, pickup in ipairs(pickups) do
261
- pickup:Remove()
262
- end
261
+ function ____exports.removeAllPickups(self, variant, subType, cap)
262
+ local pickups = ____exports.getPickups(nil, variant, subType)
263
+ ____exports.removeEntities(nil, pickups, cap)
263
264
  end
264
- function ____exports.removeAllProjectiles(self)
265
- local projectiles = ____exports.getProjectiles(nil)
266
- for ____, projectile in ipairs(projectiles) do
267
- projectile:Remove()
268
- end
265
+ function ____exports.removeAllProjectiles(self, variant, subType, cap)
266
+ local projectiles = ____exports.getProjectiles(nil, variant, subType)
267
+ ____exports.removeEntities(nil, projectiles, cap)
269
268
  end
270
- function ____exports.removeAllTears(self)
271
- local tears = ____exports.getTears(nil)
272
- for ____, tear in ipairs(tears) do
273
- tear:Remove()
274
- end
269
+ function ____exports.removeAllTears(self, variant, subType, cap)
270
+ local tears = ____exports.getTears(nil, variant, subType)
271
+ ____exports.removeEntities(nil, tears, cap)
275
272
  end
276
273
  function ____exports.setEntityPositions(self, entityPositions, entities)
277
274
  if entities == nil then
@@ -39,7 +39,8 @@ export declare function isAllPressurePlatesPushed(): boolean;
39
39
  */
40
40
  export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
41
41
  /**
42
- * Helper function to remove most grid entities in the room.
42
+ * Helper function to all grid entities in the room except for ones matching the grid entity types
43
+ * provided.
43
44
  *
44
45
  * Example:
45
46
  * ```
@@ -50,7 +51,20 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
50
51
  * ```
51
52
  */
52
53
  export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridEntityType[]): void;
53
- export declare function removeAllMatchingGridEntities(gridEntityType: GridEntityType): void;
54
+ /**
55
+ * Helper function to remove all of the grid entities in the room that match the grid entity types
56
+ * provided.
57
+ *
58
+ * Example:
59
+ * ```
60
+ * removeAllMatchingGridEntities(
61
+ * GridEntityType.GRID_ROCK,
62
+ * GridEntityType.GRID_ROCKB,
63
+ * GridEntityType.GRID_ROCKT,
64
+ * );
65
+ * ```
66
+ */
67
+ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEntityType[]): void;
54
68
  /**
55
69
  * Helper function to remove a grid entity simply by providing the grid entity object.
56
70
  *
@@ -130,8 +130,8 @@ function ____exports.removeAllGridEntitiesExceptFor(self, ...)
130
130
  end
131
131
  roomUpdateSafe(nil)
132
132
  end
133
- function ____exports.removeAllMatchingGridEntities(self, gridEntityType)
134
- local gridEntities = ____exports.getGridEntities(nil, gridEntityType)
133
+ function ____exports.removeAllMatchingGridEntities(self, ...)
134
+ local gridEntities = ____exports.getGridEntities(nil, ...)
135
135
  for ____, gridEntity in ipairs(gridEntities) do
136
136
  ____exports.removeGridEntity(nil, gridEntity, false)
137
137
  end
@@ -35,4 +35,9 @@ export declare function isDyingEggyWithNoSpidersLeft(npc: EntityNPC): boolean;
35
35
  * enemies.
36
36
  */
37
37
  export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
38
- export declare function removeAllNPCs(): void;
38
+ /**
39
+ * Helper function to remove all NPCs in the room.
40
+ *
41
+ * @param cap Optional. If specified, will only remove the given amount of NPCs.
42
+ */
43
+ export declare function removeAllNPCs(cap?: int): void;
@@ -6,6 +6,7 @@ local ____constants = require("constants")
6
6
  local EGGY_STATE_FRAME_OF_FINAL_SPIDER = ____constants.EGGY_STATE_FRAME_OF_FINAL_SPIDER
7
7
  local ____entity = require("functions.entity")
8
8
  local getEntities = ____entity.getEntities
9
+ local removeEntities = ____entity.removeEntities
9
10
  function ____exports.getBosses(self)
10
11
  local bosses = {}
11
12
  for ____, npc in ipairs(____exports.getNPCs(nil)) do
@@ -94,10 +95,8 @@ function ____exports.getAliveNPCs(self)
94
95
  end
95
96
  return aliveNPCs
96
97
  end
97
- function ____exports.removeAllNPCs(self)
98
+ function ____exports.removeAllNPCs(self, cap)
98
99
  local npcs = ____exports.getNPCs(nil)
99
- for ____, npc in ipairs(npcs) do
100
- npc:Remove()
101
- end
100
+ removeEntities(nil, npcs, cap)
102
101
  end
103
102
  return ____exports
@@ -22,8 +22,9 @@ export declare function anyPlayerHasTrinket(trinketType: TrinketType | int): boo
22
22
  export declare function anyPlayerIs(matchingCharacter: PlayerType): boolean;
23
23
  /**
24
24
  * Helper function to see if the provided character can have red heart containers. Returns true for
25
- * characters like Isaac, Magdalene, or Cain. Returns false for characters like Blue Baby. Returns
26
- * false for The Lost and Tainted Lost.
25
+ * characters like Isaac, Magdalene, or Cain. Returns true for Keeper and Tainted Keeper, even
26
+ * though coin containers are not technically the same as red heart containers. Returns false for
27
+ * characters like Blue Baby. Returns false for The Lost and Tainted Lost.
27
28
  */
28
29
  export declare function characterCanHaveRedHearts(character: PlayerType): boolean;
29
30
  /**
@@ -67,31 +67,31 @@ export interface CallbackParametersCustom {
67
67
  ];
68
68
  [ModCallbacksCustom.MC_POST_TEAR_INIT_LATE]: [
69
69
  callback: PostTearInitLateCallbackType,
70
- tearVariant?: TearVariant
70
+ tearVariant?: TearVariant | int
71
71
  ];
72
72
  [ModCallbacksCustom.MC_POST_FAMILIAR_INIT_LATE]: [
73
73
  callback: PostFamiliarInitLateCallbackType,
74
- familiarVariant?: FamiliarVariant
74
+ familiarVariant?: FamiliarVariant | int
75
75
  ];
76
76
  [ModCallbacksCustom.MC_POST_BOMB_INIT_LATE]: [
77
77
  callback: PostBombInitLateCallbackType,
78
- bombVariant?: BombVariant
78
+ bombVariant?: BombVariant | int
79
79
  ];
80
80
  [ModCallbacksCustom.MC_POST_PICKUP_INIT_LATE]: [
81
81
  callback: PostPickupInitLateCallbackType,
82
- pickupVariant?: PickupVariant
82
+ pickupVariant?: PickupVariant | int
83
83
  ];
84
84
  [ModCallbacksCustom.MC_POST_LASER_INIT_LATE]: [
85
85
  callback: PostLaserInitLateCallbackType,
86
- laserVariant?: LaserVariant
86
+ laserVariant?: LaserVariant | int
87
87
  ];
88
88
  [ModCallbacksCustom.MC_POST_KNIFE_INIT_LATE]: [
89
89
  callback: PostKnifeInitLateCallbackType,
90
- knifeVariant?: KnifeVariant
90
+ knifeVariant?: KnifeVariant | int
91
91
  ];
92
92
  [ModCallbacksCustom.MC_POST_PROJECTILE_INIT_LATE]: [
93
93
  callback: PostProjectileInitLateCallbackType,
94
- projectileVariant?: ProjectileVariant
94
+ projectileVariant?: ProjectileVariant | int
95
95
  ];
96
96
  [ModCallbacksCustom.MC_POST_NPC_INIT_LATE]: [
97
97
  callback: PostNPCInitLateCallbackType,
@@ -103,7 +103,7 @@ export interface CallbackParametersCustom {
103
103
  ];
104
104
  [ModCallbacksCustom.MC_POST_PICKUP_COLLECT]: [
105
105
  callback: PostPickupCollectCallbackType,
106
- pickupVariant?: PickupVariant
106
+ pickupVariant?: PickupVariant | int
107
107
  ];
108
108
  [ModCallbacksCustom.MC_PRE_ITEM_PICKUP]: [
109
109
  callback: PreItemPickupCallbackType,
@@ -146,7 +146,7 @@ export interface CallbackParametersCustom {
146
146
  ];
147
147
  [ModCallbacksCustom.MC_POST_PURCHASE]: [
148
148
  callback: PostPurchaseCallbackType,
149
- pickupVariant?: PickupVariant,
149
+ pickupVariant?: PickupVariant | int,
150
150
  pickupSubType?: int
151
151
  ];
152
152
  [ModCallbacksCustom.MC_POST_SACRIFICE]: [callback: PostSacrificeCallbackType];
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.492",
3
+ "version": "1.0.496",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",