isaacscript-common 2.0.21 → 2.0.24
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.
- package/dist/constantsMax.d.ts +2 -0
- package/dist/constantsMax.lua +2 -0
- package/dist/functions/cards.d.ts +2 -0
- package/dist/functions/cards.lua +4 -2
- package/dist/functions/collectibleCacheFlag.lua +2 -6
- package/dist/functions/collectibleSet.lua +3 -7
- package/dist/functions/collectibleTag.lua +3 -7
- package/dist/functions/collectibles.d.ts +9 -0
- package/dist/functions/collectibles.lua +8 -0
- package/dist/functions/pickupVariants.d.ts +10 -0
- package/dist/functions/pickupVariants.lua +15 -0
- package/dist/functions/pills.d.ts +13 -0
- package/dist/functions/pills.lua +27 -0
- package/dist/functions/rooms.d.ts +4 -0
- package/dist/functions/rooms.lua +6 -4
- package/dist/functions/trinketCacheFlag.lua +2 -7
- package/dist/functions/trinketSet.lua +3 -7
- package/dist/functions/trinkets.d.ts +8 -0
- package/dist/functions/trinkets.lua +8 -0
- package/package.json +2 -2
package/dist/constantsMax.d.ts
CHANGED
|
@@ -23,3 +23,5 @@ export declare const FIRST_CHARACTER = PlayerType.ISAAC;
|
|
|
23
23
|
export declare const MAX_VANILLA_CHARACTER: PlayerType;
|
|
24
24
|
export declare const FIRST_PILL_COLOR = PillColor.BLUE_BLUE;
|
|
25
25
|
export declare const MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW;
|
|
26
|
+
export declare const FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE;
|
|
27
|
+
export declare const MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW;
|
package/dist/constantsMax.lua
CHANGED
|
@@ -35,4 +35,6 @@ ____exports.FIRST_CHARACTER = PlayerType.ISAAC
|
|
|
35
35
|
____exports.MAX_VANILLA_CHARACTER = getLastEnumValue(nil, PlayerType)
|
|
36
36
|
____exports.FIRST_PILL_COLOR = PillColor.BLUE_BLUE
|
|
37
37
|
____exports.MAX_NORMAL_PILL_COLOR = PillColor.WHITE_YELLOW
|
|
38
|
+
____exports.FIRST_HORSE_PILL_COLOR = PillColor.HORSE_BLUE_BLUE
|
|
39
|
+
____exports.MAX_HORSE_PILL_COLOR = PillColor.HORSE_WHITE_YELLOW
|
|
38
40
|
return ____exports
|
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { Card, ItemConfigCardType } from "isaac-typescript-definitions";
|
|
2
|
+
/** Helper function to get an array with every valid card sub-type. This includes modded cards. */
|
|
3
|
+
export declare function getAllCards(): Card[];
|
|
2
4
|
/**
|
|
3
5
|
* Helper function to get a card description from a Card enum value.
|
|
4
6
|
*
|
package/dist/functions/cards.lua
CHANGED
|
@@ -38,8 +38,7 @@ function initCardObjects(self)
|
|
|
38
38
|
__TS__New(Set)
|
|
39
39
|
)
|
|
40
40
|
end
|
|
41
|
-
for ____,
|
|
42
|
-
local card = cardInt
|
|
41
|
+
for ____, card in ipairs(____exports.getAllCards(nil)) do
|
|
43
42
|
local cardType = ____exports.getCardType(nil, card)
|
|
44
43
|
local cardTypeSet = CARD_TYPE_TO_CARDS_MAP:get(cardType)
|
|
45
44
|
if cardTypeSet == nil then
|
|
@@ -56,6 +55,9 @@ function initCardObjects(self)
|
|
|
56
55
|
)
|
|
57
56
|
addSetsToSet(nil, CARD_SET, cards)
|
|
58
57
|
end
|
|
58
|
+
function ____exports.getAllCards(self)
|
|
59
|
+
return irange(nil, FIRST_CARD, MAX_CARD)
|
|
60
|
+
end
|
|
59
61
|
function ____exports.getCardType(self, card)
|
|
60
62
|
local cardType = CARD_TYPES[card]
|
|
61
63
|
return cardType == nil and DEFAULT_CARD_TYPE or cardType
|
|
@@ -5,25 +5,21 @@ local Set = ____lualib.Set
|
|
|
5
5
|
local ____exports = {}
|
|
6
6
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
7
7
|
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
8
|
-
local ____constantsMax = require("constantsMax")
|
|
9
|
-
local FIRST_COLLECTIBLE_TYPE = ____constantsMax.FIRST_COLLECTIBLE_TYPE
|
|
10
|
-
local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
|
|
11
8
|
local ____collectibles = require("functions.collectibles")
|
|
12
9
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
10
|
+
local getCollectibleTypeRange = ____collectibles.getCollectibleTypeRange
|
|
13
11
|
local ____enums = require("functions.enums")
|
|
14
12
|
local getEnumValues = ____enums.getEnumValues
|
|
15
13
|
local ____set = require("functions.set")
|
|
16
14
|
local copySet = ____set.copySet
|
|
17
15
|
local getSortedSetValues = ____set.getSortedSetValues
|
|
18
16
|
local ____utils = require("functions.utils")
|
|
19
|
-
local irange = ____utils.irange
|
|
20
17
|
local ____repeat = ____utils["repeat"]
|
|
21
18
|
local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
|
|
22
19
|
local function initCacheFlagMap(self)
|
|
23
20
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
24
21
|
local collectiblesSet = __TS__New(Set)
|
|
25
|
-
for ____,
|
|
26
|
-
local collectibleType = collectibleTypeInt
|
|
22
|
+
for ____, collectibleType in ipairs(getCollectibleTypeRange(nil)) do
|
|
27
23
|
if collectibleHasCacheFlag(nil, collectibleType, cacheFlag) then
|
|
28
24
|
collectiblesSet:add(collectibleType)
|
|
29
25
|
end
|
|
@@ -4,17 +4,13 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____cachedClasses = require("cachedClasses")
|
|
6
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
7
|
-
local
|
|
8
|
-
local
|
|
9
|
-
local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
|
|
7
|
+
local ____collectibles = require("functions.collectibles")
|
|
8
|
+
local getCollectibleTypeRange = ____collectibles.getCollectibleTypeRange
|
|
10
9
|
local ____set = require("functions.set")
|
|
11
10
|
local copySet = ____set.copySet
|
|
12
|
-
local ____utils = require("functions.utils")
|
|
13
|
-
local irange = ____utils.irange
|
|
14
11
|
local COLLECTIBLE_SET = __TS__New(Set)
|
|
15
12
|
local function initCollectibleSet(self)
|
|
16
|
-
for ____,
|
|
17
|
-
local collectibleType = collectibleTypeInt
|
|
13
|
+
for ____, collectibleType in ipairs(getCollectibleTypeRange(nil)) do
|
|
18
14
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
19
15
|
if itemConfigItem ~= nil then
|
|
20
16
|
COLLECTIBLE_SET:add(collectibleType)
|
|
@@ -8,9 +8,8 @@ local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitio
|
|
|
8
8
|
local ItemConfigTag = ____isaac_2Dtypescript_2Ddefinitions.ItemConfigTag
|
|
9
9
|
local ____cachedClasses = require("cachedClasses")
|
|
10
10
|
local itemConfig = ____cachedClasses.itemConfig
|
|
11
|
-
local
|
|
12
|
-
local
|
|
13
|
-
local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
|
|
11
|
+
local ____collectibles = require("functions.collectibles")
|
|
12
|
+
local getCollectibleTypeRange = ____collectibles.getCollectibleTypeRange
|
|
14
13
|
local ____enums = require("functions.enums")
|
|
15
14
|
local getEnumValues = ____enums.getEnumValues
|
|
16
15
|
local ____flag = require("functions.flag")
|
|
@@ -19,8 +18,6 @@ local ____player = require("functions.player")
|
|
|
19
18
|
local getPlayerCollectibleCount = ____player.getPlayerCollectibleCount
|
|
20
19
|
local ____set = require("functions.set")
|
|
21
20
|
local copySet = ____set.copySet
|
|
22
|
-
local ____utils = require("functions.utils")
|
|
23
|
-
local irange = ____utils.irange
|
|
24
21
|
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
25
22
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
26
23
|
if itemConfigItem == nil then
|
|
@@ -36,8 +33,7 @@ local function initTagMap(self)
|
|
|
36
33
|
__TS__New(Set)
|
|
37
34
|
)
|
|
38
35
|
end
|
|
39
|
-
for ____,
|
|
40
|
-
local collectibleType = collectibleTypeInt
|
|
36
|
+
for ____, collectibleType in ipairs(getCollectibleTypeRange(nil)) do
|
|
41
37
|
for ____, itemConfigTag in ipairs(getEnumValues(nil, ItemConfigTag)) do
|
|
42
38
|
do
|
|
43
39
|
if not ____exports.collectibleHasTag(nil, collectibleType, itemConfigTag) then
|
|
@@ -102,6 +102,15 @@ export declare function getCollectibleQuality(collectibleType: CollectibleType):
|
|
|
102
102
|
* ```
|
|
103
103
|
*/
|
|
104
104
|
export declare function getCollectibleTags(collectibleType: CollectibleType): BitFlags<ItemConfigTag>;
|
|
105
|
+
/**
|
|
106
|
+
* Helper function to get an array that represents the range from the first collectible type to the
|
|
107
|
+
* last collectible type. This will include integers that do not represent any valid collectible
|
|
108
|
+
* types.
|
|
109
|
+
*
|
|
110
|
+
* This function is only useful when building collectible type objects. For most purposes, you
|
|
111
|
+
* should use the `getCollectibleSet` helper function instead.
|
|
112
|
+
*/
|
|
113
|
+
export declare function getCollectibleTypeRange(): CollectibleType[];
|
|
105
114
|
/** Returns true if the item type in the item config is equal to `ItemType.ITEM_ACTIVE`. */
|
|
106
115
|
export declare function isActiveCollectible(collectibleType: CollectibleType): boolean;
|
|
107
116
|
/** Returns true if the collectible has a red question mark sprite. */
|
|
@@ -13,6 +13,9 @@ local game = ____cachedClasses.game
|
|
|
13
13
|
local itemConfig = ____cachedClasses.itemConfig
|
|
14
14
|
local ____constants = require("constants")
|
|
15
15
|
local BLIND_ITEM_PNG_PATH = ____constants.BLIND_ITEM_PNG_PATH
|
|
16
|
+
local ____constantsMax = require("constantsMax")
|
|
17
|
+
local FIRST_COLLECTIBLE_TYPE = ____constantsMax.FIRST_COLLECTIBLE_TYPE
|
|
18
|
+
local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
|
|
16
19
|
local ____collectibleDescriptionMap = require("maps.collectibleDescriptionMap")
|
|
17
20
|
local COLLECTIBLE_DESCRIPTION_MAP = ____collectibleDescriptionMap.COLLECTIBLE_DESCRIPTION_MAP
|
|
18
21
|
local DEFAULT_COLLECTIBLE_DESCRIPTION = ____collectibleDescriptionMap.DEFAULT_COLLECTIBLE_DESCRIPTION
|
|
@@ -32,6 +35,8 @@ local getRoomListIndex = ____roomData.getRoomListIndex
|
|
|
32
35
|
local ____sprite = require("functions.sprite")
|
|
33
36
|
local clearSprite = ____sprite.clearSprite
|
|
34
37
|
local spriteEquals = ____sprite.spriteEquals
|
|
38
|
+
local ____utils = require("functions.utils")
|
|
39
|
+
local irange = ____utils.irange
|
|
35
40
|
function initQuestionMarkSprite(self)
|
|
36
41
|
local sprite = Sprite()
|
|
37
42
|
sprite:Load("gfx/005.100_collectible.anm2", false)
|
|
@@ -188,6 +193,9 @@ function ____exports.getCollectibleTags(self, collectibleType)
|
|
|
188
193
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
189
194
|
return itemConfigItem == nil and ItemConfigTagZero or itemConfigItem.Tags
|
|
190
195
|
end
|
|
196
|
+
function ____exports.getCollectibleTypeRange(self)
|
|
197
|
+
return irange(nil, FIRST_COLLECTIBLE_TYPE, MAX_COLLECTIBLE_TYPE)
|
|
198
|
+
end
|
|
191
199
|
function ____exports.isActiveCollectible(self, collectibleType)
|
|
192
200
|
local itemType = ____exports.getCollectibleItemType(nil, collectibleType)
|
|
193
201
|
return itemType == ItemType.ACTIVE
|
|
@@ -7,7 +7,17 @@ export declare function isCoin(pickup: EntityPickup): pickup is EntityPickupCoin
|
|
|
7
7
|
export declare function isKey(pickup: EntityPickup): pickup is EntityPickupKey;
|
|
8
8
|
/** For PickupVariant.BOMB (40) */
|
|
9
9
|
export declare function isBomb(pickup: EntityPickup): pickup is EntityPickupBomb;
|
|
10
|
+
/** For PickupVariant.POOP (42) */
|
|
11
|
+
export declare function isPoop(pickup: EntityPickup): pickup is EntityPickupPoop;
|
|
12
|
+
/** For PickupVariant.POOP (42) */
|
|
13
|
+
export declare function isSack(pickup: EntityPickup): pickup is EntityPickupSack;
|
|
14
|
+
/** For PickupVariant.PILL (70) */
|
|
15
|
+
export declare function isPill(pickup: EntityPickup): pickup is EntityPickupPill;
|
|
16
|
+
/** For PickupVariant.LIL_BATTERY (90) */
|
|
17
|
+
export declare function isBattery(pickup: EntityPickup): pickup is EntityPickupBattery;
|
|
10
18
|
/** For PickupVariant.COLLECTIBLE (100) */
|
|
11
19
|
export declare function isCollectible(pickup: EntityPickup): pickup is EntityPickupCollectible;
|
|
20
|
+
/** For PickupVariant.TAROT_CARD (300) */
|
|
21
|
+
export declare function isCardPickup(pickup: EntityPickup): pickup is EntityPickupCard;
|
|
12
22
|
/** For PickupVariant.TRINKET (350) */
|
|
13
23
|
export declare function isTrinket(pickup: EntityPickup): pickup is EntityPickupTrinket;
|
|
@@ -13,9 +13,24 @@ end
|
|
|
13
13
|
function ____exports.isBomb(self, pickup)
|
|
14
14
|
return pickup.Variant == PickupVariant.BOMB
|
|
15
15
|
end
|
|
16
|
+
function ____exports.isPoop(self, pickup)
|
|
17
|
+
return pickup.Variant == PickupVariant.POOP
|
|
18
|
+
end
|
|
19
|
+
function ____exports.isSack(self, pickup)
|
|
20
|
+
return pickup.Variant == PickupVariant.SACK
|
|
21
|
+
end
|
|
22
|
+
function ____exports.isPill(self, pickup)
|
|
23
|
+
return pickup.Variant == PickupVariant.PILL
|
|
24
|
+
end
|
|
25
|
+
function ____exports.isBattery(self, pickup)
|
|
26
|
+
return pickup.Variant == PickupVariant.LIL_BATTERY
|
|
27
|
+
end
|
|
16
28
|
function ____exports.isCollectible(self, pickup)
|
|
17
29
|
return pickup.Variant == PickupVariant.COLLECTIBLE
|
|
18
30
|
end
|
|
31
|
+
function ____exports.isCardPickup(self, pickup)
|
|
32
|
+
return pickup.Variant == PickupVariant.TAROT_CARD
|
|
33
|
+
end
|
|
19
34
|
function ____exports.isTrinket(self, pickup)
|
|
20
35
|
return pickup.Variant == PickupVariant.TRINKET
|
|
21
36
|
end
|
|
@@ -1,4 +1,17 @@
|
|
|
1
1
|
import { ItemConfigPillEffectClass, ItemConfigPillEffectType, PillColor, PillEffect } from "isaac-typescript-definitions";
|
|
2
|
+
/** Helper function to get an array with every non-gold horse pill color. */
|
|
3
|
+
export declare function getAllHorsePillColors(): PillColor[];
|
|
4
|
+
/** Helper function to get an array with every non-gold and non-horse pill color. */
|
|
5
|
+
export declare function getAllNormalPillColors(): PillColor[];
|
|
6
|
+
/**
|
|
7
|
+
* Helper function to get an array with every non-null pill color. This includes all gold colors and
|
|
8
|
+
* all horse colors.
|
|
9
|
+
*/
|
|
10
|
+
export declare function getAllPillColors(): PillColor[];
|
|
11
|
+
/**
|
|
12
|
+
* Helper function to get an array with every valid pill effect. This includes modded pill effects.
|
|
13
|
+
*/
|
|
14
|
+
export declare function getAllPillEffects(): PillEffect[];
|
|
2
15
|
/**
|
|
3
16
|
* Helper function to get the corresponding horse pill color from a normal pill color.
|
|
4
17
|
*
|
package/dist/functions/pills.lua
CHANGED
|
@@ -1,8 +1,17 @@
|
|
|
1
|
+
local ____lualib = require("lualib_bundle")
|
|
2
|
+
local __TS__ArraySlice = ____lualib.__TS__ArraySlice
|
|
1
3
|
local ____exports = {}
|
|
2
4
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
3
5
|
local PillColor = ____isaac_2Dtypescript_2Ddefinitions.PillColor
|
|
4
6
|
local ____cachedClasses = require("cachedClasses")
|
|
5
7
|
local itemConfig = ____cachedClasses.itemConfig
|
|
8
|
+
local ____constantsMax = require("constantsMax")
|
|
9
|
+
local FIRST_HORSE_PILL_COLOR = ____constantsMax.FIRST_HORSE_PILL_COLOR
|
|
10
|
+
local FIRST_PILL_COLOR = ____constantsMax.FIRST_PILL_COLOR
|
|
11
|
+
local FIRST_PILL_EFFECT = ____constantsMax.FIRST_PILL_EFFECT
|
|
12
|
+
local MAX_HORSE_PILL_COLOR = ____constantsMax.MAX_HORSE_PILL_COLOR
|
|
13
|
+
local MAX_NORMAL_PILL_COLOR = ____constantsMax.MAX_NORMAL_PILL_COLOR
|
|
14
|
+
local MAX_PILL_EFFECT = ____constantsMax.MAX_PILL_EFFECT
|
|
6
15
|
local ____pillEffectClasses = require("objects.pillEffectClasses")
|
|
7
16
|
local DEFAULT_PILL_EFFECT_CLASS = ____pillEffectClasses.DEFAULT_PILL_EFFECT_CLASS
|
|
8
17
|
local PILL_EFFECT_CLASSES = ____pillEffectClasses.PILL_EFFECT_CLASSES
|
|
@@ -12,10 +21,28 @@ local PILL_EFFECT_NAMES = ____pillEffectNames.PILL_EFFECT_NAMES
|
|
|
12
21
|
local ____pillEffectTypes = require("objects.pillEffectTypes")
|
|
13
22
|
local DEFAULT_PILL_EFFECT_TYPE = ____pillEffectTypes.DEFAULT_PILL_EFFECT_TYPE
|
|
14
23
|
local PILL_EFFECT_TYPES = ____pillEffectTypes.PILL_EFFECT_TYPES
|
|
24
|
+
local ____enums = require("functions.enums")
|
|
25
|
+
local getEnumValues = ____enums.getEnumValues
|
|
15
26
|
local ____flag = require("functions.flag")
|
|
16
27
|
local hasFlag = ____flag.hasFlag
|
|
28
|
+
local ____utils = require("functions.utils")
|
|
29
|
+
local irange = ____utils.irange
|
|
17
30
|
local HORSE_PILL_FLAG = 2047
|
|
18
31
|
local HORSE_PILL_ADJUSTMENT = 2048
|
|
32
|
+
function ____exports.getAllHorsePillColors(self)
|
|
33
|
+
return irange(nil, FIRST_HORSE_PILL_COLOR, MAX_HORSE_PILL_COLOR)
|
|
34
|
+
end
|
|
35
|
+
function ____exports.getAllNormalPillColors(self)
|
|
36
|
+
return irange(nil, FIRST_PILL_COLOR, MAX_NORMAL_PILL_COLOR)
|
|
37
|
+
end
|
|
38
|
+
function ____exports.getAllPillColors(self)
|
|
39
|
+
local pillColors = getEnumValues(nil, PillColor)
|
|
40
|
+
__TS__ArraySlice(pillColors)
|
|
41
|
+
return pillColors
|
|
42
|
+
end
|
|
43
|
+
function ____exports.getAllPillEffects(self)
|
|
44
|
+
return irange(nil, FIRST_PILL_EFFECT, MAX_PILL_EFFECT)
|
|
45
|
+
end
|
|
19
46
|
function ____exports.getHorsePillColor(self, pillColor)
|
|
20
47
|
return pillColor + HORSE_PILL_ADJUSTMENT
|
|
21
48
|
end
|
|
@@ -5,6 +5,10 @@ import { BossID, Dimension, Direction, DoorSlot, ItemPoolType, MinibossID, RoomS
|
|
|
5
5
|
* not forget to set the `LeaveDoor` property and to prevent crashing on invalid room grid indexes.
|
|
6
6
|
*/
|
|
7
7
|
export declare function changeRoom(roomGridIndex: int): void;
|
|
8
|
+
/**
|
|
9
|
+
* Helper function to get an array with every valid `Dimension` (not including `Dimension.CURRENT`).
|
|
10
|
+
*/
|
|
11
|
+
export declare function getAllDimensions(): Dimension[];
|
|
8
12
|
export declare function getAllRoomGridIndexes(): int[];
|
|
9
13
|
/**
|
|
10
14
|
* Helper function to get the current dimension. Most of the time, this will be `Dimension.MAIN`,
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -114,6 +114,9 @@ function ____exports.changeRoom(self, roomGridIndex)
|
|
|
114
114
|
level.LeaveDoor = DoorSlot.NO_DOOR_SLOT
|
|
115
115
|
game:ChangeRoom(roomGridIndex)
|
|
116
116
|
end
|
|
117
|
+
function ____exports.getAllDimensions(self)
|
|
118
|
+
return erange(nil, NUM_DIMENSIONS)
|
|
119
|
+
end
|
|
117
120
|
function ____exports.getAllRoomGridIndexes(self)
|
|
118
121
|
local rooms = ____exports.getRooms(nil)
|
|
119
122
|
return __TS__ArrayMap(
|
|
@@ -129,8 +132,7 @@ function ____exports.getCurrentDimension(self)
|
|
|
129
132
|
local startingRoomGridIndex = level:GetStartingRoomIndex()
|
|
130
133
|
local startingRoomDescription = level:GetRoomByIdx(startingRoomGridIndex, Dimension.CURRENT)
|
|
131
134
|
local startingRoomHash = GetPtrHash(startingRoomDescription)
|
|
132
|
-
for ____,
|
|
133
|
-
local dimension = dimensionInt
|
|
135
|
+
for ____, dimension in ipairs(____exports.getAllDimensions(nil)) do
|
|
134
136
|
local dimensionRoomDescription = level:GetRoomByIdx(startingRoomGridIndex, dimension)
|
|
135
137
|
local dimensionRoomHash = GetPtrHash(dimensionRoomDescription)
|
|
136
138
|
if dimensionRoomHash == startingRoomHash then
|
|
@@ -347,12 +349,12 @@ function ____exports.setRoomCleared(self)
|
|
|
347
349
|
for ____, door in ipairs(getDoors(nil)) do
|
|
348
350
|
do
|
|
349
351
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
350
|
-
goto
|
|
352
|
+
goto __continue68
|
|
351
353
|
end
|
|
352
354
|
openDoorFast(nil, door)
|
|
353
355
|
door.ExtraVisible = false
|
|
354
356
|
end
|
|
355
|
-
::
|
|
357
|
+
::__continue68::
|
|
356
358
|
end
|
|
357
359
|
sfxManager:Stop(SoundEffect.DOOR_HEAVY_OPEN)
|
|
358
360
|
game:ShakeScreen(0)
|
|
@@ -7,22 +7,17 @@ local ____exports = {}
|
|
|
7
7
|
local initCacheFlagMap, CACHE_FLAG_TO_TRINKETS_MAP
|
|
8
8
|
local ____isaac_2Dtypescript_2Ddefinitions = require("isaac-typescript-definitions")
|
|
9
9
|
local CacheFlag = ____isaac_2Dtypescript_2Ddefinitions.CacheFlag
|
|
10
|
-
local ____constantsMax = require("constantsMax")
|
|
11
|
-
local FIRST_TRINKET_TYPE = ____constantsMax.FIRST_TRINKET_TYPE
|
|
12
|
-
local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_TYPE
|
|
13
10
|
local ____enums = require("functions.enums")
|
|
14
11
|
local getEnumValues = ____enums.getEnumValues
|
|
15
12
|
local ____set = require("functions.set")
|
|
16
13
|
local copySet = ____set.copySet
|
|
17
14
|
local ____trinkets = require("functions.trinkets")
|
|
15
|
+
local getTrinketTypeRange = ____trinkets.getTrinketTypeRange
|
|
18
16
|
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
19
|
-
local ____utils = require("functions.utils")
|
|
20
|
-
local irange = ____utils.irange
|
|
21
17
|
function initCacheFlagMap(self)
|
|
22
18
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
23
19
|
local trinketsSet = __TS__New(Set)
|
|
24
|
-
for ____,
|
|
25
|
-
local trinketType = trinketTypeInt
|
|
20
|
+
for ____, trinketType in ipairs(getTrinketTypeRange(nil)) do
|
|
26
21
|
if trinketHasCacheFlag(nil, trinketType, cacheFlag) then
|
|
27
22
|
trinketsSet:add(trinketType)
|
|
28
23
|
end
|
|
@@ -4,17 +4,13 @@ local __TS__New = ____lualib.__TS__New
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____cachedClasses = require("cachedClasses")
|
|
6
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
7
|
-
local ____constantsMax = require("constantsMax")
|
|
8
|
-
local FIRST_TRINKET_TYPE = ____constantsMax.FIRST_TRINKET_TYPE
|
|
9
|
-
local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_TYPE
|
|
10
7
|
local ____set = require("functions.set")
|
|
11
8
|
local copySet = ____set.copySet
|
|
12
|
-
local
|
|
13
|
-
local
|
|
9
|
+
local ____trinkets = require("functions.trinkets")
|
|
10
|
+
local getTrinketTypeRange = ____trinkets.getTrinketTypeRange
|
|
14
11
|
local TRINKET_SET = __TS__New(Set)
|
|
15
12
|
local function initTrinketSet(self)
|
|
16
|
-
for ____,
|
|
17
|
-
local trinketType = trinketTypeInt
|
|
13
|
+
for ____, trinketType in ipairs(getTrinketTypeRange(nil)) do
|
|
18
14
|
local itemConfigTrinket = itemConfig:GetTrinket(trinketType)
|
|
19
15
|
if itemConfigTrinket ~= nil then
|
|
20
16
|
TRINKET_SET:add(trinketType)
|
|
@@ -38,6 +38,14 @@ export declare function getTrinketDescription(trinketType: TrinketType): string;
|
|
|
38
38
|
* ```
|
|
39
39
|
*/
|
|
40
40
|
export declare function getTrinketName(trinketType: TrinketType): string;
|
|
41
|
+
/**
|
|
42
|
+
* Helper function to get an array that represents the range from the first trinket type to the last
|
|
43
|
+
* trinket type. This will include integers that do not represent any valid trinket types.
|
|
44
|
+
*
|
|
45
|
+
* This function is only useful when building trinket type objects. For most purposes, you should
|
|
46
|
+
* use the `getTrinketSet` helper function instead.
|
|
47
|
+
*/
|
|
48
|
+
export declare function getTrinketTypeRange(): TrinketType[];
|
|
41
49
|
/**
|
|
42
50
|
* Returns whether or not the player can hold an additional trinket, beyond what they are currently
|
|
43
51
|
* carrying. This takes into account items that modify the max number of trinkets, like Mom's Purse.
|
|
@@ -5,6 +5,9 @@ local TrinketSlot = ____isaac_2Dtypescript_2Ddefinitions.TrinketSlot
|
|
|
5
5
|
local TrinketType = ____isaac_2Dtypescript_2Ddefinitions.TrinketType
|
|
6
6
|
local ____cachedClasses = require("cachedClasses")
|
|
7
7
|
local itemConfig = ____cachedClasses.itemConfig
|
|
8
|
+
local ____constantsMax = require("constantsMax")
|
|
9
|
+
local FIRST_TRINKET_TYPE = ____constantsMax.FIRST_TRINKET_TYPE
|
|
10
|
+
local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_TYPE
|
|
8
11
|
local ____trinketDescriptionMap = require("maps.trinketDescriptionMap")
|
|
9
12
|
local DEFAULT_TRINKET_DESCRIPTION = ____trinketDescriptionMap.DEFAULT_TRINKET_DESCRIPTION
|
|
10
13
|
local TRINKET_DESCRIPTION_MAP = ____trinketDescriptionMap.TRINKET_DESCRIPTION_MAP
|
|
@@ -21,6 +24,8 @@ local ____player = require("functions.player")
|
|
|
21
24
|
local isCharacter = ____player.isCharacter
|
|
22
25
|
local ____sprite = require("functions.sprite")
|
|
23
26
|
local clearSprite = ____sprite.clearSprite
|
|
27
|
+
local ____utils = require("functions.utils")
|
|
28
|
+
local irange = ____utils.irange
|
|
24
29
|
local GOLDEN_TRINKET_FLAG = 32767
|
|
25
30
|
local GOLDEN_TRINKET_ADJUSTMENT = 32768
|
|
26
31
|
local TRINKET_SPRITE_LAYER = 0
|
|
@@ -64,6 +69,9 @@ function ____exports.getTrinketName(self, trinketType)
|
|
|
64
69
|
end
|
|
65
70
|
return DEFAULT_TRINKET_NAME
|
|
66
71
|
end
|
|
72
|
+
function ____exports.getTrinketTypeRange(self)
|
|
73
|
+
return irange(nil, FIRST_TRINKET_TYPE, MAX_TRINKET_TYPE)
|
|
74
|
+
end
|
|
67
75
|
function ____exports.hasOpenTrinketSlot(self, player)
|
|
68
76
|
if isCharacter(nil, player, PlayerType.THE_SOUL_B) then
|
|
69
77
|
return false
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.24",
|
|
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
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^2.0.
|
|
28
|
+
"isaac-typescript-definitions": "^2.0.43"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
31
|
"isaacscript-lint": "^1.0.157",
|