isaacscript-common 1.2.143 → 1.2.144

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.
@@ -4,3 +4,9 @@
4
4
  * order. This does not include active items.
5
5
  */
6
6
  export declare function getPlayerInventory(player: EntityPlayer): CollectibleType[];
7
+ /**
8
+ * Helper function to add a collectible to a player. Use this instead of the
9
+ * `EntityPlayer.AddCollectible` method if you want the collectible that is added to be
10
+ * automatically tracked by the player inventory tracker feature.
11
+ */
12
+ export declare function addCollectible(player: EntityPlayer, collectibleType: CollectibleType, charge?: int, firstTimePickingUp?: boolean, activeSlot?: ActiveSlot, varData?: int): void;
@@ -73,4 +73,16 @@ function ____exports.getPlayerInventory(self, player)
73
73
  local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
74
74
  return copyArray(nil, inventory)
75
75
  end
76
+ function ____exports.addCollectible(self, player, collectibleType, charge, firstTimePickingUp, activeSlot, varData)
77
+ player:AddCollectible(
78
+ collectibleType,
79
+ charge,
80
+ firstTimePickingUp,
81
+ activeSlot,
82
+ varData
83
+ )
84
+ local playerIndex = getPlayerIndex(nil, player)
85
+ local inventory = v.run.playersInventory:getAndSetDefault(playerIndex, player)
86
+ __TS__ArrayPush(inventory, collectibleType)
87
+ end
76
88
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.143",
3
+ "version": "1.2.144",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",