isaacscript-common 35.0.0 → 35.1.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.
@@ -15160,8 +15160,11 @@ export declare function removeCollectibleFromAllPlayers(...collectibleTypes: Col
15160
15160
  * this function is not necessary when removing items from players. For example, when you remove a
15161
15161
  * collectible with the `EntityPlayer.RemoveCollectible` method, a proper message is sent to the log
15162
15162
  * the item tracker will automatically remove it.
15163
+ *
15164
+ * This function is variadic, meaning that you can pass as many collectible types as you want to
15165
+ * remove.
15163
15166
  */
15164
- export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType): void;
15167
+ export declare function removeCollectibleFromItemTracker(...collectibleTypes: CollectibleType[]): void;
15165
15168
 
15166
15169
  /**
15167
15170
  * Helper function to remove one or more collectibles from all item pools.
@@ -1,6 +1,6 @@
1
1
  --[[
2
2
 
3
- isaacscript-common 35.0.0
3
+ isaacscript-common 35.1.0
4
4
 
5
5
  This is the "isaacscript-common" library, which was created with the IsaacScript tool.
6
6
 
@@ -30382,8 +30382,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
30382
30382
  local ____exports = {}
30383
30383
  local ____isaac_2Dtypescript_2Ddefinitions = require("lua_modules.isaac-typescript-definitions.dist.src.index")
30384
30384
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
30385
- local ____shouldFire = require("src.shouldFire")
30386
- local shouldFirePickup = ____shouldFire.shouldFirePickup
30387
30385
  local ____CustomCallback = require("src.classes.private.CustomCallback")
30388
30386
  local CustomCallback = ____CustomCallback.CustomCallback
30389
30387
  ____exports.PostPickupSelectionFilter = __TS__Class()
@@ -30392,7 +30390,11 @@ PostPickupSelectionFilter.name = "PostPickupSelectionFilter"
30392
30390
  __TS__ClassExtends(PostPickupSelectionFilter, CustomCallback)
30393
30391
  function PostPickupSelectionFilter.prototype.____constructor(self)
30394
30392
  CustomCallback.prototype.____constructor(self)
30395
- self.shouldFire = shouldFirePickup
30393
+ self.shouldFire = function(____, fireArgs, optionalArgs)
30394
+ local _pickup, pickupVariant, subType = table.unpack(fireArgs)
30395
+ local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
30396
+ return (callbackPickupVariant == nil or callbackPickupVariant == pickupVariant) and (callbackPickupSubType == nil or callbackPickupSubType == subType)
30397
+ end
30396
30398
  self.postPickupSelection = function(____, pickup, variant, subType) return self:fire(pickup, variant, subType) end
30397
30399
  self.callbacksUsed = {{ModCallback.POST_PICKUP_SELECTION, self.postPickupSelection}}
30398
30400
  end
@@ -35180,9 +35182,12 @@ local REBIRTH_ITEM_TRACKER_WRITE_TO_FILE_COMMAND = "REBIRTH_ITEM_TRACKER_WRITE_T
35180
35182
  function ____exports.rebirthItemTrackerWriteToFile(self, msg)
35181
35183
  Isaac.DebugString((REBIRTH_ITEM_TRACKER_WRITE_TO_FILE_COMMAND .. " ") .. msg)
35182
35184
  end
35183
- function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
35184
- local collectibleName = getCollectibleName(nil, collectibleType)
35185
- Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
35185
+ function ____exports.removeCollectibleFromItemTracker(self, ...)
35186
+ local collectibleTypes = {...}
35187
+ for ____, collectibleType in ipairs(collectibleTypes) do
35188
+ local collectibleName = getCollectibleName(nil, collectibleType)
35189
+ Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
35190
+ end
35186
35191
  end
35187
35192
  return ____exports
35188
35193
  end,
@@ -1,9 +1,16 @@
1
+ import type { PickupVariant } from "isaac-typescript-definitions";
1
2
  import type { ModCallbackCustom } from "../../enums/ModCallbackCustom";
2
- import { shouldFirePickup } from "../../shouldFire";
3
3
  import { CustomCallback } from "../private/CustomCallback";
4
- export declare class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.POST_PICKUP_SELECTION_FILTER> {
4
+ type T = ModCallbackCustom.POST_PICKUP_SELECTION_FILTER;
5
+ export declare class PostPickupSelectionFilter extends CustomCallback<T> {
5
6
  constructor();
6
- protected shouldFire: typeof shouldFirePickup;
7
+ /**
8
+ * We cannot use the `shouldFirePickup` helper function because in the case of non-collectibles,
9
+ * `EntityPickup.Type` and `EntityPickup.Variant` and `EntityPickup.SubType` will all be set to 0
10
+ * in this callback.
11
+ */
12
+ protected shouldFire: (fireArgs: [pickup: EntityPickup, variant: PickupVariant, subType: int], optionalArgs: [pickupVariant?: PickupVariant | undefined, subType?: int | undefined]) => boolean;
7
13
  private readonly postPickupSelection;
8
14
  }
15
+ export {};
9
16
  //# sourceMappingURL=PostPickupSelectionFilter.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"PostPickupSelectionFilter.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostPickupSelectionFilter.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AACvE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AACpD,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,iBAAiB,CAAC,4BAA4B,CAAC;;IAU3G,UAAmB,UAAU,0BAAoB;IAGjD,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIuC;CAC5E"}
1
+ {"version":3,"file":"PostPickupSelectionFilter.d.ts","sourceRoot":"","sources":["../../../../src/classes/callbacks/PostPickupSelectionFilter.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,8BAA8B,CAAC;AAElE,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,+BAA+B,CAAC;AAEvE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAC;AAE3D,KAAK,CAAC,GAAG,iBAAiB,CAAC,4BAA4B,CAAC;AAExD,qBAAa,yBAA0B,SAAQ,cAAc,CAAC,CAAC,CAAC;;IAU9D;;;;OAIG;IACH,UAAmB,UAAU,oKAG1B,OAAO,CASR;IAGF,OAAO,CAAC,QAAQ,CAAC,mBAAmB,CAIuC;CAC5E"}
@@ -4,8 +4,6 @@ local __TS__ClassExtends = ____lualib.__TS__ClassExtends
4
4
  local ____exports = {}
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
6
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
7
- local ____shouldFire = require("src.shouldFire")
8
- local shouldFirePickup = ____shouldFire.shouldFirePickup
9
7
  local ____CustomCallback = require("src.classes.private.CustomCallback")
10
8
  local CustomCallback = ____CustomCallback.CustomCallback
11
9
  ____exports.PostPickupSelectionFilter = __TS__Class()
@@ -14,7 +12,11 @@ PostPickupSelectionFilter.name = "PostPickupSelectionFilter"
14
12
  __TS__ClassExtends(PostPickupSelectionFilter, CustomCallback)
15
13
  function PostPickupSelectionFilter.prototype.____constructor(self)
16
14
  CustomCallback.prototype.____constructor(self)
17
- self.shouldFire = shouldFirePickup
15
+ self.shouldFire = function(____, fireArgs, optionalArgs)
16
+ local _pickup, pickupVariant, subType = table.unpack(fireArgs)
17
+ local callbackPickupVariant, callbackPickupSubType = table.unpack(optionalArgs)
18
+ return (callbackPickupVariant == nil or callbackPickupVariant == pickupVariant) and (callbackPickupSubType == nil or callbackPickupSubType == subType)
19
+ end
18
20
  self.postPickupSelection = function(____, pickup, variant, subType) return self:fire(pickup, variant, subType) end
19
21
  self.callbacksUsed = {{ModCallback.POST_PICKUP_SELECTION, self.postPickupSelection}}
20
22
  end
@@ -24,6 +24,9 @@ export declare function rebirthItemTrackerWriteToFile(msg: string): void;
24
24
  * this function is not necessary when removing items from players. For example, when you remove a
25
25
  * collectible with the `EntityPlayer.RemoveCollectible` method, a proper message is sent to the log
26
26
  * the item tracker will automatically remove it.
27
+ *
28
+ * This function is variadic, meaning that you can pass as many collectible types as you want to
29
+ * remove.
27
30
  */
28
- export declare function removeCollectibleFromItemTracker(collectibleType: CollectibleType): void;
31
+ export declare function removeCollectibleFromItemTracker(...collectibleTypes: CollectibleType[]): void;
29
32
  //# sourceMappingURL=external.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/functions/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED;;;;;;;;;;;GAWG;AACH,wBAAgB,gCAAgC,CAC9C,eAAe,EAAE,eAAe,GAC/B,IAAI,CAQN"}
1
+ {"version":3,"file":"external.d.ts","sourceRoot":"","sources":["../../../src/functions/external.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,8BAA8B,CAAC;AAMpE;;;;;;;GAOG;AACH,wBAAgB,6BAA6B,CAAC,GAAG,EAAE,MAAM,GAAG,IAAI,CAI/D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,gCAAgC,CAC9C,GAAG,gBAAgB,EAAE,eAAe,EAAE,GACrC,IAAI,CAUN"}
@@ -21,8 +21,14 @@ end
21
21
  -- this function is not necessary when removing items from players. For example, when you remove a
22
22
  -- collectible with the `EntityPlayer.RemoveCollectible` method, a proper message is sent to the log
23
23
  -- the item tracker will automatically remove it.
24
- function ____exports.removeCollectibleFromItemTracker(self, collectibleType)
25
- local collectibleName = getCollectibleName(nil, collectibleType)
26
- Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
24
+ --
25
+ -- This function is variadic, meaning that you can pass as many collectible types as you want to
26
+ -- remove.
27
+ function ____exports.removeCollectibleFromItemTracker(self, ...)
28
+ local collectibleTypes = {...}
29
+ for ____, collectibleType in ipairs(collectibleTypes) do
30
+ local collectibleName = getCollectibleName(nil, collectibleType)
31
+ Isaac.DebugString(((("Removing collectible " .. tostring(collectibleType)) .. " (") .. collectibleName) .. ") on player 0 (Player)")
32
+ end
27
33
  end
28
34
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "35.0.0",
3
+ "version": "35.1.0",
4
4
  "description": "Helper functions and features for IsaacScript mods.",
5
5
  "keywords": [
6
6
  "isaac",
@@ -1,10 +1,12 @@
1
1
  import type { PickupVariant } from "isaac-typescript-definitions";
2
2
  import { ModCallback } from "isaac-typescript-definitions";
3
3
  import type { ModCallbackCustom } from "../../enums/ModCallbackCustom";
4
- import { shouldFirePickup } from "../../shouldFire";
4
+ import type { FireArgs, OptionalArgs } from "../private/CustomCallback";
5
5
  import { CustomCallback } from "../private/CustomCallback";
6
6
 
7
- export class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.POST_PICKUP_SELECTION_FILTER> {
7
+ type T = ModCallbackCustom.POST_PICKUP_SELECTION_FILTER;
8
+
9
+ export class PostPickupSelectionFilter extends CustomCallback<T> {
8
10
  constructor() {
9
11
  super();
10
12
 
@@ -14,7 +16,24 @@ export class PostPickupSelectionFilter extends CustomCallback<ModCallbackCustom.
14
16
  ];
15
17
  }
16
18
 
17
- protected override shouldFire = shouldFirePickup;
19
+ /**
20
+ * We cannot use the `shouldFirePickup` helper function because in the case of non-collectibles,
21
+ * `EntityPickup.Type` and `EntityPickup.Variant` and `EntityPickup.SubType` will all be set to 0
22
+ * in this callback.
23
+ */
24
+ protected override shouldFire = (
25
+ fireArgs: FireArgs<T>,
26
+ optionalArgs: OptionalArgs<T>,
27
+ ): boolean => {
28
+ const [_pickup, pickupVariant, subType] = fireArgs;
29
+ const [callbackPickupVariant, callbackPickupSubType] = optionalArgs;
30
+
31
+ return (
32
+ (callbackPickupVariant === undefined ||
33
+ callbackPickupVariant === pickupVariant) &&
34
+ (callbackPickupSubType === undefined || callbackPickupSubType === subType)
35
+ );
36
+ };
18
37
 
19
38
  // ModCallback.POST_PICKUP_SELECTION (37)
20
39
  private readonly postPickupSelection = (
@@ -35,15 +35,20 @@ export function rebirthItemTrackerWriteToFile(msg: string): void {
35
35
  * this function is not necessary when removing items from players. For example, when you remove a
36
36
  * collectible with the `EntityPlayer.RemoveCollectible` method, a proper message is sent to the log
37
37
  * the item tracker will automatically remove it.
38
+ *
39
+ * This function is variadic, meaning that you can pass as many collectible types as you want to
40
+ * remove.
38
41
  */
39
42
  export function removeCollectibleFromItemTracker(
40
- collectibleType: CollectibleType,
43
+ ...collectibleTypes: CollectibleType[]
41
44
  ): void {
42
- const collectibleName = getCollectibleName(collectibleType);
45
+ for (const collectibleType of collectibleTypes) {
46
+ const collectibleName = getCollectibleName(collectibleType);
43
47
 
44
- // This cannot use the "log" function since the prefix will prevent the Rebirth Item Tracker from
45
- // recognizing the message.
46
- Isaac.DebugString(
47
- `Removing collectible ${collectibleType} (${collectibleName}) on player 0 (Player)`,
48
- );
48
+ // This cannot use the "log" function since the prefix will prevent the Rebirth Item Tracker
49
+ // from recognizing the message.
50
+ Isaac.DebugString(
51
+ `Removing collectible ${collectibleType} (${collectibleName}) on player 0 (Player)`,
52
+ );
53
+ }
49
54
  }