isaacscript-common 2.0.10 → 2.0.13
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/classes/DefaultMap.d.ts +2 -1
- package/dist/enums/ModCallbackCustom.d.ts +0 -3
- package/dist/features/deployJSONRoom.d.ts +16 -9
- package/dist/features/deployJSONRoom.lua +2 -2
- package/dist/features/disableInputs.d.ts +6 -6
- package/dist/features/disableSound.d.ts +2 -2
- package/dist/features/extraConsoleCommands/commands.d.ts +10 -9
- package/dist/features/runInNFrames.d.ts +2 -1
- package/dist/features/saveDataManager/exports.d.ts +8 -6
- package/dist/features/sirenHelpers.d.ts +1 -1
- package/dist/functions/array.d.ts +10 -9
- package/dist/functions/array.lua +1 -2
- package/dist/functions/benchmark.d.ts +1 -1
- package/dist/functions/cards.d.ts +7 -5
- package/dist/functions/cards.lua +2 -2
- package/dist/functions/charge.d.ts +6 -3
- package/dist/functions/collectibleCacheFlag.lua +1 -2
- package/dist/functions/collectibleSet.lua +2 -2
- package/dist/functions/collectibleTag.lua +2 -2
- package/dist/functions/collectibles.d.ts +9 -6
- package/dist/functions/color.d.ts +1 -1
- package/dist/functions/deepCopy.d.ts +2 -1
- package/dist/functions/entity.d.ts +9 -6
- package/dist/functions/entity.lua +1 -1
- package/dist/functions/entitySpecific.d.ts +20 -11
- package/dist/functions/enums.d.ts +11 -1
- package/dist/functions/enums.lua +14 -0
- package/dist/functions/familiars.d.ts +5 -5
- package/dist/functions/flag.d.ts +6 -2
- package/dist/functions/flying.d.ts +1 -1
- package/dist/functions/gridEntity.d.ts +13 -8
- package/dist/functions/gridEntity.lua +2 -1
- package/dist/functions/input.lua +2 -2
- package/dist/functions/kColor.d.ts +1 -1
- package/dist/functions/map.d.ts +2 -1
- package/dist/functions/math.d.ts +5 -16
- package/dist/functions/math.lua +5 -29
- package/dist/functions/npc.d.ts +2 -2
- package/dist/functions/pickups.d.ts +2 -2
- package/dist/functions/pills.d.ts +2 -1
- package/dist/functions/player.d.ts +2 -2
- package/dist/functions/playerIndex.d.ts +2 -1
- package/dist/functions/positionVelocity.d.ts +9 -5
- package/dist/functions/random.d.ts +7 -5
- package/dist/functions/rng.d.ts +1 -1
- package/dist/functions/rooms.d.ts +5 -4
- package/dist/functions/rooms.lua +2 -2
- package/dist/functions/set.d.ts +1 -1
- package/dist/functions/spawnCollectible.d.ts +4 -4
- package/dist/functions/sprite.lua +2 -2
- package/dist/functions/transformations.d.ts +2 -1
- package/dist/functions/trinketCacheFlag.lua +2 -2
- package/dist/functions/trinketGive.d.ts +1 -1
- package/dist/functions/trinketSet.lua +2 -2
- package/dist/functions/trinkets.d.ts +7 -4
- package/dist/functions/ui.d.ts +2 -2
- package/dist/functions/utils.d.ts +22 -2
- package/dist/functions/utils.lua +30 -0
- package/dist/functions/vector.d.ts +1 -1
- package/dist/types/CollectibleIndex.d.ts +2 -1
- package/dist/types/PlayerIndex.d.ts +2 -1
- package/dist/upgradeMod.d.ts +2 -4
- package/package.json +4 -3
|
@@ -14,7 +14,8 @@ declare type SecondArg<K, V, A extends unknown[]> = V | FactoryFunction<K, V, A>
|
|
|
14
14
|
* When instantiating a new DefaultMap, you must specify either a default value or a function that
|
|
15
15
|
* returns a default value.
|
|
16
16
|
*
|
|
17
|
-
*
|
|
17
|
+
* For example:
|
|
18
|
+
*
|
|
18
19
|
* ```ts
|
|
19
20
|
* // Initializes a new empty DefaultMap with a default value of "foo"
|
|
20
21
|
* const defaultMapWithPrimitive = new DefaultMap<string, string>("foo");
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* These are the custom callbacks available for use once the mod object has been upgraded. Also see
|
|
3
3
|
* the [[`upgradeMod`]] function.
|
|
4
|
-
*
|
|
5
|
-
* For a better listing of all custom callbacks, check out the
|
|
6
|
-
* [Function Signatures](https://isaacscript.github.io/docs/function-signatures#custom-callbacks).
|
|
7
4
|
*/
|
|
8
5
|
export declare enum ModCallbackCustom {
|
|
9
6
|
POST_BOMB_INIT_LATE = 0,
|
|
@@ -7,17 +7,21 @@ import { JSONRoom } from "../types/JSONRoom";
|
|
|
7
7
|
*
|
|
8
8
|
* This function is meant to be used in the PostNewRoom callback.
|
|
9
9
|
*
|
|
10
|
-
*
|
|
10
|
+
* For example:
|
|
11
|
+
*
|
|
11
12
|
* ```ts
|
|
13
|
+
*
|
|
12
14
|
* import customRooms from "./customRooms";
|
|
13
15
|
*
|
|
14
16
|
* const firstJSONRoom = customRooms.rooms.room[0];
|
|
15
17
|
* deployJSONRoom(firstJSONRoom);
|
|
16
18
|
* ```
|
|
19
|
+
*
|
|
20
|
+
* @param jsonRoom The JSON room to deploy. *
|
|
17
21
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
18
|
-
*
|
|
22
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
19
23
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
20
|
-
*
|
|
24
|
+
* what the function is doing. Default is false.
|
|
21
25
|
*/
|
|
22
26
|
export declare function deployJSONRoom(jsonRoom: JSONRoom, seedOrRNG?: Seed | RNG, verbose?: boolean): void;
|
|
23
27
|
/**
|
|
@@ -31,18 +35,21 @@ export declare function deployJSONRoom(jsonRoom: JSONRoom, seedOrRNG?: Seed | RN
|
|
|
31
35
|
* properly account for each room weight using the algorithm from:
|
|
32
36
|
* https://stackoverflow.com/questions/1761626/weighted-random-numbers
|
|
33
37
|
*
|
|
34
|
-
*
|
|
35
|
-
*
|
|
38
|
+
* For example:
|
|
39
|
+
*
|
|
36
40
|
* ```ts
|
|
37
41
|
* import customRooms from "./customRooms";
|
|
38
42
|
*
|
|
39
43
|
* const jsonRooms = customRooms.rooms.room;
|
|
40
44
|
* deployRandomJSONRoom(jsonRooms);
|
|
41
45
|
* ```
|
|
46
|
+
*
|
|
47
|
+
* @param jsonRooms An array of JSON rooms to randomly select from. In practice, this will be
|
|
48
|
+
* something like.
|
|
42
49
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
43
|
-
*
|
|
50
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
44
51
|
* @param verbose Optional. If specified, will write entries to the "log.txt" file that describe
|
|
45
|
-
*
|
|
52
|
+
* what the function is doing. Default is false.
|
|
46
53
|
*/
|
|
47
54
|
export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG?: Seed | RNG, verbose?: boolean): void;
|
|
48
55
|
/**
|
|
@@ -52,7 +59,7 @@ export declare function deployRandomJSONRoom(jsonRooms: JSONRoom[], seedOrRNG?:
|
|
|
52
59
|
* effects (1000), doors, and walls.
|
|
53
60
|
*
|
|
54
61
|
* @param fillWithDecorations Optional. Set to true to fill every grid tile with an invisible
|
|
55
|
-
*
|
|
56
|
-
* player enters. Default is false.
|
|
62
|
+
* decoration, which prevents vanilla entities in the room from
|
|
63
|
+
* respawning the next time that the player enters. Default is false.
|
|
57
64
|
*/
|
|
58
65
|
export declare function emptyRoom(fillWithDecorations: boolean): void;
|
|
@@ -40,8 +40,6 @@ local ____jsonRoom = require("functions.jsonRoom")
|
|
|
40
40
|
local getRandomJSONRoom = ____jsonRoom.getRandomJSONRoom
|
|
41
41
|
local ____log = require("functions.log")
|
|
42
42
|
local log = ____log.log
|
|
43
|
-
local ____math = require("functions.math")
|
|
44
|
-
local erange = ____math.erange
|
|
45
43
|
local ____rng = require("functions.rng")
|
|
46
44
|
local getRandomSeed = ____rng.getRandomSeed
|
|
47
45
|
local isRNG = ____rng.isRNG
|
|
@@ -55,6 +53,8 @@ local setRoomCleared = ____rooms.setRoomCleared
|
|
|
55
53
|
local setRoomUncleared = ____rooms.setRoomUncleared
|
|
56
54
|
local ____spawnCollectible = require("functions.spawnCollectible")
|
|
57
55
|
local spawnCollectible = ____spawnCollectible.spawnCollectible
|
|
56
|
+
local ____utils = require("functions.utils")
|
|
57
|
+
local erange = ____utils.erange
|
|
58
58
|
local ____exports = require("features.saveDataManager.exports")
|
|
59
59
|
local saveDataManager = ____exports.saveDataManager
|
|
60
60
|
function postNewRoom(self)
|
|
@@ -4,7 +4,7 @@ import { ButtonAction } from "isaac-typescript-definitions";
|
|
|
4
4
|
* used one of the other helper functions to disable inputs.
|
|
5
5
|
*
|
|
6
6
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
7
|
-
*
|
|
7
|
+
* that multiple mod features can work in tandem.
|
|
8
8
|
*/
|
|
9
9
|
export declare function enableAllInputs(key: string): void;
|
|
10
10
|
/**
|
|
@@ -14,7 +14,7 @@ export declare function enableAllInputs(key: string): void;
|
|
|
14
14
|
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
15
15
|
*
|
|
16
16
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
17
|
-
*
|
|
17
|
+
* that multiple mod features can work in tandem.
|
|
18
18
|
*/
|
|
19
19
|
export declare function disableAllInputs(key: string): void;
|
|
20
20
|
/**
|
|
@@ -24,7 +24,7 @@ export declare function disableAllInputs(key: string): void;
|
|
|
24
24
|
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
25
25
|
*
|
|
26
26
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
27
|
-
*
|
|
27
|
+
* that multiple mod features can work in tandem.
|
|
28
28
|
* @param blacklist A set of ButtonActions to disallow.
|
|
29
29
|
*/
|
|
30
30
|
export declare function enableAllInputsExceptFor(key: string, blacklist: Set<ButtonAction> | ReadonlySet<ButtonAction>): void;
|
|
@@ -35,7 +35,7 @@ export declare function enableAllInputsExceptFor(key: string, blacklist: Set<But
|
|
|
35
35
|
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
36
36
|
*
|
|
37
37
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
38
|
-
*
|
|
38
|
+
* that multiple mod features can work in tandem.
|
|
39
39
|
* @param whitelist A set of ButtonActions to allow.
|
|
40
40
|
*/
|
|
41
41
|
export declare function disableAllInputsExceptFor(key: string, whitelist: Set<ButtonAction>): void;
|
|
@@ -47,7 +47,7 @@ export declare function disableAllInputsExceptFor(key: string, whitelist: Set<Bu
|
|
|
47
47
|
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
48
48
|
*
|
|
49
49
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
50
|
-
*
|
|
50
|
+
* that multiple mod features can work in tandem.
|
|
51
51
|
*/
|
|
52
52
|
export declare function disableMovementInputs(key: string): void;
|
|
53
53
|
/**
|
|
@@ -57,6 +57,6 @@ export declare function disableMovementInputs(key: string): void;
|
|
|
57
57
|
* Use the [[`enableAllInputs`]] helper function to set things back to normal.
|
|
58
58
|
*
|
|
59
59
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
60
|
-
*
|
|
60
|
+
* that multiple mod features can work in tandem.
|
|
61
61
|
*/
|
|
62
62
|
export declare function disableShootingInputs(key: string): void;
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
* Use this function to set things back to normal after having used [[`disableAllSounds`]].
|
|
5
5
|
*
|
|
6
6
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
7
|
-
*
|
|
7
|
+
* that multiple mod features can work in tandem.
|
|
8
8
|
*/
|
|
9
9
|
export declare function enableAllSound(key: string): void;
|
|
10
10
|
/**
|
|
@@ -13,6 +13,6 @@ export declare function enableAllSound(key: string): void;
|
|
|
13
13
|
* Use the [[`enableAllSounds`]] helper function to set things back to normal.
|
|
14
14
|
*
|
|
15
15
|
* @param key The name of the mod feature that is requesting the enable/disable. This is needed so
|
|
16
|
-
*
|
|
16
|
+
* that multiple mod features can work in tandem.
|
|
17
17
|
*/
|
|
18
18
|
export declare function disableAllSound(key: string): void;
|
|
@@ -56,7 +56,7 @@ export declare function brokenHearts(params: string): void;
|
|
|
56
56
|
/**
|
|
57
57
|
* Gives the specified card. Accepts either the card sub-type or the partial name of the card.
|
|
58
58
|
*
|
|
59
|
-
*
|
|
59
|
+
* For example:
|
|
60
60
|
* - card 5 - Gives The Emperor.
|
|
61
61
|
* - card spa - Gives 2 of Spades.
|
|
62
62
|
*/
|
|
@@ -71,7 +71,7 @@ export declare function chaosCardTears(): void;
|
|
|
71
71
|
* Restart as the specified character. Accepts either the character sub-type or the partial name of
|
|
72
72
|
* the character.
|
|
73
73
|
*
|
|
74
|
-
*
|
|
74
|
+
* For example:
|
|
75
75
|
* - character 2 - Restarts as Cain.
|
|
76
76
|
* - character ta - Restarts as Tainted Azazel.
|
|
77
77
|
*/
|
|
@@ -224,9 +224,10 @@ export declare function oneHP(): void;
|
|
|
224
224
|
* Gives a pill with the specified pill effect. Accepts either the effect ID or the partial name of
|
|
225
225
|
* the effect.
|
|
226
226
|
*
|
|
227
|
-
*
|
|
228
|
-
*
|
|
229
|
-
* - pill
|
|
227
|
+
* For example:
|
|
228
|
+
*
|
|
229
|
+
* - `pill 5` - Gives a "Full Health" pill.
|
|
230
|
+
* - `pill suns` - Gives a "Feels like I'm walking on sunshine" pill.
|
|
230
231
|
*/
|
|
231
232
|
export declare function pill(params: string): void;
|
|
232
233
|
/** Spawns every pill on the ground, starting at the top-left-most tile. */
|
|
@@ -260,7 +261,7 @@ export declare function rottenHearts(params: string): void;
|
|
|
260
261
|
/**
|
|
261
262
|
* Alias for the "stage" command.
|
|
262
263
|
*
|
|
263
|
-
*
|
|
264
|
+
* For example:
|
|
264
265
|
* - s 3 - Warps to Caves 1.
|
|
265
266
|
* - s 1c - Warps to Downpour 1.
|
|
266
267
|
*/
|
|
@@ -281,7 +282,7 @@ export declare function setCharges(params: string): void;
|
|
|
281
282
|
/**
|
|
282
283
|
* Moves the first player to the specified position.
|
|
283
284
|
*
|
|
284
|
-
*
|
|
285
|
+
* For example:
|
|
285
286
|
* - setposition 100 50
|
|
286
287
|
*/
|
|
287
288
|
export declare function setPosition(params: string): void;
|
|
@@ -304,7 +305,7 @@ export declare function soulHearts(params: string): void;
|
|
|
304
305
|
/**
|
|
305
306
|
* Play the supplied sound effect.
|
|
306
307
|
*
|
|
307
|
-
*
|
|
308
|
+
* For example:
|
|
308
309
|
* - sound 1 - Plays the 1-Up sound effect.
|
|
309
310
|
*/
|
|
310
311
|
export declare function sound(params: string): void;
|
|
@@ -337,7 +338,7 @@ export declare function up(params: string): void;
|
|
|
337
338
|
* Warps to the specified room type. Accepts either the room type number or the partial name of the
|
|
338
339
|
* room type.
|
|
339
340
|
*
|
|
340
|
-
*
|
|
341
|
+
* For example:
|
|
341
342
|
* - warp 5 - Warps to the first Boss Room on the floor, if any.
|
|
342
343
|
* - warp tr - Warps to the first Treasure Room on the floor, if any.
|
|
343
344
|
*/
|
|
@@ -71,14 +71,16 @@ import { SaveData } from "../../types/private/SaveData";
|
|
|
71
71
|
* data.) For these cases, set a special key of "dontSave" alongside "run", "level", and so forth.
|
|
72
72
|
*
|
|
73
73
|
* @param key The name of the file or feature that is submitting data to be managed by the save data
|
|
74
|
-
*
|
|
74
|
+
* manager. The save data manager will throw an error if the key is already registered.
|
|
75
75
|
* @param v An object that corresponds to the `SaveData` interface. The object is conventionally
|
|
76
|
-
*
|
|
76
|
+
* called "v" for brevity. ("v" is short for "local variables").
|
|
77
77
|
* @param conditionalFunc An optional function to run upon saving this key to disk. For example,
|
|
78
|
-
*
|
|
79
|
-
* => false` to completely disable saving this feature
|
|
80
|
-
*
|
|
81
|
-
*
|
|
78
|
+
* this allows features to only save data to disk if the feature is enabled.
|
|
79
|
+
* Specify a value of `() => false` to completely disable saving this feature
|
|
80
|
+
* to disk. This is useful if you are using data that is not serializable, or
|
|
81
|
+
* you want to use the save data manager to automatically reset variables on
|
|
82
|
+
* run/level/room, but not clutter the the "save#.dat" file with unnecessary
|
|
83
|
+
* keys.
|
|
82
84
|
*/
|
|
83
85
|
export declare function saveDataManager(key: string, v: SaveData, conditionalFunc?: () => boolean): void;
|
|
84
86
|
/**
|
|
@@ -5,7 +5,7 @@ import { FamiliarVariant } from "isaac-typescript-definitions";
|
|
|
5
5
|
*
|
|
6
6
|
* @param familiarVariant The familiar variant to blacklist.
|
|
7
7
|
* @param familiarSubType The sub-type to blacklist. Optional. The default is to blacklist all
|
|
8
|
-
*
|
|
8
|
+
* sub-types of the given variant.
|
|
9
9
|
*/
|
|
10
10
|
export declare function setFamiliarNoSirenSteal(familiarVariant: FamiliarVariant | int, familiarSubType?: int): void;
|
|
11
11
|
/**
|
|
@@ -49,14 +49,14 @@ export declare function combineArrays<T>(...arrays: Array<T[] | readonly T[]>):
|
|
|
49
49
|
*
|
|
50
50
|
* @param oldArray The array to copy.
|
|
51
51
|
* @param numElements Optional. If specified, will only copy the first N elements. By default, the
|
|
52
|
-
*
|
|
52
|
+
* entire array will be copied.
|
|
53
53
|
*/
|
|
54
54
|
export declare function copyArray<T>(oldArray: T[] | readonly T[], numElements?: int): T[];
|
|
55
55
|
export declare function emptyArray<T>(array: T[]): void;
|
|
56
56
|
/**
|
|
57
57
|
* Helper function to get an array containing the indexes of an array.
|
|
58
58
|
*
|
|
59
|
-
* For example, an array of `["Apple", "Banana"]` would return an array of
|
|
59
|
+
* For example, an array of `["Apple", "Banana"]` would return an array of `[0, 1]`.
|
|
60
60
|
*/
|
|
61
61
|
export declare function getArrayIndexes<T>(array: T[] | readonly T[]): int[];
|
|
62
62
|
/**
|
|
@@ -70,7 +70,7 @@ export declare function getLastElement<T>(array: T[]): T | undefined;
|
|
|
70
70
|
*
|
|
71
71
|
* @param array The array to get an element from.
|
|
72
72
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
73
|
-
*
|
|
73
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
74
74
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
75
75
|
*/
|
|
76
76
|
export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
@@ -80,7 +80,7 @@ export declare function getRandomArrayElement<T>(array: T[] | readonly T[], seed
|
|
|
80
80
|
*
|
|
81
81
|
* @param array The array to get an element from.
|
|
82
82
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
83
|
-
*
|
|
83
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
84
84
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
85
85
|
*/
|
|
86
86
|
export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
@@ -89,13 +89,14 @@ export declare function getRandomArrayElementAndRemove<T>(array: T[], seedOrRNG?
|
|
|
89
89
|
*
|
|
90
90
|
* @param array The array to get the index from.
|
|
91
91
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
92
|
-
*
|
|
92
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
93
93
|
*/
|
|
94
94
|
export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOrRNG?: Seed | RNG): int;
|
|
95
95
|
/**
|
|
96
96
|
* Initializes an array with all elements containing the specified default value.
|
|
97
97
|
*
|
|
98
|
-
*
|
|
98
|
+
* For example:
|
|
99
|
+
*
|
|
99
100
|
* ```ts
|
|
100
101
|
* const playerTransformations = initArray(false, PlayerForm.NUM_PLAYER_FORMS - 1);
|
|
101
102
|
* ```
|
|
@@ -103,7 +104,7 @@ export declare function getRandomArrayIndex<T>(array: T[] | readonly T[], seedOr
|
|
|
103
104
|
export declare function initArray<T>(defaultValue: T, size: int): T[];
|
|
104
105
|
/**
|
|
105
106
|
* Since Lua uses tables for every non-primitive data structure, it is non-trivial to determine if a
|
|
106
|
-
* particular table is being used as an array. isArray returns true if:
|
|
107
|
+
* particular table is being used as an array. `isArray` returns true if:
|
|
107
108
|
*
|
|
108
109
|
* - the table contains all numerical indexes that are contiguous, starting at 1
|
|
109
110
|
* - the table has no keys (i.e. an "empty" table)
|
|
@@ -124,7 +125,7 @@ export declare function isArrayInArray<T>(arrayToMatch: T[] | readonly T[], pare
|
|
|
124
125
|
*
|
|
125
126
|
* @param originalArray The array to shuffle.
|
|
126
127
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
127
|
-
*
|
|
128
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
128
129
|
*/
|
|
129
130
|
export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedOrRNG?: Seed | RNG): T[];
|
|
130
131
|
/**
|
|
@@ -134,7 +135,7 @@ export declare function shuffleArray<T>(originalArray: T[] | readonly T[], seedO
|
|
|
134
135
|
*
|
|
135
136
|
* @param array The array to shuffle.
|
|
136
137
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
137
|
-
*
|
|
138
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
138
139
|
*/
|
|
139
140
|
export declare function shuffleArrayInPlace<T>(array: T[], seedOrRNG?: Seed | RNG): void;
|
|
140
141
|
export declare function sumArray(array: number[] | readonly number[]): number;
|
package/dist/functions/array.lua
CHANGED
|
@@ -11,8 +11,6 @@ local __TS__ArrayMap = ____lualib.__TS__ArrayMap
|
|
|
11
11
|
local __TS__ArraySome = ____lualib.__TS__ArraySome
|
|
12
12
|
local __TS__ArrayReduce = ____lualib.__TS__ArrayReduce
|
|
13
13
|
local ____exports = {}
|
|
14
|
-
local ____math = require("functions.math")
|
|
15
|
-
local erange = ____math.erange
|
|
16
14
|
local ____random = require("functions.random")
|
|
17
15
|
local getRandomInt = ____random.getRandomInt
|
|
18
16
|
local ____rng = require("functions.rng")
|
|
@@ -20,6 +18,7 @@ local getRandomSeed = ____rng.getRandomSeed
|
|
|
20
18
|
local isRNG = ____rng.isRNG
|
|
21
19
|
local newRNG = ____rng.newRNG
|
|
22
20
|
local ____utils = require("functions.utils")
|
|
21
|
+
local erange = ____utils.erange
|
|
23
22
|
local ____repeat = ____utils["repeat"]
|
|
24
23
|
function ____exports.getRandomArrayIndex(self, array, seedOrRNG)
|
|
25
24
|
if seedOrRNG == nil then
|
|
@@ -5,6 +5,6 @@
|
|
|
5
5
|
* This function is variadic, which means that you can supply as many as you want to benchmark.
|
|
6
6
|
*
|
|
7
7
|
* @returns An array containing the average time in milliseconds for each function. (This will also
|
|
8
|
-
*
|
|
8
|
+
* be printed to the log.)
|
|
9
9
|
*/
|
|
10
10
|
export declare function benchmark(numTrials: int, ...functions: Array<() => void>): int[];
|
|
@@ -2,7 +2,8 @@ import { Card, ItemConfigCardType } from "isaac-typescript-definitions";
|
|
|
2
2
|
/**
|
|
3
3
|
* Helper function to get a card description from a Card enum value.
|
|
4
4
|
*
|
|
5
|
-
*
|
|
5
|
+
* For example:
|
|
6
|
+
*
|
|
6
7
|
* ```ts
|
|
7
8
|
* const card = Card.FOOL;
|
|
8
9
|
* const cardDescription = getCardDescription(card); // cardDescription is "Where journey begins"
|
|
@@ -12,7 +13,8 @@ export declare function getCardDescription(card: Card | int): string;
|
|
|
12
13
|
/**
|
|
13
14
|
* Helper function to get a card name from a Card.
|
|
14
15
|
*
|
|
15
|
-
*
|
|
16
|
+
* For example:
|
|
17
|
+
*
|
|
16
18
|
* ```ts
|
|
17
19
|
* const card = Card.FOOL;
|
|
18
20
|
* const cardName = getCardName(card); // cardName is "0 - The Fool"
|
|
@@ -37,14 +39,14 @@ export declare function getCardsOfType(...cardTypes: ItemConfigCardType[]): Set<
|
|
|
37
39
|
* runes/objects)
|
|
38
40
|
*
|
|
39
41
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
40
|
-
*
|
|
42
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
41
43
|
* @param exceptions Optional. An array of cards to not select.
|
|
42
44
|
*/
|
|
43
45
|
export declare function getRandomCard(seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
|
44
46
|
/**
|
|
45
47
|
* @param cardType The card type that represents the pool of cards to select from.
|
|
46
48
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
47
|
-
*
|
|
49
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
48
50
|
* @param exceptions Optional. An array of cards to not select.
|
|
49
51
|
*/
|
|
50
52
|
export declare function getRandomCardOfType(cardType: ItemConfigCardType, seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
|
@@ -53,7 +55,7 @@ export declare function getRandomCardOfType(cardType: ItemConfigCardType, seedOr
|
|
|
53
55
|
* Isaac, etc.). This will never return a Rune Shard.
|
|
54
56
|
*
|
|
55
57
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
56
|
-
*
|
|
58
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
57
59
|
* @param exceptions Optional. An array of runes to not select.
|
|
58
60
|
*/
|
|
59
61
|
export declare function getRandomRune(seedOrRNG?: Seed | RNG, exceptions?: Card[]): Card;
|
package/dist/functions/cards.lua
CHANGED
|
@@ -23,13 +23,13 @@ local CARD_TYPES = ____cardTypes.CARD_TYPES
|
|
|
23
23
|
local DEFAULT_CARD_TYPE = ____cardTypes.DEFAULT_CARD_TYPE
|
|
24
24
|
local ____enums = require("functions.enums")
|
|
25
25
|
local getEnumValues = ____enums.getEnumValues
|
|
26
|
-
local ____math = require("functions.math")
|
|
27
|
-
local irange = ____math.irange
|
|
28
26
|
local ____rng = require("functions.rng")
|
|
29
27
|
local getRandomSeed = ____rng.getRandomSeed
|
|
30
28
|
local ____set = require("functions.set")
|
|
31
29
|
local addSetsToSet = ____set.addSetsToSet
|
|
32
30
|
local getRandomSetElement = ____set.getRandomSetElement
|
|
31
|
+
local ____utils = require("functions.utils")
|
|
32
|
+
local irange = ____utils.irange
|
|
33
33
|
function initCardObjects(self)
|
|
34
34
|
for ____, cardType in ipairs(getEnumValues(nil, ItemConfigCardType)) do
|
|
35
35
|
CARD_TYPE_TO_CARDS_MAP:set(
|
|
@@ -10,7 +10,8 @@ import { ActiveSlot } from "isaac-typescript-definitions";
|
|
|
10
10
|
*
|
|
11
11
|
* @param player The player to grant the charges to.
|
|
12
12
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
13
|
-
*
|
|
13
|
+
* 1x1 room for the purposes of calculating how much charge to
|
|
14
|
+
* grant. Default is false.
|
|
14
15
|
*/
|
|
15
16
|
export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDoubleCharge?: boolean): void;
|
|
16
17
|
/**
|
|
@@ -25,7 +26,8 @@ export declare function addRoomClearCharge(player: EntityPlayer, ignoreBigRoomDo
|
|
|
25
26
|
* @param player The player to grant the charges to.
|
|
26
27
|
* @param activeSlot The active item slot to grant the charges to.
|
|
27
28
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
28
|
-
*
|
|
29
|
+
* 1x1 room for the purposes of calculating how much charge to
|
|
30
|
+
* grant. Default is false.
|
|
29
31
|
*/
|
|
30
32
|
export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlot: ActiveSlot, ignoreBigRoomDoubleCharge?: boolean): void;
|
|
31
33
|
/**
|
|
@@ -38,7 +40,8 @@ export declare function addRoomClearChargeToSlot(player: EntityPlayer, activeSlo
|
|
|
38
40
|
* - AAA Battery
|
|
39
41
|
*
|
|
40
42
|
* @param ignoreBigRoomDoubleCharge Optional. If set to true, it will treat the current room as a
|
|
41
|
-
*
|
|
43
|
+
* 1x1 room for the purposes of calculating how much charge to
|
|
44
|
+
* grant. Default is false.
|
|
42
45
|
*/
|
|
43
46
|
export declare function addRoomClearCharges(ignoreBigRoomDoubleCharge?: boolean): void;
|
|
44
47
|
/**
|
|
@@ -11,12 +11,11 @@ local ____collectibles = require("functions.collectibles")
|
|
|
11
11
|
local collectibleHasCacheFlag = ____collectibles.collectibleHasCacheFlag
|
|
12
12
|
local ____enums = require("functions.enums")
|
|
13
13
|
local getEnumValues = ____enums.getEnumValues
|
|
14
|
-
local ____math = require("functions.math")
|
|
15
|
-
local irange = ____math.irange
|
|
16
14
|
local ____set = require("functions.set")
|
|
17
15
|
local copySet = ____set.copySet
|
|
18
16
|
local getSortedSetValues = ____set.getSortedSetValues
|
|
19
17
|
local ____utils = require("functions.utils")
|
|
18
|
+
local irange = ____utils.irange
|
|
20
19
|
local ____repeat = ____utils["repeat"]
|
|
21
20
|
local CACHE_FLAG_TO_COLLECTIBLES_MAP = __TS__New(Map)
|
|
22
21
|
local function initCacheFlagMap(self)
|
|
@@ -6,10 +6,10 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
6
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
7
7
|
local ____constantsMax = require("constantsMax")
|
|
8
8
|
local MAX_COLLECTIBLE_TYPE = ____constantsMax.MAX_COLLECTIBLE_TYPE
|
|
9
|
-
local ____math = require("functions.math")
|
|
10
|
-
local irange = ____math.irange
|
|
11
9
|
local ____set = require("functions.set")
|
|
12
10
|
local copySet = ____set.copySet
|
|
11
|
+
local ____utils = require("functions.utils")
|
|
12
|
+
local irange = ____utils.irange
|
|
13
13
|
local COLLECTIBLE_SET = __TS__New(Set)
|
|
14
14
|
local function initCollectibleSet(self)
|
|
15
15
|
for ____, collectibleType in ipairs(irange(nil, 1, MAX_COLLECTIBLE_TYPE)) do
|
|
@@ -14,12 +14,12 @@ local ____enums = require("functions.enums")
|
|
|
14
14
|
local getEnumValues = ____enums.getEnumValues
|
|
15
15
|
local ____flag = require("functions.flag")
|
|
16
16
|
local getFlagName = ____flag.getFlagName
|
|
17
|
-
local ____math = require("functions.math")
|
|
18
|
-
local irange = ____math.irange
|
|
19
17
|
local ____player = require("functions.player")
|
|
20
18
|
local getPlayerCollectibleCount = ____player.getPlayerCollectibleCount
|
|
21
19
|
local ____set = require("functions.set")
|
|
22
20
|
local copySet = ____set.copySet
|
|
21
|
+
local ____utils = require("functions.utils")
|
|
22
|
+
local irange = ____utils.irange
|
|
23
23
|
function ____exports.collectibleHasTag(self, collectibleType, tag)
|
|
24
24
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
25
25
|
if itemConfigItem == nil then
|
|
@@ -76,7 +76,8 @@ export declare function getCollectibleMaxCharges(collectibleType: CollectibleTyp
|
|
|
76
76
|
* Helper function to get the name of a collectible. Returns "Unknown" if the provided collectible
|
|
77
77
|
* type is not valid.
|
|
78
78
|
*
|
|
79
|
-
*
|
|
79
|
+
* For example:
|
|
80
|
+
*
|
|
80
81
|
* ```ts
|
|
81
82
|
* const collectibleType = CollectibleType.SAD_ONION;
|
|
82
83
|
* const collectibleName = getCollectibleName(collectibleType); // collectibleName is "Sad Onion"
|
|
@@ -93,7 +94,8 @@ export declare function getCollectibleQuality(collectibleType: CollectibleType |
|
|
|
93
94
|
* Helper function to get the tags of a collectible (which is the composition of zero or more
|
|
94
95
|
* `ItemConfigTag`). Returns 0 if the provided collectible type is not valid.
|
|
95
96
|
*
|
|
96
|
-
*
|
|
97
|
+
* For example:
|
|
98
|
+
*
|
|
97
99
|
* ```ts
|
|
98
100
|
* const collectibleType = CollectibleType.SAD_ONION;
|
|
99
101
|
* const itemConfigTags = getCollectibleTags(collectibleType); // itemConfigTags is "18350080"
|
|
@@ -155,13 +157,14 @@ export declare function setCollectibleEmpty(collectible: EntityPickup): void;
|
|
|
155
157
|
*
|
|
156
158
|
* @param collectible The collectible whose sprite you want to modify.
|
|
157
159
|
* @param pngPath Equal to either the spritesheet path to load (e.g.
|
|
158
|
-
*
|
|
159
|
-
* will be removed, making it appear like the collectible has
|
|
160
|
+
* "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If
|
|
161
|
+
* undefined, the sprite will be removed, making it appear like the collectible has
|
|
162
|
+
* already been taken by the player.
|
|
160
163
|
*/
|
|
161
164
|
export declare function setCollectibleSprite(collectible: EntityPickup, pngPath: string | undefined): void;
|
|
162
165
|
/**
|
|
163
|
-
* Helper function to change the collectible on a pedestal. Simply updating the SubType property
|
|
164
|
-
* not sufficient because the sprite will not change.
|
|
166
|
+
* Helper function to change the collectible on a pedestal. Simply updating the `SubType` property
|
|
167
|
+
* is not sufficient because the sprite will not change.
|
|
165
168
|
*/
|
|
166
169
|
export declare function setCollectibleSubType(collectible: EntityPickup, newCollectibleType: CollectibleType | int): void;
|
|
167
170
|
/**
|
|
@@ -14,7 +14,7 @@ export declare function colorEquals(color1: Color, color2: Color): boolean;
|
|
|
14
14
|
* Helper function to copy a `Color` object.
|
|
15
15
|
*
|
|
16
16
|
* @param color The Color object to copy. In the case of deserialization, this will actually be a
|
|
17
|
-
*
|
|
17
|
+
* Lua table instead of an instantiated Color class.
|
|
18
18
|
* @param serializationType Default is `SerializationType.NONE`.
|
|
19
19
|
*/
|
|
20
20
|
export declare function copyColor<C extends Color | SerializedColor, S extends SerializationType>(color: C, serializationType: S): CopyColorReturn[S];
|
|
@@ -22,7 +22,8 @@ import { SerializationType } from "../enums/SerializationType";
|
|
|
22
22
|
*
|
|
23
23
|
* @param value The primitive or object to copy.
|
|
24
24
|
* @param serializationType Has 3 possible values. Can leave objects as-is, or can serialize objects
|
|
25
|
-
*
|
|
25
|
+
* to Lua tables, or can deserialize Lua tables to objects. Default is
|
|
26
|
+
* `SerializationType.NONE`.
|
|
26
27
|
* @param traversalDescription Used to track the current key that we are operating on.
|
|
27
28
|
*/
|
|
28
29
|
export declare function deepCopy(value: unknown, serializationType?: SerializationType, traversalDescription?: string): unknown;
|
|
@@ -15,7 +15,8 @@ export declare function countEntities(entityType?: EntityType | int, variant?: n
|
|
|
15
15
|
* Given an array of entities, this helper function returns the closest one to a provided reference
|
|
16
16
|
* entity.
|
|
17
17
|
*
|
|
18
|
-
*
|
|
18
|
+
* For example:
|
|
19
|
+
*
|
|
19
20
|
* ```ts
|
|
20
21
|
* const player = Isaac.GetPlayer();
|
|
21
22
|
* const gapers = getEntities(EntityType.GAPER);
|
|
@@ -31,7 +32,8 @@ export declare function getClosestEntityTo<T extends AnyEntity>(referenceEntity:
|
|
|
31
32
|
* expensive but also more robust. (If a matching entity type is provided, then `Isaac.FindByType`
|
|
32
33
|
* will be used instead.)
|
|
33
34
|
*
|
|
34
|
-
*
|
|
35
|
+
* For example:
|
|
36
|
+
*
|
|
35
37
|
* ```ts
|
|
36
38
|
* // Make all of the entities in the room invisible
|
|
37
39
|
* for (const entity of getEntities()) {
|
|
@@ -41,11 +43,12 @@ export declare function getClosestEntityTo<T extends AnyEntity>(referenceEntity:
|
|
|
41
43
|
*
|
|
42
44
|
* @param entityType Optional. If specified, will only return NPCs that match this entity type.
|
|
43
45
|
* @param variant Optional. If specified, will only return NPCs that match this variant. Default is
|
|
44
|
-
*
|
|
46
|
+
* -1. -1 matches every variant.
|
|
45
47
|
* @param subType Optional. If specified, will only return NPCs that match this sub-type. Default is
|
|
46
|
-
*
|
|
48
|
+
* -1. -1 matches every sub-type.
|
|
47
49
|
* @param ignoreFriendly Optional. If set to true, it will exclude friendly NPCs from being
|
|
48
|
-
*
|
|
50
|
+
* returned. Default is false. Will only be taken into account if
|
|
51
|
+
* `matchingEntityType` is specified.
|
|
49
52
|
*/
|
|
50
53
|
export declare function getEntities(entityType?: EntityType | int, variant?: number, subType?: number, ignoreFriendly?: boolean): Entity[];
|
|
51
54
|
/** Helper function to return a string containing the entity's type, variant, and sub-type. */
|
|
@@ -110,7 +113,7 @@ export declare function removeEntities(entities: Entity[], cap?: int): boolean;
|
|
|
110
113
|
*
|
|
111
114
|
* @param entity The entity to reroll.
|
|
112
115
|
* @returns If the game failed to reroll the enemy, returns undefined. Otherwise, returns the
|
|
113
|
-
*
|
|
116
|
+
* rerolled entity.
|
|
114
117
|
*/
|
|
115
118
|
export declare function rerollEnemy(entity: Entity): Entity | undefined;
|
|
116
119
|
export declare function setEntityRandomColor(entity: Entity): void;
|
|
@@ -164,7 +164,7 @@ function ____exports.rerollEnemy(self, entity)
|
|
|
164
164
|
local newEntities = ____exports.getEntities(nil)
|
|
165
165
|
local filteredNewEntities = ____exports.getFilteredNewEntities(nil, oldEntities, newEntities)
|
|
166
166
|
if #filteredNewEntities == 0 then
|
|
167
|
-
error("Failed to find the new entity generated by the \"RerollEnemy\" method.")
|
|
167
|
+
error("Failed to find the new entity generated by the \"Game.RerollEnemy\" method.")
|
|
168
168
|
end
|
|
169
169
|
return filteredNewEntities[1]
|
|
170
170
|
end
|