isaacscript-common 1.2.260 → 1.2.263

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.
@@ -16,4 +16,4 @@
16
16
  * Note that the format for the `CacheFlag.CACHE_FIREDELAY` value should be in the tears stat
17
17
  * format, not the `MaxFireDelay` format.
18
18
  */
19
- export declare function registerCharacterStats(playerType: PlayerType | int, statMap: Map<CacheFlag, number>): void;
19
+ export declare function registerCharacterStats(playerType: PlayerType | int, statMap: Map<CacheFlag, number> | ReadonlyMap<CacheFlag, number>): void;
@@ -41,7 +41,8 @@ export declare function getMaxCards(): int;
41
41
  * This will not return:
42
42
  * - any runes
43
43
  * - any objects like Dice Shard
44
- * - any modded cards.
44
+ * - any modded cards (since there is not a way to distinguish between modded cards and modded
45
+ * runes/objects)
45
46
  *
46
47
  * @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
47
48
  * `RNG.Next` method will be called. Default is `getRandomSeed()`.
@@ -171,11 +171,11 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
171
171
  end
172
172
  local effect = entity:ToEffect()
173
173
  if effect ~= nil then
174
- debugString = debugString .. ("." .. tostring(effect.State)) .. " (effect)"
174
+ debugString = debugString .. (" (effect) (State: " .. tostring(effect.State)) .. ")"
175
175
  end
176
176
  local familiar = entity:ToFamiliar()
177
177
  if familiar ~= nil then
178
- debugString = debugString .. ("." .. tostring(familiar.State)) .. " (familiar)"
178
+ debugString = debugString .. (" (familiar) (State: " .. tostring(familiar.State)) .. ")"
179
179
  end
180
180
  local knife = entity:ToKnife()
181
181
  if knife ~= nil then
@@ -187,11 +187,11 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
187
187
  end
188
188
  local npc = entity:ToNPC()
189
189
  if npc ~= nil then
190
- debugString = debugString .. ((("." .. tostring(npc.State)) .. " (NPC) (CanShutDoors: ") .. tostring(npc.CanShutDoors)) .. ")"
190
+ debugString = debugString .. (((" (NPC) (State: " .. tostring(npc.State)) .. ") (CanShutDoors: ") .. tostring(npc.CanShutDoors)) .. ")"
191
191
  end
192
192
  local pickup = entity:ToPickup()
193
193
  if pickup ~= nil then
194
- debugString = debugString .. ("." .. tostring(pickup.State)) .. " (pickup)"
194
+ debugString = debugString .. (" (pickup) (State: " .. tostring(pickup.State)) .. ")"
195
195
  end
196
196
  local player = entity:ToPlayer()
197
197
  if player ~= nil then
@@ -205,6 +205,7 @@ function ____exports.logEntities(includeBackgroundEffects, entityTypeFilter)
205
205
  if tear ~= nil then
206
206
  debugString = debugString .. " (tear)"
207
207
  end
208
+ debugString = debugString .. (" (Index: " .. tostring(entity.Index)) .. ")"
208
209
  debugString = debugString .. (" (InitSeed: " .. tostring(entity.InitSeed)) .. ")"
209
210
  debugString = debugString .. (" (DropSeed: " .. tostring(entity.DropSeed)) .. ")"
210
211
  debugString = debugString .. (((" (Position: " .. tostring(entity.Position.X)) .. ", ") .. tostring(entity.Position.Y)) .. ")"
@@ -217,6 +217,13 @@ export declare function isTainted(player: EntityPlayer): boolean;
217
217
  /** Helper function for detecting when a player is Tainted Lazarus or Dead Tainted Lazarus. */
218
218
  export declare function isTaintedLazarus(player: EntityPlayer): boolean;
219
219
  export declare function isVanillaCharacter(player: EntityPlayer): boolean;
220
+ /**
221
+ * Helper function to check to see if a player has one or more collectibles.
222
+ *
223
+ * This function is variadic, meaning that you can supply as many collectible types as you want to
224
+ * check for. Returns true if the player has any of the supplied collectible types.
225
+ */
226
+ export declare function playerHasCollectible(player: EntityPlayer, ...collectibleTypes: Array<CollectibleType | int>): boolean;
220
227
  /**
221
228
  * Helper function to remove a collectible costume from a player. Use this helper function to avoid
222
229
  * having to request the collectible from the item config.
@@ -444,6 +444,13 @@ function ____exports.isTaintedLazarus(self, player)
444
444
  local character = player:GetPlayerType()
445
445
  return character == PlayerType.PLAYER_LAZARUS_B or character == PlayerType.PLAYER_LAZARUS2_B
446
446
  end
447
+ function ____exports.playerHasCollectible(self, player, ...)
448
+ local collectibleTypes = {...}
449
+ return __TS__ArraySome(
450
+ collectibleTypes,
451
+ function(____, collectibleType) return player:HasCollectible(collectibleType) end
452
+ )
453
+ end
447
454
  function ____exports.removeCollectibleCostume(self, player, collectibleType)
448
455
  local itemConfigItem = itemConfig:GetCollectible(collectibleType)
449
456
  if itemConfigItem == nil then
@@ -482,9 +489,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
482
489
  itemPool:RemoveCollectible(collectibleType)
483
490
  end
484
491
  repeat
485
- local ____switch101 = activeSlot
486
- local ____cond101 = ____switch101 == ActiveSlot.SLOT_PRIMARY
487
- if ____cond101 then
492
+ local ____switch103 = activeSlot
493
+ local ____cond103 = ____switch103 == ActiveSlot.SLOT_PRIMARY
494
+ if ____cond103 then
488
495
  do
489
496
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
490
497
  player:RemoveCollectible(primaryCollectibleType)
@@ -493,8 +500,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
493
500
  break
494
501
  end
495
502
  end
496
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_SECONDARY
497
- if ____cond101 then
503
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_SECONDARY
504
+ if ____cond103 then
498
505
  do
499
506
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
500
507
  player:RemoveCollectible(primaryCollectibleType)
@@ -509,16 +516,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
509
516
  break
510
517
  end
511
518
  end
512
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET
513
- if ____cond101 then
519
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_POCKET
520
+ if ____cond103 then
514
521
  do
515
522
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
516
523
  player:SetActiveCharge(charge, activeSlot)
517
524
  break
518
525
  end
519
526
  end
520
- ____cond101 = ____cond101 or ____switch101 == ActiveSlot.SLOT_POCKET2
521
- if ____cond101 then
527
+ ____cond103 = ____cond103 or ____switch103 == ActiveSlot.SLOT_POCKET2
528
+ if ____cond103 then
522
529
  do
523
530
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
524
531
  break
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.260",
3
+ "version": "1.2.263",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",