isaacscript-common 1.0.544 → 1.0.545

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.
@@ -68,8 +68,9 @@ export declare function isSingleUseCollectible(collectibleType: CollectibleType
68
68
  * @param collectibleType Optional. If specified, will only remove collectibles that match this
69
69
  * collectible type.
70
70
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
71
+ * @returns True if one or more collectibles was removed, false otherwise.
71
72
  */
72
- export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): void;
73
+ export declare function removeAllCollectibles(collectibleType?: CollectibleType | int, cap?: int): boolean;
73
74
  /**
74
75
  * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
75
76
  * frame delay before they can be picked up by a player.
@@ -151,7 +151,7 @@ function ____exports.isSingleUseCollectible(self, collectibleType)
151
151
  return SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES:has(collectibleType)
152
152
  end
153
153
  function ____exports.removeAllCollectibles(self, collectibleType, cap)
154
- removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
154
+ return removeAllPickups(nil, PickupVariant.PICKUP_COLLECTIBLE, collectibleType, cap)
155
155
  end
156
156
  function ____exports.removeCollectiblePickupDelay(self, collectible)
157
157
  if collectible.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
@@ -164,48 +164,54 @@ export declare function isEntityMoving(entity: Entity, threshold?: number): bool
164
164
  *
165
165
  * @param entities The array of entities to remove.
166
166
  * @param cap Optional. If specified, will only remove the given amount of entities.
167
+ * @returns True if one or more entities was removed, false otherwise.
167
168
  */
168
- export declare function removeEntities(entities: Entity[], cap?: int): void;
169
+ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
169
170
  /**
170
171
  * Helper function to remove all of the bombs in the room.
171
172
  *
172
173
  * @param variant Optional. If specified, will only remove bombs that match this variant.
173
174
  * @param subType Optional. If specified, will only remove bombs that match this sub-type.
174
175
  * @param cap Optional. If specified, will only remove the given amount of bombs.
176
+ * @returns True if one or more bombs was removed, false otherwise.
175
177
  */
176
- export declare function removeAllBombs(variant?: BombVariant | int, subType?: int, cap?: int): void;
178
+ export declare function removeAllBombs(variant?: BombVariant | int, subType?: int, cap?: int): boolean;
177
179
  /**
178
180
  * Helper function to remove all of the effects in the room.
179
181
  *
180
182
  * @param variant Optional. If specified, will only remove effects that match this variant.
181
183
  * @param subType Optional. If specified, will only remove effects that match this sub-type.
182
184
  * @param cap Optional. If specified, will only remove the given amount of effects.
185
+ * @returns True if one or more effects was removed, false otherwise.
183
186
  */
184
- export declare function removeAllEffects(variant?: EffectVariant, subType?: int, cap?: int): void;
187
+ export declare function removeAllEffects(variant?: EffectVariant, subType?: int, cap?: int): boolean;
185
188
  /**
186
189
  * Helper function to remove all of the familiars in the room.
187
190
  *
188
191
  * @param variant Optional. If specified, will only remove familiars that match this variant.
189
192
  * @param subType Optional. If specified, will only remove familiars that match this sub-type.
190
193
  * @param cap Optional. If specified, will only remove the given amount of familiars.
194
+ * @returns True if one or more familiars was removed, false otherwise.
191
195
  */
192
- export declare function removeAllFamiliars(variant?: FamiliarVariant | int, subType?: int, cap?: int): void;
196
+ export declare function removeAllFamiliars(variant?: FamiliarVariant | int, subType?: int, cap?: int): boolean;
193
197
  /**
194
198
  * Helper function to remove all of the knives in the room.
195
199
  *
196
200
  * @param variant Optional. If specified, will only remove knives that match this variant.
197
201
  * @param subType Optional. If specified, will only remove knives that match this sub-type.
198
202
  * @param cap Optional. If specified, will only remove the given amount of knives.
203
+ * @returns True if one or more knives was removed, false otherwise.
199
204
  */
200
- export declare function removeAllKnives(variant?: KnifeVariant | int, subType?: int, cap?: int): void;
205
+ export declare function removeAllKnives(variant?: KnifeVariant | int, subType?: int, cap?: int): boolean;
201
206
  /**
202
207
  * Helper function to remove all of the lasers in the room.
203
208
  *
204
209
  * @param variant Optional. If specified, will only remove lasers that match this variant.
205
210
  * @param subType Optional. If specified, will only remove lasers that match this sub-type.
206
211
  * @param cap Optional. If specified, will only remove the given amount of lasers.
212
+ * @returns True if one or more lasers was removed, false otherwise.
207
213
  */
208
- export declare function removeAllLasers(variant?: LaserVariant | int, subType?: int, cap?: int): void;
214
+ export declare function removeAllLasers(variant?: LaserVariant | int, subType?: int, cap?: int): boolean;
209
215
  /**
210
216
  * Helper function to remove all of the matching entities in the room.
211
217
  *
@@ -215,32 +221,36 @@ export declare function removeAllLasers(variant?: LaserVariant | int, subType?:
215
221
  * @param entitySubType Optional. The sub-type to match. -1 by default (which will match every
216
222
  * sub-type).
217
223
  * @param cap Optional. If specified, will only remove the given amount of collectibles.
224
+ * @returns True if one or more entities was removed, false otherwise.
218
225
  */
219
- export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): void;
226
+ export declare function removeAllMatchingEntities(entityType: int, entityVariant?: number, entitySubType?: number, cap?: int | undefined): boolean;
220
227
  /**
221
228
  * Helper function to remove all of the pickups in the room.
222
229
  *
223
230
  * @param variant Optional. If specified, will only remove pickups that match this variant.
224
231
  * @param subType Optional. If specified, will only remove pickups that match this sub-type.
225
232
  * @param cap Optional. If specified, will only remove the given amount of pickups.
233
+ * @returns True if one or more pickups was removed, false otherwise.
226
234
  */
227
- export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): void;
235
+ export declare function removeAllPickups(variant?: PickupVariant | int, subType?: int, cap?: int): boolean;
228
236
  /**
229
237
  * Helper function to remove all of the projectiles in the room.
230
238
  *
231
239
  * @param variant Optional. If specified, will only remove projectiles that match this variant.
232
240
  * @param subType Optional. If specified, will only remove projectiles that match this sub-type.
233
241
  * @param cap Optional. If specified, will only remove the given amount of projectiles.
242
+ * @returns True if one or more projectiles was removed, false otherwise.
234
243
  */
235
- export declare function removeAllProjectiles(variant?: ProjectileVariant | int, subType?: int, cap?: int): void;
244
+ export declare function removeAllProjectiles(variant?: ProjectileVariant | int, subType?: int, cap?: int): boolean;
236
245
  /**
237
246
  * Helper function to remove all of the tears in the room.
238
247
  *
239
248
  * @param variant Optional. If specified, will only remove tears that match this variant.
240
249
  * @param subType Optional. If specified, will only remove tears that match this sub-type.
241
250
  * @param cap Optional. If specified, will only remove the given amount of tears.
251
+ * @returns True if one or more tears was removed, false otherwise.
242
252
  */
243
- export declare function removeAllTears(variant?: TearVariant | int, subType?: int, cap?: int): void;
253
+ export declare function removeAllTears(variant?: TearVariant | int, subType?: int, cap?: int): boolean;
244
254
  /**
245
255
  * Helper function to set the position of every entity in the room based on a map of positions. If
246
256
  * an entity is found that does not have matching element in the provided map, then that entity will
@@ -217,6 +217,9 @@ function ____exports.isEntityMoving(self, entity, threshold)
217
217
  return entity.Velocity:Length() >= threshold
218
218
  end
219
219
  function ____exports.removeEntities(self, entities, cap)
220
+ if #entities == 0 then
221
+ return false
222
+ end
220
223
  local numEntitiesRemoved = 0
221
224
  do
222
225
  local i = 0
@@ -225,31 +228,32 @@ function ____exports.removeEntities(self, entities, cap)
225
228
  entity:Remove()
226
229
  numEntitiesRemoved = numEntitiesRemoved + 1
227
230
  if (cap ~= nil) and (numEntitiesRemoved >= cap) then
228
- return
231
+ return true
229
232
  end
230
233
  i = i + 1
231
234
  end
232
235
  end
236
+ return true
233
237
  end
234
238
  function ____exports.removeAllBombs(self, variant, subType, cap)
235
239
  local bombs = ____exports.getBombs(nil, variant, subType)
236
- ____exports.removeEntities(nil, bombs, cap)
240
+ return ____exports.removeEntities(nil, bombs, cap)
237
241
  end
238
242
  function ____exports.removeAllEffects(self, variant, subType, cap)
239
243
  local effects = ____exports.getEffects(nil, variant, subType)
240
- ____exports.removeEntities(nil, effects, cap)
244
+ return ____exports.removeEntities(nil, effects, cap)
241
245
  end
242
246
  function ____exports.removeAllFamiliars(self, variant, subType, cap)
243
247
  local familiars = ____exports.getFamiliars(nil, variant, subType)
244
- ____exports.removeEntities(nil, familiars, cap)
248
+ return ____exports.removeEntities(nil, familiars, cap)
245
249
  end
246
250
  function ____exports.removeAllKnives(self, variant, subType, cap)
247
251
  local knives = ____exports.getKnives(nil, variant, subType)
248
- ____exports.removeEntities(nil, knives, cap)
252
+ return ____exports.removeEntities(nil, knives, cap)
249
253
  end
250
254
  function ____exports.removeAllLasers(self, variant, subType, cap)
251
255
  local lasers = ____exports.getLasers(nil, variant, subType)
252
- ____exports.removeEntities(nil, lasers, cap)
256
+ return ____exports.removeEntities(nil, lasers, cap)
253
257
  end
254
258
  function ____exports.removeAllMatchingEntities(self, entityType, entityVariant, entitySubType, cap)
255
259
  if entityVariant == nil then
@@ -262,19 +266,19 @@ function ____exports.removeAllMatchingEntities(self, entityType, entityVariant,
262
266
  cap = nil
263
267
  end
264
268
  local entities = Isaac.FindByType(entityType, entityVariant, entitySubType)
265
- ____exports.removeEntities(nil, entities, cap)
269
+ return ____exports.removeEntities(nil, entities, cap)
266
270
  end
267
271
  function ____exports.removeAllPickups(self, variant, subType, cap)
268
272
  local pickups = ____exports.getPickups(nil, variant, subType)
269
- ____exports.removeEntities(nil, pickups, cap)
273
+ return ____exports.removeEntities(nil, pickups, cap)
270
274
  end
271
275
  function ____exports.removeAllProjectiles(self, variant, subType, cap)
272
276
  local projectiles = ____exports.getProjectiles(nil, variant, subType)
273
- ____exports.removeEntities(nil, projectiles, cap)
277
+ return ____exports.removeEntities(nil, projectiles, cap)
274
278
  end
275
279
  function ____exports.removeAllTears(self, variant, subType, cap)
276
280
  local tears = ____exports.getTears(nil, variant, subType)
277
- ____exports.removeEntities(nil, tears, cap)
281
+ return ____exports.removeEntities(nil, tears, cap)
278
282
  end
279
283
  function ____exports.setEntityPositions(self, entityPositions, entities)
280
284
  if entities == nil then
@@ -55,8 +55,10 @@ export declare function isPostBossVoidPortal(gridEntity: GridEntity): boolean;
55
55
  * GridEntityType.GRID_DOOR,
56
56
  * );
57
57
  * ```
58
+ *
59
+ * @returns True if one or more grid entities was removed, false otherwise.
58
60
  */
59
- export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridEntityType[]): void;
61
+ export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridEntityType[]): boolean;
60
62
  /**
61
63
  * Helper function to remove all of the grid entities in the room that match the grid entity types
62
64
  * provided.
@@ -69,8 +71,10 @@ export declare function removeAllGridEntitiesExceptFor(...gridEntityTypes: GridE
69
71
  * GridEntityType.GRID_ROCKT,
70
72
  * );
71
73
  * ```
74
+ *
75
+ * @returns True if one or more grid entities was removed, false otherwise.
72
76
  */
73
- export declare function removeAllMatchingGridEntities(...gridEntityType: GridEntityType[]): void;
77
+ export declare function removeAllMatchingGridEntities(...gridEntityType: GridEntityType[]): boolean;
74
78
  /**
75
79
  * Helper function to remove a grid entity simply by providing the grid entity object.
76
80
  *
@@ -135,20 +135,29 @@ function ____exports.removeAllGridEntitiesExceptFor(self, ...)
135
135
  local gridEntityTypes = {...}
136
136
  local gridEntityTypeExceptions = __TS__New(Set, gridEntityTypes)
137
137
  local gridEntities = ____exports.getGridEntities(nil)
138
+ local removedOneOrMoreGridEntities = false
138
139
  for ____, gridEntity in ipairs(gridEntities) do
139
140
  local gridEntityType = gridEntity:GetType()
140
141
  if not gridEntityTypeExceptions:has(gridEntityType) then
141
142
  ____exports.removeGridEntity(nil, gridEntity, false)
143
+ removedOneOrMoreGridEntities = true
142
144
  end
143
145
  end
144
- roomUpdateSafe(nil)
146
+ if removedOneOrMoreGridEntities then
147
+ roomUpdateSafe(nil)
148
+ end
149
+ return removedOneOrMoreGridEntities
145
150
  end
146
151
  function ____exports.removeAllMatchingGridEntities(self, ...)
147
152
  local gridEntities = ____exports.getGridEntities(nil, ...)
153
+ if #gridEntities == 0 then
154
+ return false
155
+ end
148
156
  for ____, gridEntity in ipairs(gridEntities) do
149
157
  ____exports.removeGridEntity(nil, gridEntity, false)
150
158
  end
151
159
  roomUpdateSafe(nil)
160
+ return true
152
161
  end
153
162
  function ____exports.setGridEntityInvisible(self, gridEntity)
154
163
  local sprite = gridEntity:GetSprite()
@@ -39,5 +39,6 @@ export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
39
39
  * Helper function to remove all NPCs in the room.
40
40
  *
41
41
  * @param cap Optional. If specified, will only remove the given amount of NPCs.
42
+ * @returns True if one or more NPCs was removed, false otherwise.
42
43
  */
43
- export declare function removeAllNPCs(cap?: int): void;
44
+ export declare function removeAllNPCs(cap?: int): boolean;
@@ -99,6 +99,6 @@ function ____exports.getAliveNPCs(self)
99
99
  end
100
100
  function ____exports.removeAllNPCs(self, cap)
101
101
  local npcs = ____exports.getNPCs(nil)
102
- removeEntities(nil, npcs, cap)
102
+ return removeEntities(nil, npcs, cap)
103
103
  end
104
104
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.544",
3
+ "version": "1.0.545",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",