isaacscript-common 31.8.1 → 31.10.0

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.
@@ -8110,6 +8110,11 @@ export declare function isCharacter(player: EntityPlayer, ...characters: PlayerT
8110
8110
  /** Helper function to test if the provided pickup matches one of the various chest variants. */
8111
8111
  export declare function isChest(pickup: EntityPickup): boolean;
8112
8112
 
8113
+ /**
8114
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
8115
+ */
8116
+ export declare function isChestVariant(pickupVariant: PickupVariant): boolean;
8117
+
8113
8118
  /**
8114
8119
  * Helper function to detect if a particular player is a "child" player, meaning that they have a
8115
8120
  * non-undefined `EntityPlayer.Parent` field. (For example, the Strawman Keeper.)
@@ -8634,10 +8639,16 @@ export declare function isQuestCollectible(collectibleType: CollectibleType): bo
8634
8639
  export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
8635
8640
 
8636
8641
  /**
8637
- * Helper function to test if the provided pickup matches one of the various red heart sub types.
8642
+ * Helper function to test if the provided pickup matches one of the various red heart sub-types.
8638
8643
  */
8639
8644
  export declare function isRedHeart(pickup: EntityPickup): boolean;
8640
8645
 
8646
+ /**
8647
+ * Helper function to test if the provided heart sub-type matches one of the various red heart
8648
+ * sub-types.
8649
+ */
8650
+ export declare function isRedHeartSubType(heartSubType: HeartSubType): boolean;
8651
+
8641
8652
  /**
8642
8653
  * Helper function to detect if the provided room was created by the Red Key item. Under the hood,
8643
8654
  * this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 31.8.1
3
+ isaacscript-common 31.10.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39718,6 +39718,9 @@ local ____pickupVariants = require("src.functions.pickupVariants")
39718
39718
  local isHeart = ____pickupVariants.isHeart
39719
39719
  local ____pickupsSpecific = require("src.functions.pickupsSpecific")
39720
39720
  local getHearts = ____pickupsSpecific.getHearts
39721
+ function ____exports.isChestVariant(self, pickupVariant)
39722
+ return CHEST_PICKUP_VARIANTS:has(pickupVariant)
39723
+ end
39721
39724
  function ____exports.getCoinValue(self, coinSubType)
39722
39725
  local value = COIN_SUB_TYPE_TO_VALUE[coinSubType]
39723
39726
  return value or DEFAULT_COIN_VALUE
@@ -39730,11 +39733,14 @@ function ____exports.getRedHearts(self)
39730
39733
  )
39731
39734
  end
39732
39735
  function ____exports.isChest(self, pickup)
39733
- return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
39736
+ return ____exports.isChestVariant(nil, pickup.Variant)
39734
39737
  end
39735
39738
  function ____exports.isRedHeart(self, pickup)
39736
39739
  return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
39737
39740
  end
39741
+ function ____exports.isRedHeartSubType(self, heartSubType)
39742
+ return RED_HEART_SUB_TYPES_SET:has(heartSubType)
39743
+ end
39738
39744
  function ____exports.removeAllRedHearts(self, cap)
39739
39745
  local redHearts = ____exports.getRedHearts(nil)
39740
39746
  return removeEntities(nil, redHearts, cap)
@@ -1,4 +1,4 @@
1
- import type { CoinSubType } from "isaac-typescript-definitions";
1
+ import type { CoinSubType, HeartSubType, PickupVariant } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
4
4
  * sub-types.
@@ -9,9 +9,18 @@ export declare function getRedHearts(): EntityPickupHeart[];
9
9
  /** Helper function to test if the provided pickup matches one of the various chest variants. */
10
10
  export declare function isChest(pickup: EntityPickup): boolean;
11
11
  /**
12
- * Helper function to test if the provided pickup matches one of the various red heart sub types.
12
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
13
+ */
14
+ export declare function isChestVariant(pickupVariant: PickupVariant): boolean;
15
+ /**
16
+ * Helper function to test if the provided pickup matches one of the various red heart sub-types.
13
17
  */
14
18
  export declare function isRedHeart(pickup: EntityPickup): boolean;
19
+ /**
20
+ * Helper function to test if the provided heart sub-type matches one of the various red heart
21
+ * sub-types.
22
+ */
23
+ export declare function isRedHeartSubType(heartSubType: HeartSubType): boolean;
15
24
  /**
16
25
  * Helper function to remove all of the red heart pickup entities in the room.
17
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pickups.d.ts","sourceRoot":"","sources":["../../../src/functions/pickups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,8BAA8B,CAAC;AAWhE;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,CAK1D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CAGlD;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,iBAAiB,EAAE,CAGjE"}
1
+ {"version":3,"file":"pickups.d.ts","sourceRoot":"","sources":["../../../src/functions/pickups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,WAAW,EACX,YAAY,EACZ,aAAa,EACd,MAAM,8BAA8B,CAAC;AAWtC;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,CAK1D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CAGlD;AAED,gGAAgG;AAChG,wBAAgB,OAAO,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAErD;AAED;;GAEG;AACH,wBAAgB,cAAc,CAAC,aAAa,EAAE,aAAa,GAAG,OAAO,CAEpE;AAED;;GAEG;AACH,wBAAgB,UAAU,CAAC,MAAM,EAAE,YAAY,GAAG,OAAO,CAExD;AAED;;;GAGG;AACH,wBAAgB,iBAAiB,CAAC,YAAY,EAAE,YAAY,GAAG,OAAO,CAErE;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAAC,GAAG,CAAC,EAAE,GAAG,GAAG,iBAAiB,EAAE,CAGjE"}
@@ -14,6 +14,10 @@ local ____pickupVariants = require("src.functions.pickupVariants")
14
14
  local isHeart = ____pickupVariants.isHeart
15
15
  local ____pickupsSpecific = require("src.functions.pickupsSpecific")
16
16
  local getHearts = ____pickupsSpecific.getHearts
17
+ --- Helper function to test if the provided pickup variant matches one of the various chest variants.
18
+ function ____exports.isChestVariant(self, pickupVariant)
19
+ return CHEST_PICKUP_VARIANTS:has(pickupVariant)
20
+ end
17
21
  --- Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
18
22
  -- sub-types.
19
23
  function ____exports.getCoinValue(self, coinSubType)
@@ -30,12 +34,17 @@ function ____exports.getRedHearts(self)
30
34
  end
31
35
  --- Helper function to test if the provided pickup matches one of the various chest variants.
32
36
  function ____exports.isChest(self, pickup)
33
- return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
37
+ return ____exports.isChestVariant(nil, pickup.Variant)
34
38
  end
35
- --- Helper function to test if the provided pickup matches one of the various red heart sub types.
39
+ --- Helper function to test if the provided pickup matches one of the various red heart sub-types.
36
40
  function ____exports.isRedHeart(self, pickup)
37
41
  return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
38
42
  end
43
+ --- Helper function to test if the provided heart sub-type matches one of the various red heart
44
+ -- sub-types.
45
+ function ____exports.isRedHeartSubType(self, heartSubType)
46
+ return RED_HEART_SUB_TYPES_SET:has(heartSubType)
47
+ end
39
48
  --- Helper function to remove all of the red heart pickup entities in the room.
40
49
  --
41
50
  -- @param cap Optional. If specified, will only remove the given amount of hearts.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "31.8.1",
3
+ "version": "31.10.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,4 +1,8 @@
1
- import type { CoinSubType } from "isaac-typescript-definitions";
1
+ import type {
2
+ CoinSubType,
3
+ HeartSubType,
4
+ PickupVariant,
5
+ } from "isaac-typescript-definitions";
2
6
  import {
3
7
  COIN_SUB_TYPE_TO_VALUE,
4
8
  DEFAULT_COIN_VALUE,
@@ -28,16 +32,31 @@ export function getRedHearts(): EntityPickupHeart[] {
28
32
 
29
33
  /** Helper function to test if the provided pickup matches one of the various chest variants. */
30
34
  export function isChest(pickup: EntityPickup): boolean {
31
- return CHEST_PICKUP_VARIANTS.has(pickup.Variant);
35
+ return isChestVariant(pickup.Variant);
32
36
  }
33
37
 
34
38
  /**
35
- * Helper function to test if the provided pickup matches one of the various red heart sub types.
39
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
40
+ */
41
+ export function isChestVariant(pickupVariant: PickupVariant): boolean {
42
+ return CHEST_PICKUP_VARIANTS.has(pickupVariant);
43
+ }
44
+
45
+ /**
46
+ * Helper function to test if the provided pickup matches one of the various red heart sub-types.
36
47
  */
37
48
  export function isRedHeart(pickup: EntityPickup): boolean {
38
49
  return isHeart(pickup) && RED_HEART_SUB_TYPES_SET.has(pickup.SubType);
39
50
  }
40
51
 
52
+ /**
53
+ * Helper function to test if the provided heart sub-type matches one of the various red heart
54
+ * sub-types.
55
+ */
56
+ export function isRedHeartSubType(heartSubType: HeartSubType): boolean {
57
+ return RED_HEART_SUB_TYPES_SET.has(heartSubType);
58
+ }
59
+
41
60
  /**
42
61
  * Helper function to remove all of the red heart pickup entities in the room.
43
62
  *