isaacscript-common 1.2.103 → 1.2.106
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/constants.d.ts +0 -2
- package/dist/constants.lua +0 -2
- package/dist/features/saveDataManager/exports.d.ts +1 -1
- package/dist/features/saveDataManager/load.d.ts +1 -1
- package/dist/features/saveDataManager/main.lua +1 -1
- package/dist/features/saveDataManager/maps.d.ts +1 -1
- package/dist/features/saveDataManager/merge.lua +1 -1
- package/dist/features/saveDataManager/save.d.ts +1 -1
- package/dist/functions/array.d.ts +7 -5
- package/dist/functions/array.lua +11 -9
- package/dist/functions/cards.d.ts +41 -11
- package/dist/functions/cards.lua +103 -25
- package/dist/functions/collectibleCacheFlag.lua +2 -2
- package/dist/functions/deepCopy.lua +1 -1
- package/dist/functions/deepCopyTests.lua +1 -1
- package/dist/functions/entity.d.ts +11 -0
- package/dist/functions/entity.lua +25 -0
- package/dist/functions/log.lua +10 -10
- package/dist/functions/pickups.d.ts +0 -7
- package/dist/functions/pickups.lua +0 -14
- package/dist/functions/pills.d.ts +1 -0
- package/dist/functions/pills.lua +4 -0
- package/dist/functions/player.lua +47 -39
- package/dist/functions/rooms.d.ts +8 -4
- package/dist/functions/rooms.lua +16 -21
- package/dist/functions/set.d.ts +15 -0
- package/dist/functions/set.lua +20 -0
- package/dist/functions/sprite.d.ts +4 -2
- package/dist/functions/transformations.lua +13 -12
- package/dist/index.d.ts +1 -1
- package/dist/index.lua +1 -1
- package/dist/maps/cardTypeMap.d.ts +4 -0
- package/dist/maps/cardTypeMap.lua +108 -0
- package/dist/types/CardType.d.ts +38 -0
- package/dist/types/CardType.lua +18 -0
- package/dist/types/private/SaveData.d.ts +18 -0
- package/dist/types/private/SaveData.lua +8 -0
- package/dist/types/private/SerializationBrand.d.ts +15 -0
- package/dist/types/private/SerializationBrand.lua +24 -0
- package/package.json +1 -1
package/dist/constants.d.ts
CHANGED
|
@@ -63,8 +63,6 @@ export declare const FINAL_STAGE: number;
|
|
|
63
63
|
* second TMTRAINER item subtracts one from that, and so on.
|
|
64
64
|
*/
|
|
65
65
|
export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
66
|
-
export declare const GENESIS_ROOM_VARIANT = -1;
|
|
67
|
-
export declare const GENESIS_ROOM_SUBTYPE = -1;
|
|
68
66
|
export declare const GOLDEN_TRINKET_SHIFT: number;
|
|
69
67
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
70
68
|
export declare const GAME_FRAMES_PER_SECOND = 30;
|
package/dist/constants.lua
CHANGED
|
@@ -79,8 +79,6 @@ ____exports.FAMILIARS_THAT_SHOOT_PLAYER_TEARS = __TS__New(Set, {
|
|
|
79
79
|
})
|
|
80
80
|
____exports.FINAL_STAGE = LevelStage.NUM_STAGES - 1
|
|
81
81
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
82
|
-
____exports.GENESIS_ROOM_VARIANT = -1
|
|
83
|
-
____exports.GENESIS_ROOM_SUBTYPE = -1
|
|
84
82
|
____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
|
|
85
83
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
86
84
|
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
-
import { SaveData } from "../../types/SaveData";
|
|
3
|
+
import { SaveData } from "../../types/private/SaveData";
|
|
4
4
|
export declare function loadFromDisk(mod: Mod, oldSaveData: LuaTable<string, SaveData>): void;
|
|
@@ -12,7 +12,7 @@ local ____table = require("functions.table")
|
|
|
12
12
|
local clearTable = ____table.clearTable
|
|
13
13
|
local ____ModCallbacksCustom = require("types.ModCallbacksCustom")
|
|
14
14
|
local ModCallbacksCustom = ____ModCallbacksCustom.ModCallbacksCustom
|
|
15
|
-
local ____SaveData = require("types.SaveData")
|
|
15
|
+
local ____SaveData = require("types.private.SaveData")
|
|
16
16
|
local SaveDataKeys = ____SaveData.SaveDataKeys
|
|
17
17
|
local ____load = require("features.saveDataManager.load")
|
|
18
18
|
local loadFromDisk = ____load.loadFromDisk
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
2
|
-
import { SaveData } from "../../types/SaveData";
|
|
2
|
+
import { SaveData } from "../../types/private/SaveData";
|
|
3
3
|
export declare const saveDataMap: LuaTable<string, SaveData>;
|
|
4
4
|
export declare const saveDataDefaultsMap: LuaTable<string, SaveData>;
|
|
5
5
|
export declare const saveDataConditionalFuncMap: Map<string, () => boolean>;
|
|
@@ -17,7 +17,7 @@ local ____log = require("functions.log")
|
|
|
17
17
|
local log = ____log.log
|
|
18
18
|
local ____table = require("functions.table")
|
|
19
19
|
local clearTable = ____table.clearTable
|
|
20
|
-
local ____SerializationBrand = require("types.SerializationBrand")
|
|
20
|
+
local ____SerializationBrand = require("types.private.SerializationBrand")
|
|
21
21
|
local isSerializationBrand = ____SerializationBrand.isSerializationBrand
|
|
22
22
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
23
23
|
local ____debug = require("features.saveDataManager.debug")
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
-
import { SaveData } from "../../types/SaveData";
|
|
3
|
+
import { SaveData } from "../../types/private/SaveData";
|
|
4
4
|
export declare function saveToDisk(mod: Mod, saveDataMap: LuaTable<string, SaveData>, saveDataConditionalFuncMap: Map<string, () => boolean>): void;
|
|
@@ -7,10 +7,12 @@
|
|
|
7
7
|
export declare function arrayEquals<T>(array1: T[] | readonly T[], array2: T[] | readonly T[]): boolean;
|
|
8
8
|
/**
|
|
9
9
|
* Helper function to combine two or more arrays. Returns a new array that is the composition of all
|
|
10
|
-
* of the specified arrays.
|
|
11
|
-
*
|
|
10
|
+
* of the specified arrays.
|
|
11
|
+
*
|
|
12
|
+
* This function is variadic, meaning that you can specify N arguments to combine N arrays. Note
|
|
13
|
+
* that this will only perform a shallow copy of the array elements.
|
|
12
14
|
*/
|
|
13
|
-
export declare function
|
|
15
|
+
export declare function combineArrays<T>(...arrays: Array<T[] | readonly T[]>): T[];
|
|
14
16
|
/**
|
|
15
17
|
* Helper function to perform a shallow copy.
|
|
16
18
|
*
|
|
@@ -53,14 +55,14 @@ export declare function arrayToString<T>(array: T[]): string;
|
|
|
53
55
|
*
|
|
54
56
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
55
57
|
*/
|
|
56
|
-
export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...
|
|
58
|
+
export declare function arrayRemove<T>(originalArray: T[] | readonly T[], ...elementsToRemove: T[]): T[];
|
|
57
59
|
/**
|
|
58
60
|
* Removes the specified element(s) from the array. If the specified element(s) are not found in the
|
|
59
61
|
* array, this function will do nothing. Returns whether or not one or more elements were removed.
|
|
60
62
|
*
|
|
61
63
|
* This function is variadic, meaning that you can specify N arguments to remove N elements.
|
|
62
64
|
*/
|
|
63
|
-
export declare function arrayRemoveInPlace<T>(array: T[], ...
|
|
65
|
+
export declare function arrayRemoveInPlace<T>(array: T[], ...elementsToRemove: T[]): boolean;
|
|
64
66
|
/**
|
|
65
67
|
* Helper function to get a random element from the provided array.
|
|
66
68
|
*
|
package/dist/functions/array.lua
CHANGED
|
@@ -6,6 +6,8 @@ local __TS__ArraySplice = ____lualib.__TS__ArraySplice
|
|
|
6
6
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
7
7
|
local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
|
|
8
8
|
local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
9
|
+
local Set = ____lualib.Set
|
|
10
|
+
local __TS__New = ____lualib.__TS__New
|
|
9
11
|
local __TS__ArrayIndexOf = ____lualib.__TS__ArrayIndexOf
|
|
10
12
|
local ____exports = {}
|
|
11
13
|
local ____random = require("functions.random")
|
|
@@ -49,7 +51,7 @@ function ____exports.arrayEquals(self, array1, array2)
|
|
|
49
51
|
end
|
|
50
52
|
)
|
|
51
53
|
end
|
|
52
|
-
function ____exports.
|
|
54
|
+
function ____exports.combineArrays(self, ...)
|
|
53
55
|
local arrays = {...}
|
|
54
56
|
local elements = {}
|
|
55
57
|
for ____, array in ipairs(arrays) do
|
|
@@ -124,20 +126,20 @@ function ____exports.arrayToString(self, array)
|
|
|
124
126
|
return ("[" .. commaSeparatedStrings) .. "]"
|
|
125
127
|
end
|
|
126
128
|
function ____exports.arrayRemove(self, originalArray, ...)
|
|
127
|
-
local
|
|
128
|
-
local
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
if
|
|
132
|
-
|
|
129
|
+
local elementsToRemove = {...}
|
|
130
|
+
local elementsToRemoveSet = __TS__New(Set, elementsToRemove)
|
|
131
|
+
local array = {}
|
|
132
|
+
for ____, element in ipairs(originalArray) do
|
|
133
|
+
if not elementsToRemoveSet:has(element) then
|
|
134
|
+
__TS__ArrayPush(array, element)
|
|
133
135
|
end
|
|
134
136
|
end
|
|
135
137
|
return array
|
|
136
138
|
end
|
|
137
139
|
function ____exports.arrayRemoveInPlace(self, array, ...)
|
|
138
|
-
local
|
|
140
|
+
local elementsToRemove = {...}
|
|
139
141
|
local removedOneOrMoreElements = false
|
|
140
|
-
for ____, element in ipairs(
|
|
142
|
+
for ____, element in ipairs(elementsToRemove) do
|
|
141
143
|
local index = __TS__ArrayIndexOf(array, element)
|
|
142
144
|
if index > -1 then
|
|
143
145
|
removedOneOrMoreElements = true
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
|
+
import { CardType } from "../types/CardType";
|
|
2
3
|
/**
|
|
3
4
|
* Helper function to get a card description from a Card enum value.
|
|
4
5
|
*
|
|
@@ -20,13 +21,32 @@ export declare function getCardDescription(card: Card | int): string;
|
|
|
20
21
|
*/
|
|
21
22
|
export declare function getCardName(card: Card | int): string;
|
|
22
23
|
/**
|
|
23
|
-
*
|
|
24
|
-
*
|
|
24
|
+
* Helper function to get a set of cards matching the type. Also see the [[`CardType`]] enum.
|
|
25
|
+
*
|
|
26
|
+
* This function is variadic, meaning that you can you can specify N card types to get a set
|
|
27
|
+
* containing cards that match any of the specified types.
|
|
28
|
+
*/
|
|
29
|
+
export declare function getCardsOfType(...cardTypes: CardType[]): Set<Card>;
|
|
30
|
+
export declare function getCardType(card: Card | int): CardType;
|
|
31
|
+
export declare function getMaxCards(): int;
|
|
32
|
+
/**
|
|
33
|
+
* Has an equal chance of returning any card (e.g. Fool, Reverse Fool, Wild Card, etc.).
|
|
34
|
+
*
|
|
35
|
+
* This will not return:
|
|
36
|
+
* - any runes
|
|
37
|
+
* - any objects like Dice Shard
|
|
38
|
+
* - any modded cards.
|
|
25
39
|
*
|
|
26
40
|
* @param seed Optional. The seed with which to select the random card. `Random()` by default.
|
|
27
41
|
* @param exceptions Optional. An array of cards to not select.
|
|
28
42
|
*/
|
|
29
43
|
export declare function getRandomCard(seed?: number, exceptions?: Card[]): Card;
|
|
44
|
+
/**
|
|
45
|
+
* @param cardType The card type that represents the pool of cards to select from.
|
|
46
|
+
* @param seed Optional. The seed with which to select the random card. `Random()` by default.
|
|
47
|
+
* @param exceptions Optional. An array of cards to not select.
|
|
48
|
+
*/
|
|
49
|
+
export declare function getRandomCardOfType(cardType: CardType, seed?: number, exceptions?: Card[]): Card;
|
|
30
50
|
/**
|
|
31
51
|
* Has an equal chance of returning any rune (e.g. Rune of Hagalaz, Blank Rune, Black Rune, Soul of
|
|
32
52
|
* Isaac, etc.). This will never return a Rune Shard.
|
|
@@ -36,16 +56,26 @@ export declare function getRandomCard(seed?: number, exceptions?: Card[]): Card;
|
|
|
36
56
|
*/
|
|
37
57
|
export declare function getRandomRune(seed?: number, exceptions?: Card[]): Card;
|
|
38
58
|
/**
|
|
39
|
-
* Returns true for
|
|
40
|
-
*
|
|
59
|
+
* Returns true for cards that have the following card type:
|
|
60
|
+
* - CardType.TAROT
|
|
61
|
+
* - CardType.SUIT
|
|
62
|
+
* - CardType.SPECIAL
|
|
63
|
+
* - CardType.TAROT_REVERSE
|
|
41
64
|
*/
|
|
42
65
|
export declare function isCard(card: Card): boolean;
|
|
43
|
-
/**
|
|
44
|
-
|
|
45
|
-
*/
|
|
66
|
+
/** Returns whether or not the given card matches the specified card type. */
|
|
67
|
+
export declare function isCardType(card: Card, cardType: CardType): boolean;
|
|
68
|
+
/** Returns true for cards that have `CardType.MODDED`. */
|
|
69
|
+
export declare function isModdedCard(card: Card): boolean;
|
|
70
|
+
/** Returns true for cards that have `CardType.OBJECT`. */
|
|
46
71
|
export declare function isPocketItemObject(card: Card): boolean;
|
|
47
|
-
/**
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
72
|
+
/** Returns true for cards that have `CardType.TAROT`. */
|
|
73
|
+
export declare function isTarotCard(card: Card): boolean;
|
|
74
|
+
/** Returns true for cards that have `CardType.TAROT_REVERSE`. */
|
|
75
|
+
export declare function isReverseTarotCard(card: Card): boolean;
|
|
76
|
+
/** Returns true for cards that have `CardType.RUNE`. */
|
|
51
77
|
export declare function isRune(card: Card): boolean;
|
|
78
|
+
/** Returns true for cards that have `CardType.SPECIAL`. */
|
|
79
|
+
export declare function isSpecialCard(card: Card): boolean;
|
|
80
|
+
/** Returns true for cards that have `CardType.SUIT`. */
|
|
81
|
+
export declare function isSuitCard(card: Card): boolean;
|
package/dist/functions/cards.lua
CHANGED
|
@@ -1,20 +1,79 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
local ____lualib = require("lualib_bundle")
|
|
3
|
-
local
|
|
3
|
+
local Map = ____lualib.Map
|
|
4
|
+
local __TS__New = ____lualib.__TS__New
|
|
5
|
+
local Set = ____lualib.Set
|
|
6
|
+
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
4
7
|
local ____exports = {}
|
|
8
|
+
local initCardObjects, CARD_TYPE_TO_CARDS_MAP, CARD_SET
|
|
5
9
|
local ____cardDescriptionMap = require("maps.cardDescriptionMap")
|
|
6
10
|
local CARD_DESCRIPTION_MAP = ____cardDescriptionMap.CARD_DESCRIPTION_MAP
|
|
7
11
|
local ____cardNameMap = require("maps.cardNameMap")
|
|
8
12
|
local CARD_NAME_MAP = ____cardNameMap.CARD_NAME_MAP
|
|
9
|
-
local
|
|
10
|
-
local
|
|
11
|
-
local
|
|
12
|
-
local
|
|
13
|
-
local
|
|
14
|
-
local
|
|
15
|
-
local
|
|
16
|
-
local
|
|
17
|
-
local
|
|
13
|
+
local ____cardTypeMap = require("maps.cardTypeMap")
|
|
14
|
+
local CARD_TYPE_MAP = ____cardTypeMap.CARD_TYPE_MAP
|
|
15
|
+
local DEFAULT_CARD_TYPE = ____cardTypeMap.DEFAULT_CARD_TYPE
|
|
16
|
+
local ____CardType = require("types.CardType")
|
|
17
|
+
local CardType = ____CardType.CardType
|
|
18
|
+
local ____math = require("functions.math")
|
|
19
|
+
local range = ____math.range
|
|
20
|
+
local ____set = require("functions.set")
|
|
21
|
+
local addSetsToSet = ____set.addSetsToSet
|
|
22
|
+
local getRandomSetElement = ____set.getRandomSetElement
|
|
23
|
+
local ____utils = require("functions.utils")
|
|
24
|
+
local getEnumValues = ____utils.getEnumValues
|
|
25
|
+
function initCardObjects(self)
|
|
26
|
+
local maxCards = ____exports.getMaxCards(nil)
|
|
27
|
+
for ____, cardType in ipairs(getEnumValues(nil, CardType)) do
|
|
28
|
+
CARD_TYPE_TO_CARDS_MAP:set(
|
|
29
|
+
cardType,
|
|
30
|
+
__TS__New(Set)
|
|
31
|
+
)
|
|
32
|
+
end
|
|
33
|
+
for ____, card in ipairs(range(nil, 1, maxCards)) do
|
|
34
|
+
local cardType = ____exports.getCardType(nil, card)
|
|
35
|
+
local cardTypeSet = CARD_TYPE_TO_CARDS_MAP:get(cardType)
|
|
36
|
+
if cardTypeSet == nil then
|
|
37
|
+
error("Failed to get the card set for card type: " .. tostring(cardType))
|
|
38
|
+
end
|
|
39
|
+
cardTypeSet:add(card)
|
|
40
|
+
end
|
|
41
|
+
local cards = ____exports.getCardsOfType(
|
|
42
|
+
nil,
|
|
43
|
+
CardType.TAROT,
|
|
44
|
+
CardType.SUIT,
|
|
45
|
+
CardType.SPECIAL,
|
|
46
|
+
CardType.TAROT_REVERSE
|
|
47
|
+
)
|
|
48
|
+
addSetsToSet(nil, CARD_SET, cards)
|
|
49
|
+
end
|
|
50
|
+
function ____exports.getCardsOfType(self, ...)
|
|
51
|
+
local cardTypes = {...}
|
|
52
|
+
if CARD_TYPE_TO_CARDS_MAP.size == 0 then
|
|
53
|
+
initCardObjects(nil)
|
|
54
|
+
end
|
|
55
|
+
local matchingCards = __TS__New(Set)
|
|
56
|
+
for ____, cardType in ipairs(cardTypes) do
|
|
57
|
+
local cardSet = CARD_TYPE_TO_CARDS_MAP:get(cardType)
|
|
58
|
+
if cardSet == nil then
|
|
59
|
+
error("Failed to get the cards for type: " .. tostring(cardType))
|
|
60
|
+
end
|
|
61
|
+
for ____, card in __TS__Iterator(cardSet:values()) do
|
|
62
|
+
matchingCards:add(card)
|
|
63
|
+
end
|
|
64
|
+
end
|
|
65
|
+
return matchingCards
|
|
66
|
+
end
|
|
67
|
+
function ____exports.getCardType(self, card)
|
|
68
|
+
local cardType = CARD_TYPE_MAP:get(card)
|
|
69
|
+
return cardType == nil and DEFAULT_CARD_TYPE or cardType
|
|
70
|
+
end
|
|
71
|
+
function ____exports.getMaxCards(self)
|
|
72
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
73
|
+
return itemConfig:GetCards().Size - 1
|
|
74
|
+
end
|
|
75
|
+
CARD_TYPE_TO_CARDS_MAP = __TS__New(Map)
|
|
76
|
+
CARD_SET = __TS__New(Set)
|
|
18
77
|
function ____exports.getCardDescription(self, card)
|
|
19
78
|
local itemConfig = Isaac.GetItemConfig()
|
|
20
79
|
local defaultDescription = "Unknown"
|
|
@@ -54,12 +113,17 @@ function ____exports.getRandomCard(self, seed, exceptions)
|
|
|
54
113
|
if exceptions == nil then
|
|
55
114
|
exceptions = {}
|
|
56
115
|
end
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
116
|
+
return getRandomSetElement(nil, CARD_SET, seed, exceptions)
|
|
117
|
+
end
|
|
118
|
+
function ____exports.getRandomCardOfType(self, cardType, seed, exceptions)
|
|
119
|
+
if seed == nil then
|
|
120
|
+
seed = Random()
|
|
121
|
+
end
|
|
122
|
+
if exceptions == nil then
|
|
123
|
+
exceptions = {}
|
|
124
|
+
end
|
|
125
|
+
local cardSet = ____exports.getCardsOfType(nil, cardType)
|
|
126
|
+
return getRandomSetElement(nil, cardSet, seed, exceptions)
|
|
63
127
|
end
|
|
64
128
|
function ____exports.getRandomRune(self, seed, exceptions)
|
|
65
129
|
if seed == nil then
|
|
@@ -68,21 +132,35 @@ function ____exports.getRandomRune(self, seed, exceptions)
|
|
|
68
132
|
if exceptions == nil then
|
|
69
133
|
exceptions = {}
|
|
70
134
|
end
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
RUNES,
|
|
75
|
-
table.unpack(exceptions)
|
|
76
|
-
)
|
|
77
|
-
return getRandomArrayElement(nil, runesWithoutExceptions, seed)
|
|
135
|
+
local runesSet = ____exports.getCardsOfType(nil, CardType.RUNE)
|
|
136
|
+
runesSet:delete(Card.RUNE_SHARD)
|
|
137
|
+
return getRandomSetElement(nil, runesSet, seed, exceptions)
|
|
78
138
|
end
|
|
79
139
|
function ____exports.isCard(self, card)
|
|
80
140
|
return CARD_SET:has(card)
|
|
81
141
|
end
|
|
142
|
+
function ____exports.isCardType(self, card, cardType)
|
|
143
|
+
return cardType == ____exports.getCardType(nil, card)
|
|
144
|
+
end
|
|
145
|
+
function ____exports.isModdedCard(self, card)
|
|
146
|
+
return ____exports.isCardType(nil, card, CardType.MODDED)
|
|
147
|
+
end
|
|
82
148
|
function ____exports.isPocketItemObject(self, card)
|
|
83
|
-
return
|
|
149
|
+
return ____exports.isCardType(nil, card, CardType.OBJECT)
|
|
150
|
+
end
|
|
151
|
+
function ____exports.isTarotCard(self, card)
|
|
152
|
+
return ____exports.isCardType(nil, card, CardType.TAROT)
|
|
153
|
+
end
|
|
154
|
+
function ____exports.isReverseTarotCard(self, card)
|
|
155
|
+
return ____exports.isCardType(nil, card, CardType.TAROT_REVERSE)
|
|
84
156
|
end
|
|
85
157
|
function ____exports.isRune(self, card)
|
|
86
|
-
return
|
|
158
|
+
return ____exports.isCardType(nil, card, CardType.RUNE)
|
|
159
|
+
end
|
|
160
|
+
function ____exports.isSpecialCard(self, card)
|
|
161
|
+
return ____exports.isCardType(nil, card, CardType.SPECIAL)
|
|
162
|
+
end
|
|
163
|
+
function ____exports.isSuitCard(self, card)
|
|
164
|
+
return ____exports.isCardType(nil, card, CardType.SUIT)
|
|
87
165
|
end
|
|
88
166
|
return ____exports
|
|
@@ -4,7 +4,6 @@ local Map = ____lualib.Map
|
|
|
4
4
|
local __TS__New = ____lualib.__TS__New
|
|
5
5
|
local Set = ____lualib.Set
|
|
6
6
|
local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
7
|
-
local __TS__Iterator = ____lualib.__TS__Iterator
|
|
8
7
|
local ____exports = {}
|
|
9
8
|
local ____collectibles = require("functions.collectibles")
|
|
10
9
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
@@ -13,6 +12,7 @@ local ____math = require("functions.math")
|
|
|
13
12
|
local range = ____math.range
|
|
14
13
|
local ____set = require("functions.set")
|
|
15
14
|
local copySet = ____set.copySet
|
|
15
|
+
local getSortedSetValues = ____set.getSortedSetValues
|
|
16
16
|
local ____utils = require("functions.utils")
|
|
17
17
|
local getEnumValues = ____utils.getEnumValues
|
|
18
18
|
local ____repeat = ____utils["repeat"]
|
|
@@ -42,7 +42,7 @@ end
|
|
|
42
42
|
function ____exports.getPlayerCollectiblesForCacheFlag(self, player, cacheFlag)
|
|
43
43
|
local collectiblesForCacheFlag = ____exports.getCollectiblesForCacheFlag(nil, cacheFlag)
|
|
44
44
|
local playerCollectibles = {}
|
|
45
|
-
for ____, collectibleType in
|
|
45
|
+
for ____, collectibleType in ipairs(getSortedSetValues(nil, collectiblesForCacheFlag)) do
|
|
46
46
|
local numCollectibles = player:GetCollectibleNum(collectibleType)
|
|
47
47
|
____repeat(
|
|
48
48
|
nil,
|
|
@@ -11,7 +11,7 @@ local ____debug = require("features.saveDataManager.debug")
|
|
|
11
11
|
local SAVE_DATA_MANAGER_DEBUG = ____debug.SAVE_DATA_MANAGER_DEBUG
|
|
12
12
|
local ____DefaultMap = require("types.DefaultMap")
|
|
13
13
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
14
|
-
local ____SerializationBrand = require("types.SerializationBrand")
|
|
14
|
+
local ____SerializationBrand = require("types.private.SerializationBrand")
|
|
15
15
|
local isSerializationBrand = ____SerializationBrand.isSerializationBrand
|
|
16
16
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
17
17
|
local ____log = require("functions.log")
|
|
@@ -8,7 +8,7 @@ local ____exports = {}
|
|
|
8
8
|
local copiedObjectIsTable, copiedObjectHasKeyAndValueString, copiedTableHasKeyAndValueNumber, copiedTableDoesNotCoerceTypes, copiedObjectHasNoReferencesForPrimitivesForward, copiedObjectHasNoReferencesForPrimitivesBackward, copiedObjectHasNoReferencesForArray, copiedObjectHasChildObject, copiedMapIsMap, copiedMapHasValue, copiedSetIsSet, copiedSetHasValue, copiedMapHasChildMap, copiedDefaultMapHasChildDefaultMap, copiedDefaultMapHasBrand
|
|
9
9
|
local ____DefaultMap = require("types.DefaultMap")
|
|
10
10
|
local DefaultMap = ____DefaultMap.DefaultMap
|
|
11
|
-
local ____SerializationBrand = require("types.SerializationBrand")
|
|
11
|
+
local ____SerializationBrand = require("types.private.SerializationBrand")
|
|
12
12
|
local SerializationBrand = ____SerializationBrand.SerializationBrand
|
|
13
13
|
local ____array = require("functions.array")
|
|
14
14
|
local arrayEquals = ____array.arrayEquals
|
|
@@ -1,6 +1,17 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { AnyEntity } from "../types/AnyEntity";
|
|
3
3
|
export declare function anyEntityCloserThan(entities: Entity[], position: Vector, distance: int): boolean;
|
|
4
|
+
/**
|
|
5
|
+
* Helper function to count the number of entities in room. Use this over the vanilla
|
|
6
|
+
* `Isaac.CountEntities` method to avoid having to specify a spawner and to handle ignoring charmed
|
|
7
|
+
* enemies.
|
|
8
|
+
*
|
|
9
|
+
* @param entityType -1 by default.
|
|
10
|
+
* @param variant -1 by default.
|
|
11
|
+
* @param subType -1 by default.
|
|
12
|
+
* @param ignoreFriendly False by default.
|
|
13
|
+
*/
|
|
14
|
+
export declare function countEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): number;
|
|
4
15
|
/**
|
|
5
16
|
* Given an array of entities, this helper function returns the closest one to a provided reference
|
|
6
17
|
* entity.
|
|
@@ -19,6 +19,31 @@ function ____exports.anyEntityCloserThan(self, entities, position, distance)
|
|
|
19
19
|
function(____, entity) return position:Distance(entity.Position) <= distance end
|
|
20
20
|
)
|
|
21
21
|
end
|
|
22
|
+
function ____exports.countEntities(self, entityType, variant, subType, ignoreFriendly)
|
|
23
|
+
if entityType == nil then
|
|
24
|
+
entityType = -1
|
|
25
|
+
end
|
|
26
|
+
if variant == nil then
|
|
27
|
+
variant = -1
|
|
28
|
+
end
|
|
29
|
+
if subType == nil then
|
|
30
|
+
subType = -1
|
|
31
|
+
end
|
|
32
|
+
if ignoreFriendly == nil then
|
|
33
|
+
ignoreFriendly = false
|
|
34
|
+
end
|
|
35
|
+
if not ignoreFriendly then
|
|
36
|
+
return Isaac.CountEntities(nil, entityType, variant, subType)
|
|
37
|
+
end
|
|
38
|
+
local entities = Isaac.FindByType(
|
|
39
|
+
entityType,
|
|
40
|
+
variant,
|
|
41
|
+
subType,
|
|
42
|
+
false,
|
|
43
|
+
ignoreFriendly
|
|
44
|
+
)
|
|
45
|
+
return #entities
|
|
46
|
+
end
|
|
22
47
|
function ____exports.getClosestEntityTo(self, referenceEntity, entities)
|
|
23
48
|
local closestEntity = nil
|
|
24
49
|
local closestDistance = math.huge
|
package/dist/functions/log.lua
CHANGED
|
@@ -15,10 +15,11 @@ local hasFlag = ____flag.hasFlag
|
|
|
15
15
|
local ____player = require("functions.player")
|
|
16
16
|
local getEffectsList = ____player.getEffectsList
|
|
17
17
|
local ____rooms = require("functions.rooms")
|
|
18
|
+
local getRoomData = ____rooms.getRoomData
|
|
18
19
|
local getRoomGridIndex = ____rooms.getRoomGridIndex
|
|
19
20
|
local getRoomListIndex = ____rooms.getRoomListIndex
|
|
20
|
-
local
|
|
21
|
-
local
|
|
21
|
+
local ____set = require("functions.set")
|
|
22
|
+
local getSortedSetValues = ____set.getSortedSetValues
|
|
22
23
|
local ____trinkets = require("functions.trinkets")
|
|
23
24
|
local getTrinketName = ____trinkets.getTrinketName
|
|
24
25
|
function ____exports.getDebugPrependString(self, msg, numParentFunctions)
|
|
@@ -130,14 +131,14 @@ function ____exports.logMap(map)
|
|
|
130
131
|
____exports.log("The size of the map was: " .. tostring(map.size))
|
|
131
132
|
end
|
|
132
133
|
function ____exports.logRoom()
|
|
133
|
-
local game = Game()
|
|
134
|
-
local room = game:GetRoom()
|
|
135
|
-
local roomType = room:GetType()
|
|
136
|
-
local roomVariant = getRoomVariant(nil)
|
|
137
|
-
local roomSubType = getRoomSubType(nil)
|
|
138
134
|
local roomGridIndex = getRoomGridIndex(nil)
|
|
139
135
|
local roomListIndex = getRoomListIndex(nil)
|
|
140
|
-
|
|
136
|
+
local roomData = getRoomData(nil)
|
|
137
|
+
if roomData == nil then
|
|
138
|
+
____exports.log("Current room data is undefined.")
|
|
139
|
+
else
|
|
140
|
+
____exports.log((((("Current room type/variant/sub-type: " .. tostring(roomData.Type)) .. ".") .. tostring(roomData.Variant)) .. ".") .. tostring(roomData.Subtype))
|
|
141
|
+
end
|
|
141
142
|
____exports.log("Current room grid index: " .. tostring(roomGridIndex))
|
|
142
143
|
____exports.log("Current room list index: " .. tostring(roomListIndex))
|
|
143
144
|
end
|
|
@@ -190,8 +191,7 @@ function ____exports.logTemporaryEffects(player)
|
|
|
190
191
|
end
|
|
191
192
|
function ____exports.logSet(set)
|
|
192
193
|
____exports.log("Printing out a TSTL Set:")
|
|
193
|
-
local setValues =
|
|
194
|
-
__TS__ArraySort(setValues)
|
|
194
|
+
local setValues = getSortedSetValues(nil, set)
|
|
195
195
|
for ____, value in ipairs(setValues) do
|
|
196
196
|
____exports.log(" Value: " .. tostring(value))
|
|
197
197
|
end
|
|
@@ -11,13 +11,6 @@
|
|
|
11
11
|
* ```
|
|
12
12
|
*/
|
|
13
13
|
export declare function getPickups(matchingVariant?: PickupVariant | int, matchingSubType?: number): EntityPickup[];
|
|
14
|
-
/**
|
|
15
|
-
* Has as an equal chance of returning any value in the `HeartSubType` enum. Useful for spawning a random type of heart.
|
|
16
|
-
*
|
|
17
|
-
* @param seed Optional. The seed with which to select the random sub-type. `Random()` by default.
|
|
18
|
-
* @param exceptions Optional. An array of sub-types to not select.
|
|
19
|
-
*/
|
|
20
|
-
export declare function getRandomHeartSubType(seed?: number, exceptions?: HeartSubType[]): HeartSubType;
|
|
21
14
|
export declare function isChest(pickup: EntityPickup): boolean;
|
|
22
15
|
/**
|
|
23
16
|
* Helper function to remove all of the pickups in the room.
|
|
@@ -4,13 +4,9 @@ local __TS__ArrayPush = ____lualib.__TS__ArrayPush
|
|
|
4
4
|
local ____exports = {}
|
|
5
5
|
local ____constants = require("constants")
|
|
6
6
|
local CHEST_PICKUP_VARIANTS = ____constants.CHEST_PICKUP_VARIANTS
|
|
7
|
-
local ____array = require("functions.array")
|
|
8
|
-
local getRandomArrayElement = ____array.getRandomArrayElement
|
|
9
7
|
local ____entity = require("functions.entity")
|
|
10
8
|
local getEntities = ____entity.getEntities
|
|
11
9
|
local removeEntities = ____entity.removeEntities
|
|
12
|
-
local ____utils = require("functions.utils")
|
|
13
|
-
local getEnumValues = ____utils.getEnumValues
|
|
14
10
|
function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
15
11
|
if matchingVariant == nil then
|
|
16
12
|
matchingVariant = -1
|
|
@@ -28,16 +24,6 @@ function ____exports.getPickups(self, matchingVariant, matchingSubType)
|
|
|
28
24
|
end
|
|
29
25
|
return pickups
|
|
30
26
|
end
|
|
31
|
-
function ____exports.getRandomHeartSubType(self, seed, exceptions)
|
|
32
|
-
if seed == nil then
|
|
33
|
-
seed = Random()
|
|
34
|
-
end
|
|
35
|
-
if exceptions == nil then
|
|
36
|
-
exceptions = {}
|
|
37
|
-
end
|
|
38
|
-
local heartSubTypes = getEnumValues(nil, HeartSubType)
|
|
39
|
-
return getRandomArrayElement(nil, heartSubTypes, seed, exceptions)
|
|
40
|
-
end
|
|
41
27
|
function ____exports.isChest(self, pickup)
|
|
42
28
|
return CHEST_PICKUP_VARIANTS:has(pickup.Variant)
|
|
43
29
|
end
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
import { PillEffectClass } from "../types/PillEffectClass";
|
|
3
3
|
import { PillEffectType } from "../types/PillEffectType";
|
|
4
|
+
export declare function getMaxPillEffects(): int;
|
|
4
5
|
/**
|
|
5
6
|
* Helper function to get a pill effect class from a PillEffect enum value. In this context, the
|
|
6
7
|
* class is equal to the numerical prefix in the "class" tag in the "pocketitems.xml" file. Use the
|
package/dist/functions/pills.lua
CHANGED
|
@@ -10,6 +10,10 @@ local ____PillEffectClass = require("types.PillEffectClass")
|
|
|
10
10
|
local DEFAULT_PILL_EFFECT_CLASS = ____PillEffectClass.DEFAULT_PILL_EFFECT_CLASS
|
|
11
11
|
local ____PillEffectType = require("types.PillEffectType")
|
|
12
12
|
local DEFAULT_PILL_EFFECT_TYPE = ____PillEffectType.DEFAULT_PILL_EFFECT_TYPE
|
|
13
|
+
function ____exports.getMaxPillEffects(self)
|
|
14
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
15
|
+
return itemConfig:GetPillEffects().Size - 1
|
|
16
|
+
end
|
|
13
17
|
function ____exports.getPillEffectClass(self, pillEffect)
|
|
14
18
|
local pillEffectClass = PILL_EFFECT_CLASS_MAP:get(pillEffect)
|
|
15
19
|
return pillEffectClass == nil and DEFAULT_PILL_EFFECT_CLASS or pillEffectClass
|