isaacscript-common 31.9.0 → 31.10.1

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.
@@ -8107,11 +8107,13 @@ declare type ISCFeatureTupleToClassTuple<T extends ISCFeature[]> = {
8107
8107
  */
8108
8108
  export declare function isCharacter(player: EntityPlayer, ...characters: PlayerType[]): boolean;
8109
8109
 
8110
+ /** Helper function to test if the provided pickup matches one of the various chest variants. */
8111
+ export declare function isChest(pickup: EntityPickup): boolean;
8112
+
8110
8113
  /**
8111
- * Helper function to test if the provided pickup or pickup variant matches one of the various chest
8112
- * variants.
8114
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
8113
8115
  */
8114
- export declare function isChest(pickupOrPickupVariant: EntityPickup | PickupVariant): boolean;
8116
+ export declare function isChestVariant(pickupVariant: PickupVariant): boolean;
8115
8117
 
8116
8118
  /**
8117
8119
  * Helper function to detect if a particular player is a "child" player, meaning that they have a
@@ -8637,10 +8639,16 @@ export declare function isQuestCollectible(collectibleType: CollectibleType): bo
8637
8639
  export declare function isRaglingDeathPatch(npc: EntityNPC): boolean;
8638
8640
 
8639
8641
  /**
8640
- * 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.
8641
8643
  */
8642
8644
  export declare function isRedHeart(pickup: EntityPickup): boolean;
8643
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
+
8644
8652
  /**
8645
8653
  * Helper function to detect if the provided room was created by the Red Key item. Under the hood,
8646
8654
  * this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 31.9.0
3
+ isaacscript-common 31.10.1
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -39718,8 +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
- local ____types = require("src.functions.types")
39722
- local isNumber = ____types.isNumber
39721
+ function ____exports.isChestVariant(self, pickupVariant)
39722
+ return CHEST_PICKUP_VARIANTS:has(pickupVariant)
39723
+ end
39723
39724
  function ____exports.getCoinValue(self, coinSubType)
39724
39725
  local value = COIN_SUB_TYPE_TO_VALUE[coinSubType]
39725
39726
  return value or DEFAULT_COIN_VALUE
@@ -39731,13 +39732,15 @@ function ____exports.getRedHearts(self)
39731
39732
  function(____, heart) return RED_HEART_SUB_TYPES_SET:has(heart.SubType) end
39732
39733
  )
39733
39734
  end
39734
- function ____exports.isChest(self, pickupOrPickupVariant)
39735
- local pickupVariant = isNumber(nil, pickupOrPickupVariant) and pickupOrPickupVariant or pickupOrPickupVariant.Variant
39736
- return CHEST_PICKUP_VARIANTS:has(pickupVariant)
39735
+ function ____exports.isChest(self, pickup)
39736
+ return ____exports.isChestVariant(nil, pickup.Variant)
39737
39737
  end
39738
39738
  function ____exports.isRedHeart(self, pickup)
39739
39739
  return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
39740
39740
  end
39741
+ function ____exports.isRedHeartSubType(self, heartSubType)
39742
+ return RED_HEART_SUB_TYPES_SET:has(heartSubType)
39743
+ end
39741
39744
  function ____exports.removeAllRedHearts(self, cap)
39742
39745
  local redHearts = ____exports.getRedHearts(nil)
39743
39746
  return removeEntities(nil, redHearts, cap)
@@ -49012,6 +49015,7 @@ function getEntityLogLine(entity, num)
49012
49015
  msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
49013
49016
  msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
49014
49017
  msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
49018
+ msg = msg .. (" - FrameCount: " .. tostring(entity.FrameCount)) .. "\n"
49015
49019
  if npc ~= nil then
49016
49020
  msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
49017
49021
  end
@@ -1 +1 @@
1
- {"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAIL,cAAc,EAOf,MAAM,8BAA8B,CAAC;AAkBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CA2CN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,YAAY,UAAQ,EACpB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA+CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhE;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D;AAmFD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAI5E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAGtE;AA+DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAInE"}
1
+ {"version":3,"file":"logEntities.d.ts","sourceRoot":"","sources":["../../../src/functions/logEntities.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,8BAA8B,CAAC;AAC/D,OAAO,EAIL,cAAc,EAOf,MAAM,8BAA8B,CAAC;AAkBtC,8FAA8F;AAC9F,wBAAgB,cAAc,CAC5B,IAAI,EAAE,IAAI,EACV,wBAAwB,EAAE,OAAO,EACjC,gBAAgB,CAAC,EAAE,UAAU,GAC5B,IAAI,CA2CN;AAED;;;;;;GAMG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,IAAI,EACV,YAAY,UAAQ,EACpB,oBAAoB,CAAC,EAAE,cAAc,GACpC,IAAI,CA+CN;AAED,iEAAiE;AACjE,wBAAgB,WAAW,CAAC,IAAI,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,EAAE,GAAG,IAAI,CAIhE;AAED,kEAAkE;AAClE,wBAAgB,SAAS,CAAC,IAAI,EAAE,IAAI,EAAE,MAAM,EAAE,MAAM,GAAG,IAAI,CAG1D;AAoFD,sEAAsE;AACtE,wBAAgB,eAAe,CAAC,IAAI,EAAE,IAAI,EAAE,YAAY,EAAE,UAAU,EAAE,GAAG,IAAI,CAI5E;AAED,wEAAwE;AACxE,wBAAgB,aAAa,CAAC,IAAI,EAAE,IAAI,EAAE,UAAU,EAAE,UAAU,GAAG,IAAI,CAGtE;AA+DD;;;GAGG;AACH,wBAAgB,UAAU,CAAC,IAAI,EAAE,IAAI,EAAE,OAAO,EAAE,OAAO,GAAG,IAAI,CAQ7D;AAED;;;GAGG;AACH,wBAAgB,YAAY,CAAC,IAAI,EAAE,IAAI,EAAE,SAAS,EAAE,OAAO,EAAE,GAAG,IAAI,CAInE"}
@@ -87,6 +87,7 @@ function getEntityLogLine(entity, num)
87
87
  msg = msg .. (" - Child: " .. tostring(entity.Child)) .. "\n"
88
88
  msg = msg .. (" - SpawnerEntity: " .. tostring(entity.SpawnerEntity)) .. "\n"
89
89
  msg = msg .. (((" - SpawnerType / SpawnerVariant: " .. tostring(entity.SpawnerType)) .. ".") .. tostring(entity.SpawnerVariant)) .. "\n"
90
+ msg = msg .. (" - FrameCount: " .. tostring(entity.FrameCount)) .. "\n"
90
91
  if npc ~= nil then
91
92
  msg = msg .. (" - CanShutDoors: " .. tostring(npc.CanShutDoors)) .. "\n"
92
93
  end
@@ -1,4 +1,4 @@
1
- import type { CoinSubType, PickupVariant } 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.
@@ -6,15 +6,21 @@ import type { CoinSubType, PickupVariant } from "isaac-typescript-definitions";
6
6
  export declare function getCoinValue(coinSubType: CoinSubType): int;
7
7
  /** Helper function to get all of the red heart pickup entities in the room. */
8
8
  export declare function getRedHearts(): EntityPickupHeart[];
9
+ /** Helper function to test if the provided pickup matches one of the various chest variants. */
10
+ export declare function isChest(pickup: EntityPickup): boolean;
9
11
  /**
10
- * Helper function to test if the provided pickup or pickup variant matches one of the various chest
11
- * variants.
12
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
12
13
  */
13
- export declare function isChest(pickupOrPickupVariant: EntityPickup | PickupVariant): boolean;
14
+ export declare function isChestVariant(pickupVariant: PickupVariant): boolean;
14
15
  /**
15
- * Helper function to test if the provided pickup matches one of the various red heart sub types.
16
+ * Helper function to test if the provided pickup matches one of the various red heart sub-types.
16
17
  */
17
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;
18
24
  /**
19
25
  * Helper function to remove all of the red heart pickup entities in the room.
20
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"pickups.d.ts","sourceRoot":"","sources":["../../../src/functions/pickups.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAY/E;;;GAGG;AACH,wBAAgB,YAAY,CAAC,WAAW,EAAE,WAAW,GAAG,GAAG,CAK1D;AAED,+EAA+E;AAC/E,wBAAgB,YAAY,IAAI,iBAAiB,EAAE,CAGlD;AAED;;;GAGG;AACH,wBAAgB,OAAO,CACrB,qBAAqB,EAAE,YAAY,GAAG,aAAa,GAClD,OAAO,CAMT;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,8 +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
- local ____types = require("src.functions.types")
18
- local isNumber = ____types.isNumber
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
19
21
  --- Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
20
22
  -- sub-types.
21
23
  function ____exports.getCoinValue(self, coinSubType)
@@ -30,16 +32,19 @@ function ____exports.getRedHearts(self)
30
32
  function(____, heart) return RED_HEART_SUB_TYPES_SET:has(heart.SubType) end
31
33
  )
32
34
  end
33
- --- Helper function to test if the provided pickup or pickup variant matches one of the various chest
34
- -- variants.
35
- function ____exports.isChest(self, pickupOrPickupVariant)
36
- local pickupVariant = isNumber(nil, pickupOrPickupVariant) and pickupOrPickupVariant or pickupOrPickupVariant.Variant
37
- return CHEST_PICKUP_VARIANTS:has(pickupVariant)
35
+ --- Helper function to test if the provided pickup matches one of the various chest variants.
36
+ function ____exports.isChest(self, pickup)
37
+ return ____exports.isChestVariant(nil, pickup.Variant)
38
38
  end
39
- --- 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.
40
40
  function ____exports.isRedHeart(self, pickup)
41
41
  return isHeart(nil, pickup) and RED_HEART_SUB_TYPES_SET:has(pickup.SubType)
42
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
43
48
  --- Helper function to remove all of the red heart pickup entities in the room.
44
49
  --
45
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.9.0",
3
+ "version": "31.10.1",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -225,6 +225,7 @@ function getEntityLogLine(this: void, entity: Entity, num?: int): string {
225
225
  msg += ` - Child: ${entity.Child}\n`;
226
226
  msg += ` - SpawnerEntity: ${entity.SpawnerEntity}\n`;
227
227
  msg += ` - SpawnerType / SpawnerVariant: ${entity.SpawnerType}.${entity.SpawnerVariant}\n`;
228
+ msg += ` - FrameCount: ${entity.FrameCount}\n`;
228
229
  if (npc !== undefined) {
229
230
  msg += ` - CanShutDoors: ${npc.CanShutDoors}\n`;
230
231
  }
@@ -1,4 +1,8 @@
1
- import type { CoinSubType, PickupVariant } 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,
@@ -8,7 +12,6 @@ import { RED_HEART_SUB_TYPES_SET } from "../sets/redHeartSubTypesSet";
8
12
  import { removeEntities } from "./entities";
9
13
  import { isHeart } from "./pickupVariants";
10
14
  import { getHearts } from "./pickupsSpecific";
11
- import { isNumber } from "./types";
12
15
 
13
16
  /**
14
17
  * Helper function to get the corresponding coin amount from a `CoinSubType`. Returns 1 for modded
@@ -27,27 +30,33 @@ export function getRedHearts(): EntityPickupHeart[] {
27
30
  return hearts.filter((heart) => RED_HEART_SUB_TYPES_SET.has(heart.SubType));
28
31
  }
29
32
 
33
+ /** Helper function to test if the provided pickup matches one of the various chest variants. */
34
+ export function isChest(pickup: EntityPickup): boolean {
35
+ return isChestVariant(pickup.Variant);
36
+ }
37
+
30
38
  /**
31
- * Helper function to test if the provided pickup or pickup variant matches one of the various chest
32
- * variants.
39
+ * Helper function to test if the provided pickup variant matches one of the various chest variants.
33
40
  */
34
- export function isChest(
35
- pickupOrPickupVariant: EntityPickup | PickupVariant,
36
- ): boolean {
37
- const pickupVariant = isNumber(pickupOrPickupVariant)
38
- ? pickupOrPickupVariant
39
- : pickupOrPickupVariant.Variant;
40
-
41
+ export function isChestVariant(pickupVariant: PickupVariant): boolean {
41
42
  return CHEST_PICKUP_VARIANTS.has(pickupVariant);
42
43
  }
43
44
 
44
45
  /**
45
- * Helper function to test if the provided pickup matches one of the various red heart sub types.
46
+ * Helper function to test if the provided pickup matches one of the various red heart sub-types.
46
47
  */
47
48
  export function isRedHeart(pickup: EntityPickup): boolean {
48
49
  return isHeart(pickup) && RED_HEART_SUB_TYPES_SET.has(pickup.SubType);
49
50
  }
50
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
+
51
60
  /**
52
61
  * Helper function to remove all of the red heart pickup entities in the room.
53
62
  *