isaacscript-common 2.0.16 → 2.0.17

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.
@@ -3,7 +3,7 @@ local __TS__New = ____lualib.__TS__New
3
3
  local ____exports = {}
4
4
  local hasSubscriptions, postPEffectUpdateReordered, queueEmpty, queueNotEmpty, v
5
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
6
- local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
6
+ local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
7
7
  local ____DefaultMap = require("classes.DefaultMap")
8
8
  local DefaultMap = ____DefaultMap.DefaultMap
9
9
  local ____ModCallbackCustom = require("enums.ModCallbackCustom")
@@ -36,7 +36,7 @@ function postPEffectUpdateReordered(self, player)
36
36
  end
37
37
  end
38
38
  function queueEmpty(self, player, pickingUpItem)
39
- if pickingUpItem.subType == CollectibleType.NULL then
39
+ if pickingUpItem.itemType == ItemType.NULL or pickingUpItem.subType == 0 then
40
40
  return
41
41
  end
42
42
  postItemPickupFire(nil, player, pickingUpItem)
@@ -44,7 +44,7 @@ function queueEmpty(self, player, pickingUpItem)
44
44
  end
45
45
  function queueNotEmpty(self, player, pickingUpItem)
46
46
  local queuedItem = player.QueuedItem.Item
47
- if queuedItem == nil then
47
+ if queuedItem == nil or queuedItem.Type == ItemType.NULL then
48
48
  return
49
49
  end
50
50
  if queuedItem.Type ~= pickingUpItem.itemType or queuedItem.ID ~= pickingUpItem.subType then
@@ -1,7 +1,11 @@
1
1
  import { CollectibleType, ItemType, TrinketType } from "isaac-typescript-definitions";
2
- import { PickingUpItem } from "../../types/PickingUpItem";
3
- export declare type PostItemPickupRegisterParameters = [
4
- callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void,
5
- itemType?: ItemType,
6
- itemID?: CollectibleType | TrinketType
2
+ import { PickingUpItem, PickingUpItemCollectible, PickingUpItemTrinket } from "../../types/PickingUpItem";
3
+ export declare type PostItemPickupRegisterParameters = [callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void] | [
4
+ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemCollectible) => void,
5
+ itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR,
6
+ collectibleType?: CollectibleType
7
+ ] | [
8
+ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemTrinket) => void,
9
+ itemType: ItemType.TRINKET,
10
+ trinketType?: TrinketType
7
11
  ];
@@ -11,12 +11,12 @@ function ____exports.postItemPickupFire(self, player, pickingUpItem)
11
11
  for ____, ____value in ipairs(subscriptions) do
12
12
  local callback = ____value[1]
13
13
  local itemType = ____value[2]
14
- local itemID = ____value[3]
14
+ local subType = ____value[3]
15
15
  do
16
16
  if itemType ~= nil and itemType ~= pickingUpItem.itemType then
17
17
  goto __continue5
18
18
  end
19
- if itemID ~= nil and itemID ~= pickingUpItem.subType then
19
+ if subType ~= nil and subType ~= pickingUpItem.subType then
20
20
  goto __continue5
21
21
  end
22
22
  callback(nil, player, pickingUpItem)
@@ -1,7 +1,11 @@
1
1
  import { CollectibleType, ItemType, TrinketType } from "isaac-typescript-definitions";
2
- import { PickingUpItem } from "../../types/PickingUpItem";
3
- export declare type PreItemPickupRegisterParameters = [
4
- callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void,
5
- itemType?: ItemType,
6
- itemID?: CollectibleType | TrinketType
2
+ import { PickingUpItem, PickingUpItemCollectible, PickingUpItemTrinket } from "../../types/PickingUpItem";
3
+ export declare type PreItemPickupRegisterParameters = [callback: (player: EntityPlayer, pickingUpItem: PickingUpItem) => void] | [
4
+ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemCollectible) => void,
5
+ itemType: ItemType.PASSIVE | ItemType.ACTIVE | ItemType.FAMILIAR,
6
+ collectibleType?: CollectibleType
7
+ ] | [
8
+ callback: (player: EntityPlayer, pickingUpItem: PickingUpItemTrinket) => void,
9
+ itemType: ItemType.TRINKET,
10
+ trinketType?: TrinketType
7
11
  ];
@@ -11,12 +11,12 @@ function ____exports.preItemPickupFire(self, player, pickingUpItem)
11
11
  for ____, ____value in ipairs(subscriptions) do
12
12
  local callback = ____value[1]
13
13
  local itemType = ____value[2]
14
- local itemID = ____value[3]
14
+ local subType = ____value[3]
15
15
  do
16
16
  if itemType ~= nil and itemType ~= pickingUpItem.itemType then
17
17
  goto __continue5
18
18
  end
19
- if itemID ~= nil and itemID ~= pickingUpItem.subType then
19
+ if subType ~= nil and subType ~= pickingUpItem.subType then
20
20
  goto __continue5
21
21
  end
22
22
  callback(nil, player, pickingUpItem)
@@ -1,13 +1,12 @@
1
1
  local ____lualib = require("lualib_bundle")
2
- local Set = ____lualib.Set
3
2
  local __TS__New = ____lualib.__TS__New
3
+ local Set = ____lualib.Set
4
4
  local __TS__Iterator = ____lualib.__TS__Iterator
5
5
  local __TS__ArrayFilter = ____lualib.__TS__ArrayFilter
6
6
  local ____exports = {}
7
- local newPlayerInventory, useItemD4, postGameStarted, postItemPickup, addCollectibleToInventory, COLLECTIBLE_ITEM_TYPES, v
7
+ local newPlayerInventory, useItemD4, postGameStarted, postItemPickup, addCollectibleToInventory, v
8
8
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
9
9
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
10
- local ItemType = ____isaac_2Dtypescript_2Ddefinitions.ItemType
11
10
  local ModCallback = ____isaac_2Dtypescript_2Ddefinitions.ModCallback
12
11
  local ____DefaultMap = require("classes.DefaultMap")
13
12
  local DefaultMap = ____DefaultMap.DefaultMap
@@ -27,6 +26,8 @@ local getAllPlayers = ____playerIndex.getAllPlayers
27
26
  local getPlayerIndex = ____playerIndex.getPlayerIndex
28
27
  local ____utils = require("functions.utils")
29
28
  local ____repeat = ____utils["repeat"]
29
+ local ____PickingUpItem = require("types.PickingUpItem")
30
+ local pickingUpItemIsCollectible = ____PickingUpItem.pickingUpItemIsCollectible
30
31
  local ____exports = require("features.saveDataManager.exports")
31
32
  local saveDataManager = ____exports.saveDataManager
32
33
  function newPlayerInventory(self, player)
@@ -59,7 +60,7 @@ function postGameStarted(self)
59
60
  end
60
61
  end
61
62
  function postItemPickup(self, player, pickingUpItem)
62
- if not COLLECTIBLE_ITEM_TYPES:has(pickingUpItem.itemType) then
63
+ if not pickingUpItemIsCollectible(nil, pickingUpItem) then
63
64
  return
64
65
  end
65
66
  addCollectibleToInventory(nil, player, pickingUpItem.subType)
@@ -83,7 +84,6 @@ function addCollectibleToInventory(self, player, collectibleType)
83
84
  end
84
85
  end
85
86
  local FEATURE_NAME = "player inventory tracker"
86
- COLLECTIBLE_ITEM_TYPES = __TS__New(Set, {ItemType.PASSIVE, ItemType.ACTIVE, ItemType.FAMILIAR})
87
87
  v = {run = {
88
88
  playersInventory = __TS__New(
89
89
  DefaultMap,
@@ -20,3 +20,5 @@ export interface PickingUpItemTrinket {
20
20
  }
21
21
  export declare function newPickingUpItem(): PickingUpItem;
22
22
  export declare function resetPickingUpItem(pickingUpItem: PickingUpItem): void;
23
+ export declare function pickingUpItemIsCollectible(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemCollectible;
24
+ export declare function pickingUpItemIsTrinket(pickingUpItem: PickingUpItem): pickingUpItem is PickingUpItemTrinket;
@@ -1,3 +1,6 @@
1
+ local ____lualib = require("lualib_bundle")
2
+ local Set = ____lualib.Set
3
+ local __TS__New = ____lualib.__TS__New
1
4
  local ____exports = {}
2
5
  local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
3
6
  local CollectibleType = ____isaac_2Dtypescript_2Ddefinitions.CollectibleType
@@ -11,4 +14,11 @@ function ____exports.resetPickingUpItem(self, pickingUpItem)
11
14
  pickingUpItem.itemType = DEFAULT_ITEM_TYPE
12
15
  pickingUpItem.subType = DEFAULT_SUB_TYPE
13
16
  end
17
+ local COLLECTIBLE_ITEM_TYPES = __TS__New(Set, {ItemType.PASSIVE, ItemType.ACTIVE, ItemType.FAMILIAR})
18
+ function ____exports.pickingUpItemIsCollectible(self, pickingUpItem)
19
+ return COLLECTIBLE_ITEM_TYPES:has(pickingUpItem.itemType)
20
+ end
21
+ function ____exports.pickingUpItemIsTrinket(self, pickingUpItem)
22
+ return pickingUpItem.itemType == ItemType.TRINKET
23
+ end
14
24
  return ____exports
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "2.0.16",
3
+ "version": "2.0.17",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",