isaacscript-common 1.2.145 → 1.2.148

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.
@@ -41,4 +41,10 @@ export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDo
41
41
  * 1x1 room for the purposes of calculating how much charge to grant. Default is false.
42
42
  */
43
43
  export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, ignoreBigRoomDoubleCharge?: boolean): void;
44
+ /**
45
+ * Helper function to get the combined normal charge and the battery charge for the player's active
46
+ * item. Use this to avoid having to manually retrieve these two values and add them together.
47
+ */
48
+ export declare function getActiveCharge(player: EntityPlayer, activeSlot: ActiveSlot): int;
49
+ export declare function isActiveSlotDoubleCharged(player: EntityPlayer, activeSlot: ActiveSlot): boolean;
44
50
  export declare function playChargeSoundEffect(player: EntityPlayer, activeSlot: ActiveSlot): void;
@@ -105,4 +105,15 @@ function ____exports.addRoomClearCharges(self, ignoreBigRoomDoubleCharge)
105
105
  ____exports.addRoomClearCharge(nil, player, ignoreBigRoomDoubleCharge)
106
106
  end
107
107
  end
108
+ function ____exports.getActiveCharge(self, player, activeSlot)
109
+ local charge = player:GetActiveCharge(activeSlot)
110
+ local batteryCharge = player:GetBatteryCharge(activeSlot)
111
+ return charge + batteryCharge
112
+ end
113
+ function ____exports.isActiveSlotDoubleCharged(self, player, activeSlot)
114
+ local collectibleType = player:GetActiveItem(activeSlot)
115
+ local batteryCharge = player:GetBatteryCharge(activeSlot)
116
+ local maxCharges = getCollectibleMaxCharges(nil, collectibleType)
117
+ return batteryCharge >= maxCharges
118
+ end
108
119
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.2.145",
3
+ "version": "1.2.148",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",