isaacscript-common 1.0.484 → 1.0.488

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.
@@ -27,11 +27,6 @@ export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
27
27
  export declare const GENESIS_ROOM_VARIANT = 1000;
28
28
  export declare const GENESIS_ROOM_SUBTYPE = 99;
29
29
  export declare const GOLDEN_TRINKET_SHIFT: number;
30
- /**
31
- * This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
32
- * GridEntityType and the variant used by the game.
33
- */
34
- export declare const GRID_ENTITY_XML_MAP: Map<GridEntityXMLType, [GridEntityType, number]>;
35
30
  export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
36
31
  export declare const GAME_FRAMES_PER_SECOND = 30;
37
32
  export declare const ISAAC_FRAMES_PER_SECOND = 60;
@@ -70,7 +65,6 @@ export declare const MAX_ROOM_INDEX = 168;
70
65
  export declare const MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING;
71
66
  export declare const MOVEMENT_ACTIONS: Set<ButtonAction>;
72
67
  export declare const ONE_BY_ONE_ROOM_GRID_SIZE = 135;
73
- export declare const ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP: Map<RoomType, ItemPoolType>;
74
68
  export declare const SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES: Set<CollectibleType>;
75
69
  export declare const SHOOTING_ACTIONS: Set<ButtonAction>;
76
70
  /**
@@ -13,7 +13,6 @@ ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
13
13
  ____exports.GENESIS_ROOM_VARIANT = 1000
14
14
  ____exports.GENESIS_ROOM_SUBTYPE = 99
15
15
  ____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
16
- ____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {{1000, {GridEntityType.GRID_ROCK, 0}}, {1001, {GridEntityType.GRID_ROCK_BOMB, 0}}, {1002, {GridEntityType.GRID_ROCK_ALT, 0}}, {1003, {GridEntityType.GRID_ROCKT, 0}}, {1008, {GridEntityType.GRID_ROCK_ALT2, 0}}, {1009, {GridEntityType.GRID_ROCK_ALT2, 1}}, {1010, {GridEntityType.GRID_ROCK_SPIKED, 0}}, {1011, {GridEntityType.GRID_ROCK_GOLD, 0}}, {1300, {GridEntityType.GRID_TNT, 0}}, {1490, {GridEntityType.GRID_POOP, 1}}, {1494, {GridEntityType.GRID_POOP, 4}}, {1495, {GridEntityType.GRID_POOP, 2}}, {1496, {GridEntityType.GRID_POOP, 3}}, {1497, {GridEntityType.GRID_POOP, 5}}, {1498, {GridEntityType.GRID_POOP, 6}}, {1500, {GridEntityType.GRID_POOP, 0}}, {1501, {GridEntityType.GRID_POOP, 11}}, {1900, {GridEntityType.GRID_ROCKB, 0}}, {1901, {GridEntityType.GRID_PILLAR, 0}}, {1930, {GridEntityType.GRID_SPIKES, 0}}, {1931, {GridEntityType.GRID_SPIKES_ONOFF, 0}}, {1940, {GridEntityType.GRID_SPIDERWEB, 0}}, {1999, {GridEntityType.GRID_WALL, 0}}, {3000, {GridEntityType.GRID_PIT, 0}}, {3001, {GridEntityType.GRID_PIT, 16}}, {3009, {GridEntityType.GRID_PIT, 0}}, {4000, {GridEntityType.GRID_LOCK, 0}}, {4500, {GridEntityType.GRID_PRESSURE_PLATE, 0}}, {5000, {GridEntityType.GRID_STATUE, 0}}, {5001, {GridEntityType.GRID_STATUE, 1}}, {6100, {GridEntityType.GRID_TELEPORTER, 0}}, {9000, {GridEntityType.GRID_TRAPDOOR, 0}}, {9100, {GridEntityType.GRID_STAIRS, 0}}, {10000, {GridEntityType.GRID_GRAVITY, 0}}})
17
16
  ____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
18
17
  ____exports.GAME_FRAMES_PER_SECOND = 30
19
18
  ____exports.ISAAC_FRAMES_PER_SECOND = 60
@@ -29,7 +28,6 @@ ____exports.MAX_ROOM_INDEX = 168
29
28
  ____exports.MAX_VANILLA_COLLECTIBLE_TYPE = CollectibleType.COLLECTIBLE_MOMS_RING
30
29
  ____exports.MOVEMENT_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_LEFT, ButtonAction.ACTION_RIGHT, ButtonAction.ACTION_UP, ButtonAction.ACTION_DOWN})
31
30
  ____exports.ONE_BY_ONE_ROOM_GRID_SIZE = 135
32
- ____exports.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = __TS__New(Map, {{RoomType.ROOM_SHOP, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_TREASURE, ItemPoolType.POOL_TREASURE}, {RoomType.ROOM_BOSS, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_SECRET, ItemPoolType.POOL_SECRET}, {RoomType.ROOM_CURSE, ItemPoolType.POOL_CURSE}, {RoomType.ROOM_CHALLENGE, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_LIBRARY, ItemPoolType.POOL_LIBRARY}, {RoomType.ROOM_DEVIL, ItemPoolType.POOL_DEVIL}, {RoomType.ROOM_ANGEL, ItemPoolType.POOL_ANGEL}, {RoomType.ROOM_CHEST, ItemPoolType.POOL_GOLDEN_CHEST}, {RoomType.ROOM_BLACK_MARKET, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_PLANETARIUM, ItemPoolType.POOL_PLANETARIUM}, {RoomType.ROOM_ULTRASECRET, ItemPoolType.POOL_ULTRA_SECRET}})
33
31
  ____exports.SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES = __TS__New(Set, {CollectibleType.COLLECTIBLE_FORGET_ME_NOW, CollectibleType.COLLECTIBLE_EDENS_SOUL, CollectibleType.COLLECTIBLE_ALABASTER_BOX, CollectibleType.COLLECTIBLE_PLAN_C, CollectibleType.COLLECTIBLE_MAMA_MEGA, CollectibleType.COLLECTIBLE_SACRIFICIAL_ALTAR, CollectibleType.COLLECTIBLE_DEATH_CERTIFICATE, CollectibleType.COLLECTIBLE_R_KEY})
34
32
  ____exports.SHOOTING_ACTIONS = __TS__New(Set, {ButtonAction.ACTION_SHOOTLEFT, ButtonAction.ACTION_SHOOTRIGHT, ButtonAction.ACTION_SHOOTUP, ButtonAction.ACTION_SHOOTDOWN})
35
33
  ____exports.UI_HEART_WIDTH = 12
@@ -28,16 +28,28 @@ export declare function arrayShuffleInPlace<T>(array: T[], seed?: number): void;
28
28
  export declare function arraySum(array: int[]): int;
29
29
  export declare function arrayToString<T>(array: T[]): string;
30
30
  /**
31
- * Shallow copies and removes the specified element from the array. Returns the copied array. If the
32
- * specified element is not found in the array, it will simply return a shallow copy of the array.
31
+ * Shallow copies and removes the specified element(s) from the array. Returns the copied array. If
32
+ * the specified element(s) are not found in the array, it will simply return a shallow copy of the
33
+ * array.
34
+ *
35
+ * This function is variadic, meaning that you can specify N arguments to remove N elements.
33
36
  */
34
- export declare function arrayRemove<T>(originalArray: T[], element: T): T[];
37
+ export declare function arrayRemove<T>(originalArray: T[], ...elements: T[]): T[];
35
38
  /**
36
- * Removes the specified element from the array. If the specified element is not found in the array,
37
- * this function will do nothing. Returns whether or not the element was found.
39
+ * Removes the specified element(s) from the array. If the specified element(s) are not found in the
40
+ * array, this function will do nothing. Returns whether or not one or more elements were found.
41
+ *
42
+ * This function is variadic, meaning that you can specify N arguments to remove N elements.
43
+ */
44
+ export declare function arrayRemoveInPlace<T>(array: T[], ...elements: T[]): boolean;
45
+ /**
46
+ * Helper function to get a random element from the provided array.
47
+ *
48
+ * @param array The array to get an element from.
49
+ * @param seed Optional. The seed used to select the random element. `Random()` by default.
50
+ * @param exceptions Optional. An array of elements to skip over if selected.
38
51
  */
39
- export declare function arrayRemoveInPlace<T>(array: T[], element: T): boolean;
40
- export declare function getRandomArrayElement<T>(array: T[], seed?: number): T;
52
+ export declare function getRandomArrayElement<T>(array: T[], seed?: number, exceptions?: T[]): T;
41
53
  export declare function getRandomArrayIndex<T>(array: T[], seed?: number): int;
42
54
  /**
43
55
  * Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
@@ -91,28 +91,43 @@ function ____exports.arrayToString(self, array)
91
91
  end
92
92
  return ("[" .. table.concat(strings, ", " or ",")) .. "]"
93
93
  end
94
- function ____exports.arrayRemove(self, originalArray, element)
94
+ function ____exports.arrayRemove(self, originalArray, ...)
95
+ local elements = {...}
95
96
  local array = {
96
97
  table.unpack(originalArray)
97
98
  }
98
- local index = __TS__ArrayIndexOf(array, element)
99
- __TS__ArraySplice(array, index, 1)
99
+ for ____, element in ipairs(elements) do
100
+ local index = __TS__ArrayIndexOf(array, element)
101
+ __TS__ArraySplice(array, index, 1)
102
+ end
100
103
  return array
101
104
  end
102
- function ____exports.arrayRemoveInPlace(self, array, element)
103
- local index = __TS__ArrayIndexOf(array, element)
104
- if index == -1 then
105
- return false
105
+ function ____exports.arrayRemoveInPlace(self, array, ...)
106
+ local elements = {...}
107
+ local removedOneOrMoreElements = false
108
+ for ____, element in ipairs(elements) do
109
+ local index = __TS__ArrayIndexOf(array, element)
110
+ if index > -1 then
111
+ removedOneOrMoreElements = true
112
+ __TS__ArraySplice(array, index, 1)
113
+ end
106
114
  end
107
- __TS__ArraySplice(array, index, 1)
108
- return true
115
+ return removedOneOrMoreElements
109
116
  end
110
- function ____exports.getRandomArrayElement(self, array, seed)
117
+ function ____exports.getRandomArrayElement(self, array, seed, exceptions)
111
118
  if seed == nil then
112
119
  seed = Random()
113
120
  end
114
- local randomIndex = ____exports.getRandomArrayIndex(nil, array, seed)
115
- return array[randomIndex + 1]
121
+ if exceptions == nil then
122
+ exceptions = {}
123
+ end
124
+ local arrayWithoutExceptions = ____exports.arrayRemove(
125
+ nil,
126
+ array,
127
+ table.unpack(exceptions)
128
+ )
129
+ local randomIndex = ____exports.getRandomArrayIndex(nil, arrayWithoutExceptions, seed)
130
+ return arrayWithoutExceptions[randomIndex + 1]
116
131
  end
117
132
  function ____exports.isArray(self, ____table)
118
133
  local metatable = getmetatable(____table)
@@ -21,25 +21,31 @@ export declare function getCardDescription(card: Card | int): string;
21
21
  export declare function getCardName(card: Card | int): string;
22
22
  /**
23
23
  * Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.). This will
24
- * not return any runes or objects.
24
+ * not return any runes or objects like Dice Shard.
25
+ *
26
+ * @param seed Optional. The seed with which to select the random card. `Random()` by default.
27
+ * @param exceptions Optional. An array of cards to not select.
25
28
  */
26
- export declare function getRandomCard(seed?: number): Card;
29
+ export declare function getRandomCard(seed?: number, exceptions?: Card[]): Card;
27
30
  /**
28
31
  * Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
29
32
  * Isaac, etc.). This will never return a Rune Shard.
33
+ *
34
+ * @param seed Optional. The seed with which to select the random rune. `Random()` by default.
35
+ * @param exceptions Optional. An array of runes to not select.
30
36
  */
31
- export declare function getRandomRune(seed?: number): Card;
37
+ export declare function getRandomRune(seed?: number, exceptions?: Card[]): Card;
32
38
  /**
33
- * Returns true for entries in the Card enum that are not a rune or an object (e.g. Fool, Reverse
34
- * Fool, Wild Card, etc.).
39
+ * Returns true for entries in the Card enum that are not a rune and not an object (e.g. Fool,
40
+ * Reverse Fool, Wild Card, etc.).
35
41
  */
36
42
  export declare function isCard(card: Card): boolean;
37
43
  /**
38
- * Returns true for entries in the Card enum that are not a card and not a rune (like Dice Shard).
44
+ * Returns true for entries in the Card enum that are an object (like Dice Shard).
39
45
  */
40
- export declare function isNotCardOrRune(card: Card): boolean;
46
+ export declare function isPocketItemObject(card: Card): boolean;
41
47
  /**
42
- * Returns true for entries in the Card enum that are a rune. (e.g. Rune of Hagalaz, Blank Rune,
43
- * Black Rune, Rune Shard, Soul of Isaac, etc.)
48
+ * Returns true for entries in the Card enum that are a rune (e.g. Rune of Hagalaz, Blank Rune,
49
+ * Black Rune, Rune Shard, Soul of Isaac, etc.).
44
50
  */
45
51
  export declare function isRune(card: Card): boolean;
@@ -1,21 +1,19 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
4
  local ____cardDescriptionMap = require("maps.cardDescriptionMap")
4
5
  local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
5
6
  local ____cardNameMap = require("maps.cardNameMap")
6
7
  local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
7
- local ____random = require("functions.random")
8
- local getRandomInt = ____random.getRandomInt
9
- local nextSeed = ____random.nextSeed
10
- function ____exports.isCard(self, card)
11
- return ____exports.isNotCardOrRune(nil, card) and (not ____exports.isRune(nil, card))
12
- end
13
- function ____exports.isNotCardOrRune(self, card)
14
- return ((card == Card.CARD_DICE_SHARD) or (card == Card.CARD_EMERGENCY_CONTACT)) or (card == Card.CARD_CRACKED_KEY)
15
- end
16
- function ____exports.isRune(self, card)
17
- return (((card >= Card.RUNE_HAGALAZ) and (card <= Card.RUNE_BLACK)) or (card == Card.RUNE_SHARD)) or ((card >= Card.CARD_SOUL_ISAAC) and (card <= Card.CARD_SOUL_JACOB))
18
- end
8
+ local ____cards = require("sets.cards")
9
+ local CARDS = ____cards.CARDS
10
+ local CARD_SET = ____cards.CARD_SET
11
+ local POCKET_ITEM_OBJECT_SET = ____cards.POCKET_ITEM_OBJECT_SET
12
+ local RUNES = ____cards.RUNES
13
+ local RUNE_SET = ____cards.RUNE_SET
14
+ local ____array = require("functions.array")
15
+ local arrayRemove = ____array.arrayRemove
16
+ local getRandomArrayElement = ____array.getRandomArrayElement
19
17
  function ____exports.getCardDescription(self, card)
20
18
  local itemConfig = Isaac.GetItemConfig()
21
19
  local defaultDescription = "Unknown"
@@ -48,30 +46,42 @@ function ____exports.getCardName(self, card)
48
46
  end
49
47
  return itemConfigCard.Name
50
48
  end
51
- function ____exports.getRandomCard(self, seed)
49
+ function ____exports.getRandomCard(self, seed, exceptions)
52
50
  if seed == nil then
53
51
  seed = Random()
54
52
  end
55
- local card
56
- repeat
57
- do
58
- seed = nextSeed(nil, seed)
59
- card = getRandomInt(nil, 1, Card.NUM_CARDS - 1)
60
- end
61
- until ____exports.isCard(nil, card)
62
- return card
53
+ if exceptions == nil then
54
+ exceptions = {}
55
+ end
56
+ local cardsWithoutExceptions = arrayRemove(
57
+ nil,
58
+ CARDS,
59
+ table.unpack(exceptions)
60
+ )
61
+ return getRandomArrayElement(nil, cardsWithoutExceptions, seed)
63
62
  end
64
- function ____exports.getRandomRune(self, seed)
63
+ function ____exports.getRandomRune(self, seed, exceptions)
65
64
  if seed == nil then
66
65
  seed = Random()
67
66
  end
68
- local card
69
- repeat
70
- do
71
- seed = nextSeed(nil, seed)
72
- card = getRandomInt(nil, 1, Card.NUM_CARDS - 1)
73
- end
74
- until not ((not ____exports.isRune(nil, card)) or (card == Card.RUNE_SHARD))
75
- return card
67
+ if exceptions == nil then
68
+ exceptions = {}
69
+ end
70
+ __TS__ArrayPush(exceptions, Card.RUNE_SHARD)
71
+ local runesWithoutExceptions = arrayRemove(
72
+ nil,
73
+ RUNES,
74
+ table.unpack(exceptions)
75
+ )
76
+ return getRandomArrayElement(nil, runesWithoutExceptions, seed)
77
+ end
78
+ function ____exports.isCard(self, card)
79
+ return CARD_SET:has(card)
80
+ end
81
+ function ____exports.isPocketItemObject(self, card)
82
+ return POCKET_ITEM_OBJECT_SET:has(card)
83
+ end
84
+ function ____exports.isRune(self, card)
85
+ return RUNE_SET:has(card)
76
86
  end
77
87
  return ____exports
@@ -1,8 +1,8 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
2
  require("lualib_bundle");
3
3
  local ____exports = {}
4
- local ____constants = require("constants")
5
- local GRID_ENTITY_XML_MAP = ____constants.GRID_ENTITY_XML_MAP
4
+ local ____gridEntityXMLMap = require("maps.gridEntityXMLMap")
5
+ local GRID_ENTITY_XML_MAP = ____gridEntityXMLMap.GRID_ENTITY_XML_MAP
6
6
  local ____rooms = require("functions.rooms")
7
7
  local roomUpdateSafe = ____rooms.roomUpdateSafe
8
8
  function ____exports.removeGridEntity(self, gridEntity, updateRoom)
@@ -5,31 +5,28 @@
5
5
  */
6
6
  export declare function getDebugPrependString(msg: string, numParentFunctions?: number): string;
7
7
  /**
8
- * Helper function to avoid typing out `Isaac.DebugString()`.
9
- * If you have the --luadebug launch flag turned on or the Racing+ sandbox enabled,
10
- * then this function will also prepend the function name and the line number before the string.
8
+ * Helper function to avoid typing out `Isaac.DebugString()`. If you have the --luadebug launch flag
9
+ * turned on or the Racing+ sandbox enabled, then this function will also prepend the function name
10
+ * and the line number before the string.
11
11
  */
12
12
  export declare function log(this: void, msg: string): void;
13
- /**
14
- * Helper function for printing out every damage flag that is turned on. Helpful when debugging.
15
- */
13
+ /** Helper function for printing out every damage flag that is turned on. Helpful when debugging. */
16
14
  export declare function logAllDamageFlags(this: void, flags: int): void;
17
- /**
18
- * Helper function for printing out every entity flag that is turned on. Helpful when debugging.
19
- */
15
+ /** Helper function for printing out every entity flag that is turned on. Helpful when debugging. */
20
16
  export declare function logAllEntityFlags(this: void, flags: int): void;
17
+ /** Helper function for printing out every flag that is turned on. Helpful when debugging. */
18
+ export declare function logAllFlags(this: void, flags: int, flagEnum: LuaTable, description?: string): void;
21
19
  /**
22
- * Helper function for printing out every flag that is turned on. Helpful when debugging.
20
+ * Helper function for printing out every game state flag that is turned on. Helpful when debugging.
23
21
  */
24
- export declare function logAllFlags(this: void, flags: int, flagEnum: LuaTable, description?: string): void;
25
22
  export declare function logAllGameStateFlags(this: void): void;
26
23
  /**
27
24
  * Helper function for printing out every projectile flag that is turned on. Helpful when debugging.
28
25
  */
29
26
  export declare function logAllProjectileFlags(this: void, flags: int): void;
30
- /**
31
- * Helper function for printing out every use flag that is turned on. Helpful when debugging.
32
- */
27
+ /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
28
+ export declare function logAllTearFlags(this: void, flags: int): void;
29
+ /** Helper function for printing out every use flag that is turned on. Helpful when debugging. */
33
30
  export declare function logAllUseFlags(this: void, flags: int): void;
34
31
  export declare function logArray<T>(this: void, array: T[]): void;
35
32
  export declare function logColor(this: void, color: Color): void;
@@ -68,6 +68,9 @@ end
68
68
  function ____exports.logAllProjectileFlags(flags)
69
69
  ____exports.logAllFlags(flags, ProjectileFlags, "projectile")
70
70
  end
71
+ function ____exports.logAllTearFlags(flags)
72
+ ____exports.logAllFlags(flags, TearFlags, "tear")
73
+ end
71
74
  function ____exports.logAllUseFlags(flags)
72
75
  ____exports.logAllFlags(flags, UseFlag, "use")
73
76
  end
@@ -1,4 +1,9 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
- /** Has an equal chance of returning any value in the `HeartSubType` enum. */
3
- export declare function getRandomHeartSubType(seed?: number): HeartSubType;
2
+ /**
3
+ * Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
4
+ *
5
+ * @param seed Optional. The seed with which to select the random sub-type. `Random()` by default.
6
+ * @param exceptions Optional. An array of sub-types to not select.
7
+ */
8
+ export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
4
9
  export declare function isChest(pickup: EntityPickup): boolean;
@@ -5,12 +5,15 @@ local ____array = require("functions.array")
5
5
  local getRandomArrayElement = ____array.getRandomArrayElement
6
6
  local ____util = require("functions.util")
7
7
  local getEnumValues = ____util.getEnumValues
8
- function ____exports.getRandomHeartSubType(self, seed)
8
+ function ____exports.getRandomHeartSubType(self, seed, exceptions)
9
9
  if seed == nil then
10
10
  seed = Random()
11
11
  end
12
+ if exceptions == nil then
13
+ exceptions = {}
14
+ end
12
15
  local heartSubTypes = getEnumValues(nil, HeartSubType)
13
- return getRandomArrayElement(nil, heartSubTypes, seed)
16
+ return getRandomArrayElement(nil, heartSubTypes, seed, exceptions)
14
17
  end
15
18
  local CHEST_PICKUP_VARIANTS = __TS__New(Set, {PickupVariant.PICKUP_CHEST, PickupVariant.PICKUP_BOMBCHEST, PickupVariant.PICKUP_SPIKEDCHEST, PickupVariant.PICKUP_ETERNALCHEST, PickupVariant.PICKUP_MIMICCHEST, PickupVariant.PICKUP_OLDCHEST, PickupVariant.PICKUP_WOODENCHEST, PickupVariant.PICKUP_MEGACHEST, PickupVariant.PICKUP_HAUNTEDCHEST, PickupVariant.PICKUP_LOCKEDCHEST, PickupVariant.PICKUP_REDCHEST, PickupVariant.PICKUP_MOMSCHEST})
16
19
  function ____exports.isChest(self, pickup)
@@ -1,6 +1,5 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  import { HealthType } from "../types/HealthType";
3
- import { PocketItemDescription } from "../types/PocketItemDescription";
4
3
  /**
5
4
  * PlayerIndex is a specific type of string; see the documentation for the [[`getPlayerIndex`]]
6
5
  * function. Mods can signify that data structures handle EntityPlayers by using this type:
@@ -47,20 +46,6 @@ export declare function getLastHeart(player: EntityPlayer): HealthType;
47
46
  */
48
47
  export declare function getNewestPlayer(): EntityPlayer;
49
48
  export declare function getFinalPlayer(): EntityPlayer;
50
- /**
51
- * Returns the slot number corresponding to where a trinket can be safely inserted.
52
- *
53
- * Example:
54
- * ```
55
- * const player = Isaac.GetPlayer();
56
- * const trinketSlot = getOpenTrinketSlotNum(player);
57
- * if (trinketSlot !== undefined) {
58
- * // They have one or more open trinket slots
59
- * player.AddTrinket(TrinketType.TRINKET_SWALLOWED_PENNY);
60
- * }
61
- * ```
62
- */
63
- export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
64
49
  /**
65
50
  * Iterates over all players and checks if any are close enough to the specified position.
66
51
  *
@@ -115,17 +100,6 @@ export declare function getPlayerIndexVanilla(playerToFind: EntityPlayer): int |
115
100
  * This is equivalent to the number of hits that the player can currently take.
116
101
  */
117
102
  export declare function getPlayerNumAllHearts(player: EntityPlayer): int;
118
- /**
119
- * Use this helper function as a workaround for `EntityPlayer.GetPocketItem()` not working
120
- * correctly.
121
- *
122
- * Note that due to API limitations, there is no way to determine the location of a Dice Bag trinket
123
- * dice. Furthermore, when the player has a Dice Bag trinket dice and a pocket active at the same
124
- * time, there is no way to determine the location of the pocket active item. If this function
125
- * cannot determine the identity of a particular slot, it will mark the type of the slot as
126
- * `PocketItemType.UNDETERMINABLE`.
127
- */
128
- export declare function getPocketItems(player: EntityPlayer): PocketItemDescription[];
129
103
  /**
130
104
  * Helper function to return the active charge and the battery charge combined. This is useful
131
105
  * because you are not able to set the battery charge directly.
@@ -146,23 +120,6 @@ export declare function hasLostCurse(player: EntityPlayer): boolean;
146
120
  * items. (Only Tainted Forgotten can pick up items.)
147
121
  */
148
122
  export declare function hasOpenActiveItemSlot(player: EntityPlayer): boolean;
149
- /**
150
- * Returns whether or not the player can hold an additional pocket item, beyond what they are
151
- * currently carrying. This takes into account items that modify the max number of pocket items,
152
- * like Starter Deck.
153
- *
154
- * If the player is the Tainted Soul, this always returns false, since that character cannot pick up
155
- * items. (Only Tainted Forgotten can pick up items.)
156
- */
157
- export declare function hasOpenPocketItemSlot(player: EntityPlayer): boolean;
158
- /**
159
- * Returns whether or not the player can hold an additional trinket, beyond what they are currently
160
- * carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
161
- *
162
- * If the player is the Tainted Soul, this always returns false, since that character cannot pick up
163
- * items. (Only Tainted Forgotten can pick up items.)
164
- */
165
- export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
166
123
  /**
167
124
  * Helper function for detecting when a player is Bethany or Tainted Bethany. This is useful if you
168
125
  * need to adjust UI elements to account for Bethany's soul charges or Tainted Bethany's blood
@@ -6,8 +6,6 @@ local ____constants = require("constants")
6
6
  local LOST_STYLE_PLAYER_TYPES = ____constants.LOST_STYLE_PLAYER_TYPES
7
7
  local ____HealthType = require("types.HealthType")
8
8
  local HealthType = ____HealthType.HealthType
9
- local ____PocketItemType = require("types.PocketItemType")
10
- local PocketItemType = ____PocketItemType.PocketItemType
11
9
  local ____bitwise = require("functions.bitwise")
12
10
  local getKBitOfN = ____bitwise.getKBitOfN
13
11
  local getNumBitsOfN = ____bitwise.getNumBitsOfN
@@ -29,18 +27,18 @@ function ____exports.getPlayers(self, performExclusions)
29
27
  do
30
28
  local player = Isaac.GetPlayer(i)
31
29
  if player == nil then
32
- goto __continue55
30
+ goto __continue51
33
31
  end
34
32
  if ____exports.isChildPlayer(nil, player) then
35
- goto __continue55
33
+ goto __continue51
36
34
  end
37
35
  local character = player:GetPlayerType()
38
36
  if performExclusions and EXCLUDED_CHARACTERS:has(character) then
39
- goto __continue55
37
+ goto __continue51
40
38
  end
41
39
  __TS__ArrayPush(players, player)
42
40
  end
43
- ::__continue55::
41
+ ::__continue51::
44
42
  i = i + 1
45
43
  end
46
44
  end
@@ -210,24 +208,6 @@ function ____exports.getFinalPlayer(self)
210
208
  local players = ____exports.getPlayers(nil)
211
209
  return players[#players]
212
210
  end
213
- function ____exports.getOpenTrinketSlot(self, player)
214
- local maxTrinkets = player:GetMaxTrinkets()
215
- local trinket0 = player:GetTrinket(0)
216
- local trinket1 = player:GetTrinket(1)
217
- if maxTrinkets == 1 then
218
- return ((trinket0 == TrinketType.TRINKET_NULL) and 0) or nil
219
- end
220
- if maxTrinkets == 2 then
221
- if trinket0 == TrinketType.TRINKET_NULL then
222
- return 0
223
- end
224
- return ((trinket1 == TrinketType.TRINKET_NULL) and 1) or nil
225
- end
226
- error(
227
- "The player has an unknown number of trinket slots: " .. tostring(maxTrinkets)
228
- )
229
- return nil
230
- end
231
211
  function ____exports.getPlayerCloserThan(self, position, distance)
232
212
  for ____, player in ipairs(
233
213
  ____exports.getPlayers(nil)
@@ -283,14 +263,14 @@ function ____exports.getPlayerIndexVanilla(self, playerToFind)
283
263
  do
284
264
  local player = Isaac.GetPlayer(i)
285
265
  if player == nil then
286
- goto __continue64
266
+ goto __continue60
287
267
  end
288
268
  local playerHash = GetPtrHash(player)
289
269
  if playerHash == playerToFindHash then
290
270
  return i
291
271
  end
292
272
  end
293
- ::__continue64::
273
+ ::__continue60::
294
274
  i = i + 1
295
275
  end
296
276
  end
@@ -303,43 +283,6 @@ function ____exports.getPlayerNumAllHearts(self, player)
303
283
  local eternalHearts = player:GetEternalHearts()
304
284
  return ((hearts + soulHearts) + boneHearts) + eternalHearts
305
285
  end
306
- function ____exports.getPocketItems(self, player)
307
- local pocketItem = player:GetActiveItem(ActiveSlot.SLOT_POCKET)
308
- local hasPocketItem = pocketItem ~= CollectibleType.COLLECTIBLE_NULL
309
- local pocketItem2 = player:GetActiveItem(ActiveSlot.SLOT_POCKET2)
310
- local hasPocketItem2 = pocketItem2 ~= CollectibleType.COLLECTIBLE_NULL
311
- local maxPocketItems = player:GetMaxPocketItems()
312
- local pocketItems = {}
313
- local pocketItemIdentified = false
314
- local pocketItem2Identified = false
315
- do
316
- local slot = 0
317
- while slot < 4 do
318
- local card = player:GetCard(slot)
319
- local pill = player:GetPill(slot)
320
- if card ~= Card.CARD_NULL then
321
- __TS__ArrayPush(pocketItems, {type = PocketItemType.CARD, id = card})
322
- elseif pill ~= PillColor.PILL_NULL then
323
- __TS__ArrayPush(pocketItems, {type = PocketItemType.PILL, id = pill})
324
- elseif (hasPocketItem and (not hasPocketItem2)) and (not pocketItemIdentified) then
325
- pocketItemIdentified = true
326
- __TS__ArrayPush(pocketItems, {type = PocketItemType.ACTIVE_ITEM, id = pocketItem})
327
- elseif ((not hasPocketItem) and hasPocketItem2) and (not pocketItem2Identified) then
328
- pocketItem2Identified = true
329
- __TS__ArrayPush(pocketItems, {type = PocketItemType.DICE_BAG_DICE, id = pocketItem2})
330
- elseif hasPocketItem and hasPocketItem2 then
331
- __TS__ArrayPush(pocketItems, {type = PocketItemType.UNDETERMINABLE, id = 0})
332
- else
333
- __TS__ArrayPush(pocketItems, {type = PocketItemType.EMPTY, id = 0})
334
- end
335
- if (slot + 1) == maxPocketItems then
336
- break
337
- end
338
- slot = slot + 1
339
- end
340
- end
341
- return pocketItems
342
- end
343
286
  function ____exports.getTotalCharge(self, player, activeSlot)
344
287
  local activeCharge = player:GetActiveCharge(activeSlot)
345
288
  local batteryCharge = player:GetBatteryCharge(activeSlot)
@@ -371,27 +314,6 @@ function ____exports.hasOpenActiveItemSlot(self, player)
371
314
  end
372
315
  return activeItemPrimary == CollectibleType.COLLECTIBLE_NULL
373
316
  end
374
- function ____exports.hasOpenPocketItemSlot(self, player)
375
- local character = player:GetPlayerType()
376
- if character == PlayerType.PLAYER_THESOUL_B then
377
- return false
378
- end
379
- local pocketItems = ____exports.getPocketItems(nil, player)
380
- for ____, pocketItem in ipairs(pocketItems) do
381
- if pocketItem.type == PocketItemType.EMPTY then
382
- return true
383
- end
384
- end
385
- return false
386
- end
387
- function ____exports.hasOpenTrinketSlot(self, player)
388
- local character = player:GetPlayerType()
389
- if character == PlayerType.PLAYER_THESOUL_B then
390
- return false
391
- end
392
- local openTrinketSlot = ____exports.getOpenTrinketSlot(nil, player)
393
- return openTrinketSlot ~= nil
394
- end
395
317
  function ____exports.isBethany(self, player)
396
318
  local character = player:GetPlayerType()
397
319
  return (character == PlayerType.PLAYER_BETHANY) or (character == PlayerType.PLAYER_BETHANY_B)
@@ -456,9 +378,9 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
456
378
  itemPool:RemoveCollectible(collectibleType)
457
379
  end
458
380
  repeat
459
- local ____switch106 = activeSlot
460
- local ____cond106 = ____switch106 == ActiveSlot.SLOT_PRIMARY
461
- if ____cond106 then
381
+ local ____switch87 = activeSlot
382
+ local ____cond87 = ____switch87 == ActiveSlot.SLOT_PRIMARY
383
+ if ____cond87 then
462
384
  do
463
385
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
464
386
  player:RemoveCollectible(primaryCollectibleType)
@@ -467,8 +389,8 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
467
389
  break
468
390
  end
469
391
  end
470
- ____cond106 = ____cond106 or (____switch106 == ActiveSlot.SLOT_SECONDARY)
471
- if ____cond106 then
392
+ ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_SECONDARY)
393
+ if ____cond87 then
472
394
  do
473
395
  if primaryCollectibleType ~= CollectibleType.COLLECTIBLE_NULL then
474
396
  player:RemoveCollectible(primaryCollectibleType)
@@ -483,16 +405,16 @@ function ____exports.setActiveItem(self, player, collectibleType, activeSlot, ch
483
405
  break
484
406
  end
485
407
  end
486
- ____cond106 = ____cond106 or (____switch106 == ActiveSlot.SLOT_POCKET)
487
- if ____cond106 then
408
+ ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_POCKET)
409
+ if ____cond87 then
488
410
  do
489
411
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
490
412
  player:SetActiveCharge(charge, activeSlot)
491
413
  break
492
414
  end
493
415
  end
494
- ____cond106 = ____cond106 or (____switch106 == ActiveSlot.SLOT_POCKET2)
495
- if ____cond106 then
416
+ ____cond87 = ____cond87 or (____switch87 == ActiveSlot.SLOT_POCKET2)
417
+ if ____cond87 then
496
418
  do
497
419
  player:SetPocketActiveItem(collectibleType, activeSlot, keepInPools)
498
420
  break
@@ -1,21 +1,23 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
+ import { PocketItemDescription } from "../types/PocketItemDescription";
3
+ export declare function getFirstCardOrPill(player: EntityPlayer): PocketItemDescription | undefined;
2
4
  /**
3
- * This is a helper function to get a card name from a Card.
5
+ * Use this helper function as a workaround for `EntityPlayer.GetPocketItem()` not working
6
+ * correctly.
4
7
  *
5
- * Example:
6
- * ```
7
- * const card = Card.CARD_FOOL;
8
- * const cardName = getCardName(card); // cardName is "0 - The Fool"
9
- * ```
8
+ * Note that due to API limitations, there is no way to determine the location of a Dice Bag trinket
9
+ * dice. Furthermore, when the player has a Dice Bag trinket dice and a pocket active at the same
10
+ * time, there is no way to determine the location of the pocket active item. If this function
11
+ * cannot determine the identity of a particular slot, it will mark the type of the slot as
12
+ * `PocketItemType.UNDETERMINABLE`.
10
13
  */
11
- export declare function getCardName(card: Card | int): string;
14
+ export declare function getPocketItems(player: EntityPlayer): PocketItemDescription[];
12
15
  /**
13
- * This is a helper function to get a pill effect name from a PillEffect.
16
+ * Returns whether or not the player can hold an additional pocket item, beyond what they are
17
+ * currently carrying. This takes into account items that modify the max number of pocket items,
18
+ * like Starter Deck.
14
19
  *
15
- * Example:
16
- * ```
17
- * const pillEffect = PillEffect.PILLEFFECT_BAD_GAS;
18
- * const pillEffectName = getPillEffectName(pillEffect); // trinketName is "Bad Gas"
19
- * ```
20
+ * If the player is the Tainted Soul, this always returns false, since that character cannot pick up
21
+ * items. (Only Tainted Forgotten can pick up items.)
20
22
  */
21
- export declare function getPillEffectName(pillEffect: PillEffect | int): string;
23
+ export declare function hasOpenPocketItemSlot(player: EntityPlayer): boolean;
@@ -1,39 +1,65 @@
1
1
  --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
2
3
  local ____exports = {}
3
- local ____cardNameMap = require("maps.cardNameMap")
4
- local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
5
- local ____pillEffectNameMap = require("maps.pillEffectNameMap")
6
- local PILL_EFFECT_NAME_MAP = ____pillEffectNameMap.PILL_EFFECT_NAME_MAP
7
- function ____exports.getCardName(self, card)
8
- local itemConfig = Isaac.GetItemConfig()
9
- local defaultName = "Unknown"
10
- if type(card) ~= "number" then
11
- return defaultName
4
+ local ____PocketItemType = require("types.PocketItemType")
5
+ local PocketItemType = ____PocketItemType.PocketItemType
6
+ function ____exports.getPocketItems(self, player)
7
+ local pocketItem = player:GetActiveItem(ActiveSlot.SLOT_POCKET)
8
+ local hasPocketItem = pocketItem ~= CollectibleType.COLLECTIBLE_NULL
9
+ local pocketItem2 = player:GetActiveItem(ActiveSlot.SLOT_POCKET2)
10
+ local hasPocketItem2 = pocketItem2 ~= CollectibleType.COLLECTIBLE_NULL
11
+ local maxPocketItems = player:GetMaxPocketItems()
12
+ local pocketItems = {}
13
+ local pocketItemIdentified = false
14
+ local pocketItem2Identified = false
15
+ do
16
+ local slot = 0
17
+ while slot < 4 do
18
+ local card = player:GetCard(slot)
19
+ local pill = player:GetPill(slot)
20
+ if card ~= Card.CARD_NULL then
21
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.CARD, id = card, slot = slot})
22
+ elseif pill ~= PillColor.PILL_NULL then
23
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.PILL, id = pill, slot = slot})
24
+ elseif (hasPocketItem and (not hasPocketItem2)) and (not pocketItemIdentified) then
25
+ pocketItemIdentified = true
26
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.ACTIVE_ITEM, id = pocketItem, slot = slot})
27
+ elseif ((not hasPocketItem) and hasPocketItem2) and (not pocketItem2Identified) then
28
+ pocketItem2Identified = true
29
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.DICE_BAG_DICE, id = pocketItem2, slot = slot})
30
+ elseif hasPocketItem and hasPocketItem2 then
31
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.UNDETERMINABLE, id = 0, slot = slot})
32
+ else
33
+ __TS__ArrayPush(pocketItems, {type = PocketItemType.EMPTY, id = 0, slot = slot})
34
+ end
35
+ if (slot + 1) == maxPocketItems then
36
+ break
37
+ end
38
+ slot = slot + 1
39
+ end
12
40
  end
13
- local cardName = CARD_NAME_MAP:get(card)
14
- if cardName ~= nil then
15
- return cardName
16
- end
17
- local itemConfigCard = itemConfig:GetCard(card)
18
- if itemConfigCard == nil then
19
- return defaultName
20
- end
21
- return itemConfigCard.Name
41
+ return pocketItems
22
42
  end
23
- function ____exports.getPillEffectName(self, pillEffect)
24
- local itemConfig = Isaac.GetItemConfig()
25
- local defaultName = "Unknown"
26
- if type(pillEffect) ~= "number" then
27
- return defaultName
43
+ function ____exports.getFirstCardOrPill(self, player)
44
+ local pocketItems = ____exports.getPocketItems(nil, player)
45
+ for ____, pocketItem in ipairs(pocketItems) do
46
+ if (pocketItem.type == PocketItemType.CARD) or (pocketItem.type == PocketItemType.PILL) then
47
+ return pocketItem
48
+ end
28
49
  end
29
- local pillEffectName = PILL_EFFECT_NAME_MAP:get(pillEffect)
30
- if pillEffectName ~= nil then
31
- return pillEffectName
50
+ return nil
51
+ end
52
+ function ____exports.hasOpenPocketItemSlot(self, player)
53
+ local character = player:GetPlayerType()
54
+ if character == PlayerType.PLAYER_THESOUL_B then
55
+ return false
32
56
  end
33
- local itemConfigPillEffect = itemConfig:GetPillEffect(pillEffect)
34
- if itemConfigPillEffect == nil then
35
- return defaultName
57
+ local pocketItems = ____exports.getPocketItems(nil, player)
58
+ for ____, pocketItem in ipairs(pocketItems) do
59
+ if pocketItem.type == PocketItemType.EMPTY then
60
+ return true
61
+ end
36
62
  end
37
- return itemConfigPillEffect.Name
63
+ return false
38
64
  end
39
65
  return ____exports
@@ -6,7 +6,8 @@ local DEFAULT_ITEM_POOL_TYPE = ____constants.DEFAULT_ITEM_POOL_TYPE
6
6
  local GENESIS_ROOM_SUBTYPE = ____constants.GENESIS_ROOM_SUBTYPE
7
7
  local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
8
8
  local MAX_ROOM_INDEX = ____constants.MAX_ROOM_INDEX
9
- local ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = ____constants.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP
9
+ local ____roomTypeToItemPoolMap = require("maps.roomTypeToItemPoolMap")
10
+ local ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = ____roomTypeToItemPoolMap.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP
10
11
  local ____doors = require("functions.doors")
11
12
  local closeAllDoors = ____doors.closeAllDoors
12
13
  local getDoors = ____doors.getDoors
@@ -1,6 +1,20 @@
1
1
  /// <reference types="isaac-typescript-definitions" />
2
2
  export declare function getMaxTrinketID(): int;
3
- /** Helper function to get all of the collectible entities in the room. */
3
+ /**
4
+ * Returns the slot number corresponding to where a trinket can be safely inserted.
5
+ *
6
+ * Example:
7
+ * ```
8
+ * const player = Isaac.GetPlayer();
9
+ * const trinketSlot = getOpenTrinketSlotNum(player);
10
+ * if (trinketSlot !== undefined) {
11
+ * // They have one or more open trinket slots
12
+ * player.AddTrinket(TrinketType.TRINKET_SWALLOWED_PENNY);
13
+ * }
14
+ * ```
15
+ */
16
+ export declare function getOpenTrinketSlot(player: EntityPlayer): int | undefined;
17
+ /** Helper function to get all of the trinket entities in the room. */
4
18
  export declare function getTrinkets(matchingSubType?: number): EntityPickup[];
5
19
  /** This is a helper function to get a trinket description from a TrinketType. */
6
20
  export declare function getTrinketDescription(trinketType: TrinketType | int): string;
@@ -14,4 +28,12 @@ export declare function getTrinketDescription(trinketType: TrinketType | int): s
14
28
  * ```
15
29
  */
16
30
  export declare function getTrinketName(trinketType: TrinketType | int): string;
31
+ /**
32
+ * Returns whether or not the player can hold an additional trinket, beyond what they are currently
33
+ * carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
34
+ *
35
+ * If the player is the Tainted Soul, this always returns false, since that character cannot pick up
36
+ * items. (Only Tainted Forgotten can pick up items.)
37
+ */
38
+ export declare function hasOpenTrinketSlot(player: EntityPlayer): boolean;
17
39
  export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean;
@@ -11,6 +11,24 @@ function ____exports.getMaxTrinketID(self)
11
11
  local itemConfig = Isaac.GetItemConfig()
12
12
  return itemConfig:GetTrinkets().Size - 1
13
13
  end
14
+ function ____exports.getOpenTrinketSlot(self, player)
15
+ local maxTrinkets = player:GetMaxTrinkets()
16
+ local trinket0 = player:GetTrinket(0)
17
+ local trinket1 = player:GetTrinket(1)
18
+ if maxTrinkets == 1 then
19
+ return ((trinket0 == TrinketType.TRINKET_NULL) and 0) or nil
20
+ end
21
+ if maxTrinkets == 2 then
22
+ if trinket0 == TrinketType.TRINKET_NULL then
23
+ return 0
24
+ end
25
+ return ((trinket1 == TrinketType.TRINKET_NULL) and 1) or nil
26
+ end
27
+ error(
28
+ "The player has an unknown number of trinket slots: " .. tostring(maxTrinkets)
29
+ )
30
+ return nil
31
+ end
14
32
  function ____exports.getTrinkets(self, matchingSubType)
15
33
  if matchingSubType == nil then
16
34
  matchingSubType = -1
@@ -57,6 +75,14 @@ function ____exports.getTrinketName(self, trinketType)
57
75
  end
58
76
  return itemConfigItem.Name
59
77
  end
78
+ function ____exports.hasOpenTrinketSlot(self, player)
79
+ local character = player:GetPlayerType()
80
+ if character == PlayerType.PLAYER_THESOUL_B then
81
+ return false
82
+ end
83
+ local openTrinketSlot = ____exports.getOpenTrinketSlot(nil, player)
84
+ return openTrinketSlot ~= nil
85
+ end
60
86
  function ____exports.isGoldenTrinket(self, trinketType)
61
87
  return trinketType > GOLDEN_TRINKET_SHIFT
62
88
  end
package/dist/index.d.ts CHANGED
@@ -32,6 +32,7 @@ export * from "./functions/pickups";
32
32
  export * from "./functions/pills";
33
33
  export * from "./functions/player";
34
34
  export * from "./functions/playerHealth";
35
+ export * from "./functions/pocketItems";
35
36
  export * from "./functions/position";
36
37
  export * from "./functions/random";
37
38
  export * from "./functions/revive";
@@ -49,9 +50,12 @@ export * from "./functions/util";
49
50
  export * from "./functions/vector";
50
51
  export * from "./maps/cardNameMap";
51
52
  export * from "./maps/collectibleNameMap";
53
+ export * from "./maps/gridEntityXMLMap";
52
54
  export * from "./maps/pillEffectNameMap";
55
+ export * from "./maps/roomTypeToItemPoolMap";
53
56
  export * from "./maps/transformationMap";
54
57
  export * from "./maps/trinketNameMap";
58
+ export * from "./sets/cards";
55
59
  export * from "./types/CallbackParametersCustom";
56
60
  export * from "./types/HealthType";
57
61
  export * from "./types/JSONDoor";
package/dist/index.lua CHANGED
@@ -262,6 +262,14 @@ do
262
262
  end
263
263
  end
264
264
  end
265
+ do
266
+ local ____export = require("functions.pocketItems")
267
+ for ____exportKey, ____exportValue in pairs(____export) do
268
+ if ____exportKey ~= "default" then
269
+ ____exports[____exportKey] = ____exportValue
270
+ end
271
+ end
272
+ end
265
273
  do
266
274
  local ____export = require("functions.position")
267
275
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -398,6 +406,14 @@ do
398
406
  end
399
407
  end
400
408
  end
409
+ do
410
+ local ____export = require("maps.gridEntityXMLMap")
411
+ for ____exportKey, ____exportValue in pairs(____export) do
412
+ if ____exportKey ~= "default" then
413
+ ____exports[____exportKey] = ____exportValue
414
+ end
415
+ end
416
+ end
401
417
  do
402
418
  local ____export = require("maps.pillEffectNameMap")
403
419
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -406,6 +422,14 @@ do
406
422
  end
407
423
  end
408
424
  end
425
+ do
426
+ local ____export = require("maps.roomTypeToItemPoolMap")
427
+ for ____exportKey, ____exportValue in pairs(____export) do
428
+ if ____exportKey ~= "default" then
429
+ ____exports[____exportKey] = ____exportValue
430
+ end
431
+ end
432
+ end
409
433
  do
410
434
  local ____export = require("maps.transformationMap")
411
435
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -422,6 +446,14 @@ do
422
446
  end
423
447
  end
424
448
  end
449
+ do
450
+ local ____export = require("sets.cards")
451
+ for ____exportKey, ____exportValue in pairs(____export) do
452
+ if ____exportKey ~= "default" then
453
+ ____exports[____exportKey] = ____exportValue
454
+ end
455
+ end
456
+ end
425
457
  do
426
458
  local ____export = require("types.HealthType")
427
459
  for ____exportKey, ____exportValue in pairs(____export) do
@@ -0,0 +1,6 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * This maps the GridEntityXMLType (i.e. the type contained in the room XML/STB file) to the
4
+ * GridEntityType and the variant used by the game.
5
+ */
6
+ export declare const GRID_ENTITY_XML_MAP: Map<GridEntityXMLType, [GridEntityType, number]>;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.GRID_ENTITY_XML_MAP = __TS__New(Map, {{1000, {GridEntityType.GRID_ROCK, 0}}, {1001, {GridEntityType.GRID_ROCK_BOMB, 0}}, {1002, {GridEntityType.GRID_ROCK_ALT, 0}}, {1003, {GridEntityType.GRID_ROCKT, 0}}, {1008, {GridEntityType.GRID_ROCK_ALT2, 0}}, {1009, {GridEntityType.GRID_ROCK_ALT2, 1}}, {1010, {GridEntityType.GRID_ROCK_SPIKED, 0}}, {1011, {GridEntityType.GRID_ROCK_GOLD, 0}}, {1300, {GridEntityType.GRID_TNT, 0}}, {1490, {GridEntityType.GRID_POOP, 1}}, {1494, {GridEntityType.GRID_POOP, 4}}, {1495, {GridEntityType.GRID_POOP, 2}}, {1496, {GridEntityType.GRID_POOP, 3}}, {1497, {GridEntityType.GRID_POOP, 5}}, {1498, {GridEntityType.GRID_POOP, 6}}, {1500, {GridEntityType.GRID_POOP, 0}}, {1501, {GridEntityType.GRID_POOP, 11}}, {1900, {GridEntityType.GRID_ROCKB, 0}}, {1901, {GridEntityType.GRID_PILLAR, 0}}, {1930, {GridEntityType.GRID_SPIKES, 0}}, {1931, {GridEntityType.GRID_SPIKES_ONOFF, 0}}, {1940, {GridEntityType.GRID_SPIDERWEB, 0}}, {1999, {GridEntityType.GRID_WALL, 0}}, {3000, {GridEntityType.GRID_PIT, 0}}, {3001, {GridEntityType.GRID_PIT, 16}}, {3009, {GridEntityType.GRID_PIT, 0}}, {4000, {GridEntityType.GRID_LOCK, 0}}, {4500, {GridEntityType.GRID_PRESSURE_PLATE, 0}}, {5000, {GridEntityType.GRID_STATUE, 0}}, {5001, {GridEntityType.GRID_STATUE, 1}}, {6100, {GridEntityType.GRID_TELEPORTER, 0}}, {9000, {GridEntityType.GRID_TRAPDOOR, 0}}, {9100, {GridEntityType.GRID_STAIRS, 0}}, {10000, {GridEntityType.GRID_GRAVITY, 0}}})
5
+ return ____exports
@@ -0,0 +1,2 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ export declare const ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP: Map<RoomType, ItemPoolType>;
@@ -0,0 +1,5 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.ROOM_TYPE_TO_ITEM_POOL_TYPE_MAP = __TS__New(Map, {{RoomType.ROOM_SHOP, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_TREASURE, ItemPoolType.POOL_TREASURE}, {RoomType.ROOM_BOSS, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_SECRET, ItemPoolType.POOL_SECRET}, {RoomType.ROOM_CURSE, ItemPoolType.POOL_CURSE}, {RoomType.ROOM_CHALLENGE, ItemPoolType.POOL_BOSS}, {RoomType.ROOM_LIBRARY, ItemPoolType.POOL_LIBRARY}, {RoomType.ROOM_DEVIL, ItemPoolType.POOL_DEVIL}, {RoomType.ROOM_ANGEL, ItemPoolType.POOL_ANGEL}, {RoomType.ROOM_CHEST, ItemPoolType.POOL_GOLDEN_CHEST}, {RoomType.ROOM_BLACK_MARKET, ItemPoolType.POOL_SHOP}, {RoomType.ROOM_PLANETARIUM, ItemPoolType.POOL_PLANETARIUM}, {RoomType.ROOM_ULTRASECRET, ItemPoolType.POOL_ULTRA_SECRET}})
5
+ return ____exports
@@ -0,0 +1,25 @@
1
+ /// <reference types="isaac-typescript-definitions" />
2
+ /**
3
+ * Contains all of the entries in the `Card` enum that are not a rune and not an object (e.g. Fool,
4
+ * Reverse Fool, Wild Card, etc.).
5
+ */
6
+ export declare const CARDS: Card[];
7
+ /**
8
+ * Contains all of the entries in the `Card` enum that are not a rune and not an object (e.g. Fool,
9
+ * Reverse Fool, Wild Card, etc.).
10
+ */
11
+ export declare const CARD_SET: Set<Card>;
12
+ /**
13
+ * Contains all of the entries in the `Card` enum that are a rune (e.g. Rune of Hagalaz, Blank Rune,
14
+ * Black Rune, Rune Shard, Soul of Isaac, etc.).
15
+ */
16
+ export declare const RUNES: Card[];
17
+ /**
18
+ * Contains all of the entries in the `Card` enum that are a rune (e.g. Rune of Hagalaz, Blank Rune,
19
+ * Black Rune, Rune Shard, Soul of Isaac, etc.).
20
+ */
21
+ export declare const RUNE_SET: Set<Card>;
22
+ /** Contains all of the entries in the `Card` enum that are objects (like Dice Shard). */
23
+ export declare const POCKET_ITEM_OBJECTS: Card[];
24
+ /** Contains all of the entries in the `Card` enum that are objects (like Dice Shard). */
25
+ export declare const POCKET_ITEM_OBJECT_SET: Set<Card>;
@@ -0,0 +1,10 @@
1
+ --[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
2
+ require("lualib_bundle");
3
+ local ____exports = {}
4
+ ____exports.CARDS = {Card.CARD_FOOL, Card.CARD_MAGICIAN, Card.CARD_HIGH_PRIESTESS, Card.CARD_EMPRESS, Card.CARD_EMPEROR, Card.CARD_HIEROPHANT, Card.CARD_LOVERS, Card.CARD_CHARIOT, Card.CARD_JUSTICE, Card.CARD_HERMIT, Card.CARD_WHEEL_OF_FORTUNE, Card.CARD_STRENGTH, Card.CARD_HANGED_MAN, Card.CARD_DEATH, Card.CARD_TEMPERANCE, Card.CARD_DEVIL, Card.CARD_TOWER, Card.CARD_STARS, Card.CARD_MOON, Card.CARD_SUN, Card.CARD_JUDGEMENT, Card.CARD_WORLD, Card.CARD_CLUBS_2, Card.CARD_DIAMONDS_2, Card.CARD_SPADES_2, Card.CARD_HEARTS_2, Card.CARD_ACE_OF_CLUBS, Card.CARD_ACE_OF_DIAMONDS, Card.CARD_ACE_OF_SPADES, Card.CARD_ACE_OF_HEARTS, Card.CARD_JOKER, Card.CARD_CHAOS, Card.CARD_CREDIT, Card.CARD_RULES, Card.CARD_HUMANITY, Card.CARD_SUICIDE_KING, Card.CARD_GET_OUT_OF_JAIL, Card.CARD_QUESTIONMARK, Card.CARD_HOLY, Card.CARD_HUGE_GROWTH, Card.CARD_ANCIENT_RECALL, Card.CARD_ERA_WALK, Card.CARD_REVERSE_FOOL, Card.CARD_REVERSE_MAGICIAN, Card.CARD_REVERSE_HIGH_PRIESTESS, Card.CARD_REVERSE_EMPRESS, Card.CARD_REVERSE_EMPEROR, Card.CARD_REVERSE_HIEROPHANT, Card.CARD_REVERSE_LOVERS, Card.CARD_REVERSE_CHARIOT, Card.CARD_REVERSE_JUSTICE, Card.CARD_REVERSE_HERMIT, Card.CARD_REVERSE_WHEEL_OF_FORTUNE, Card.CARD_REVERSE_STRENGTH, Card.CARD_REVERSE_HANGED_MAN, Card.CARD_REVERSE_DEATH, Card.CARD_REVERSE_TEMPERANCE, Card.CARD_REVERSE_DEVIL, Card.CARD_REVERSE_TOWER, Card.CARD_REVERSE_STARS, Card.CARD_REVERSE_MOON, Card.CARD_REVERSE_SUN, Card.CARD_REVERSE_JUDGEMENT, Card.CARD_REVERSE_WORLD, Card.CARD_QUEEN_OF_HEARTS, Card.CARD_WILD}
5
+ ____exports.CARD_SET = __TS__New(Set, ____exports.CARDS)
6
+ ____exports.RUNES = {Card.RUNE_HAGALAZ, Card.RUNE_JERA, Card.RUNE_EHWAZ, Card.RUNE_DAGAZ, Card.RUNE_ANSUZ, Card.RUNE_PERTHRO, Card.RUNE_BERKANO, Card.RUNE_ALGIZ, Card.RUNE_BLANK, Card.RUNE_BLACK, Card.RUNE_SHARD, Card.CARD_SOUL_ISAAC, Card.CARD_SOUL_MAGDALENE, Card.CARD_SOUL_CAIN, Card.CARD_SOUL_JUDAS, Card.CARD_SOUL_BLUEBABY, Card.CARD_SOUL_EVE, Card.CARD_SOUL_SAMSON, Card.CARD_SOUL_AZAZEL, Card.CARD_SOUL_LAZARUS, Card.CARD_SOUL_EDEN, Card.CARD_SOUL_LOST, Card.CARD_SOUL_LILITH, Card.CARD_SOUL_KEEPER, Card.CARD_SOUL_APOLLYON, Card.CARD_SOUL_FORGOTTEN, Card.CARD_SOUL_BETHANY, Card.CARD_SOUL_JACOB}
7
+ ____exports.RUNE_SET = __TS__New(Set, ____exports.RUNES)
8
+ ____exports.POCKET_ITEM_OBJECTS = {Card.CARD_DICE_SHARD, Card.CARD_EMERGENCY_CONTACT, Card.CARD_CRACKED_KEY}
9
+ ____exports.POCKET_ITEM_OBJECT_SET = __TS__New(Set, ____exports.POCKET_ITEM_OBJECTS)
10
+ return ____exports
@@ -3,4 +3,5 @@ import { PocketItemType } from "./PocketItemType";
3
3
  export interface PocketItemDescription {
4
4
  type: PocketItemType;
5
5
  id: int;
6
+ slot: PocketItemSlot;
6
7
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "isaacscript-common",
3
- "version": "1.0.484",
3
+ "version": "1.0.488",
4
4
  "description": "Helper functions for IsaacScript mods",
5
5
  "keywords": [
6
6
  "isaac",
@@ -25,7 +25,7 @@
25
25
  "dist/**/*.d.ts"
26
26
  ],
27
27
  "devDependencies": {
28
- "isaac-typescript-definitions": "^1.0.282",
28
+ "isaac-typescript-definitions": "^1.0.284",
29
29
  "isaacscript-lint": "^1.0.67",
30
30
  "typedoc": "^0.22.10",
31
31
  "typescript": "4.4.4",