isaacscript-common 25.1.0 → 25.2.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.
@@ -13244,6 +13244,13 @@ export declare function removeCollectibleFromAllPlayers(...collectibleTypes: Col
13244
13244
  */
13245
13245
  export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType): void;
13246
13246
 
13247
+ /**
13248
+ * Helper function to remove one or more collectibles from all item pools.
13249
+ *
13250
+ * This function is variadic, meaning you can pass as many collectible types as you want to remove.
13251
+ */
13252
+ export declare function removeCollectibleFromPools(...collectibleTypes: CollectibleType[]): void;
13253
+
13247
13254
  /**
13248
13255
  * Helper function to remove all pickup delay on a collectible. By default, collectibles have a 20
13249
13256
  * frame delay before they can be picked up by a player.
@@ -13352,6 +13359,13 @@ export declare function removeSubstring(string: string, ...substrings: string[])
13352
13359
  */
13353
13360
  export declare function removeTrinketCostume(player: EntityPlayer, trinketType: TrinketType): void;
13354
13361
 
13362
+ /**
13363
+ * Helper function to remove one or more trinkets from all item pools.
13364
+ *
13365
+ * This function is variadic, meaning you can pass as many trinket types as you want to remove.
13366
+ */
13367
+ export declare function removeTrinketFromPools(...trinketTypes: TrinketType[]): void;
13368
+
13355
13369
  /**
13356
13370
  * Helper function to remove all coins, trinkets, and so on that spawned from breaking an urn.
13357
13371
  *
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 25.1.0
3
+ isaacscript-common 25.2.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -51476,6 +51476,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescri
51476
51476
  local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
51477
51477
  local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
51478
51478
  local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
51479
+ local ____cachedClasses = require("src.core.cachedClasses")
51480
+ local game = ____cachedClasses.game
51479
51481
  local ____array = require("src.functions.array")
51480
51482
  local arrayRemove = ____array.arrayRemove
51481
51483
  local getRandomArrayElement = ____array.getRandomArrayElement
@@ -51526,6 +51528,20 @@ function ____exports.getRandomItemPool(self)
51526
51528
  local itemPoolTypes = isGreedMode(nil) and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
51527
51529
  return getRandomArrayElement(nil, itemPoolTypes)
51528
51530
  end
51531
+ function ____exports.removeCollectibleFromPools(self, ...)
51532
+ local collectibleTypes = {...}
51533
+ local itemPool = game:GetItemPool()
51534
+ for ____, collectibleType in ipairs(collectibleTypes) do
51535
+ itemPool:RemoveCollectible(collectibleType)
51536
+ end
51537
+ end
51538
+ function ____exports.removeTrinketFromPools(self, ...)
51539
+ local trinketTypes = {...}
51540
+ local itemPool = game:GetItemPool()
51541
+ for ____, trinketType in ipairs(trinketTypes) do
51542
+ itemPool:RemoveTrinket(trinketType)
51543
+ end
51544
+ end
51529
51545
  return ____exports
51530
51546
  end,
51531
51547
  ["src.objects.languageNames"] = function(...)
@@ -1,8 +1,20 @@
1
- import { ItemPoolType } from "isaac-typescript-definitions";
1
+ import { CollectibleType, ItemPoolType, TrinketType } from "isaac-typescript-definitions";
2
2
  /**
3
3
  * Helper function to get a random item pool. This is not as simple as getting a random value from
4
4
  * the `ItemPoolType` enum, since `ItemPoolType.SHELL_GAME` (7) is not a real item pool and the
5
5
  * Greed Mode item pools should be excluded if not playing in Greed Mode.
6
6
  */
7
7
  export declare function getRandomItemPool(): ItemPoolType;
8
+ /**
9
+ * Helper function to remove one or more collectibles from all item pools.
10
+ *
11
+ * This function is variadic, meaning you can pass as many collectible types as you want to remove.
12
+ */
13
+ export declare function removeCollectibleFromPools(...collectibleTypes: CollectibleType[]): void;
14
+ /**
15
+ * Helper function to remove one or more trinkets from all item pools.
16
+ *
17
+ * This function is variadic, meaning you can pass as many trinket types as you want to remove.
18
+ */
19
+ export declare function removeTrinketFromPools(...trinketTypes: TrinketType[]): void;
8
20
  //# sourceMappingURL=itemPool.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAuC5D;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD"}
1
+ {"version":3,"file":"itemPool.d.ts","sourceRoot":"","sources":["../../../src/functions/itemPool.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,eAAe,EACf,YAAY,EACZ,WAAW,EACZ,MAAM,8BAA8B,CAAC;AAwCtC;;;;GAIG;AACH,wBAAgB,iBAAiB,IAAI,YAAY,CAKhD;AAED;;;;GAIG;AACH,wBAAgB,0BAA0B,CACxC,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAMN;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CAAC,GAAG,YAAY,EAAE,WAAW,EAAE,GAAG,IAAI,CAM3E"}
@@ -7,6 +7,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
7
7
  local ItemPoolType = ____isaac_2Dtypescript_2Ddefinitions.ItemPoolType
8
8
  local ____cachedEnumValues = require("src.arrays.cachedEnumValues")
9
9
  local ITEM_POOL_TYPE_VALUES = ____cachedEnumValues.ITEM_POOL_TYPE_VALUES
10
+ local ____cachedClasses = require("src.core.cachedClasses")
11
+ local game = ____cachedClasses.game
10
12
  local ____array = require("src.functions.array")
11
13
  local arrayRemove = ____array.arrayRemove
12
14
  local getRandomArrayElement = ____array.getRandomArrayElement
@@ -60,4 +62,24 @@ function ____exports.getRandomItemPool(self)
60
62
  local itemPoolTypes = isGreedMode(nil) and GREED_MODE_ITEM_POOL_TYPES or NORMAL_MODE_ITEM_POOL_TYPES
61
63
  return getRandomArrayElement(nil, itemPoolTypes)
62
64
  end
65
+ --- Helper function to remove one or more collectibles from all item pools.
66
+ --
67
+ -- This function is variadic, meaning you can pass as many collectible types as you want to remove.
68
+ function ____exports.removeCollectibleFromPools(self, ...)
69
+ local collectibleTypes = {...}
70
+ local itemPool = game:GetItemPool()
71
+ for ____, collectibleType in ipairs(collectibleTypes) do
72
+ itemPool:RemoveCollectible(collectibleType)
73
+ end
74
+ end
75
+ --- Helper function to remove one or more trinkets from all item pools.
76
+ --
77
+ -- This function is variadic, meaning you can pass as many trinket types as you want to remove.
78
+ function ____exports.removeTrinketFromPools(self, ...)
79
+ local trinketTypes = {...}
80
+ local itemPool = game:GetItemPool()
81
+ for ____, trinketType in ipairs(trinketTypes) do
82
+ itemPool:RemoveTrinket(trinketType)
83
+ end
84
+ end
63
85
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "25.1.0",
3
+ "version": "25.2.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,5 +1,10 @@
1
- import { ItemPoolType } from "isaac-typescript-definitions";
1
+ import {
2
+ CollectibleType,
3
+ ItemPoolType,
4
+ TrinketType,
5
+ } from "isaac-typescript-definitions";
2
6
  import { ITEM_POOL_TYPE_VALUES } from "../arrays/cachedEnumValues";
7
+ import { game } from "../core/cachedClasses";
3
8
  import { arrayRemove, getRandomArrayElement } from "./array";
4
9
  import { isGreedMode } from "./run";
5
10
 
@@ -48,3 +53,31 @@ export function getRandomItemPool(): ItemPoolType {
48
53
  : NORMAL_MODE_ITEM_POOL_TYPES;
49
54
  return getRandomArrayElement(itemPoolTypes);
50
55
  }
56
+
57
+ /**
58
+ * Helper function to remove one or more collectibles from all item pools.
59
+ *
60
+ * This function is variadic, meaning you can pass as many collectible types as you want to remove.
61
+ */
62
+ export function removeCollectibleFromPools(
63
+ ...collectibleTypes: CollectibleType[]
64
+ ): void {
65
+ const itemPool = game.GetItemPool();
66
+
67
+ for (const collectibleType of collectibleTypes) {
68
+ itemPool.RemoveCollectible(collectibleType);
69
+ }
70
+ }
71
+
72
+ /**
73
+ * Helper function to remove one or more trinkets from all item pools.
74
+ *
75
+ * This function is variadic, meaning you can pass as many trinket types as you want to remove.
76
+ */
77
+ export function removeTrinketFromPools(...trinketTypes: TrinketType[]): void {
78
+ const itemPool = game.GetItemPool();
79
+
80
+ for (const trinketType of trinketTypes) {
81
+ itemPool.RemoveTrinket(trinketType);
82
+ }
83
+ }