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
package/dist/functions/set.d.ts
CHANGED
|
@@ -26,7 +26,7 @@ export declare function deleteSetsFromSet<T>(mainSet: Set<T>, ...setsToRemove: A
|
|
|
26
26
|
*
|
|
27
27
|
* @param set The set to get an element from.
|
|
28
28
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
29
|
-
*
|
|
29
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
30
30
|
* @param exceptions Optional. An array of elements to skip over if selected.
|
|
31
31
|
*/
|
|
32
32
|
export declare function getRandomSetElement<T>(set: Set<T> | ReadonlySet<T>, seedOrRNG?: Seed | RNG, exceptions?: T[] | readonly T[]): T;
|
|
@@ -8,11 +8,11 @@ import { CollectibleType } from "isaac-typescript-definitions";
|
|
|
8
8
|
* @param collectibleType The collectible type to spawn.
|
|
9
9
|
* @param position The position to spawn the collectible at.
|
|
10
10
|
* @param seedOrRNG Optional. The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
11
|
-
*
|
|
11
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
12
12
|
* @param options Optional. Set to true to make the collectible a "There's Options" style
|
|
13
|
-
*
|
|
13
|
+
* collectible. Default is false.
|
|
14
14
|
* @param forceFreeItem Optional. Set to true to disable the logic that gives the item a price for
|
|
15
|
-
*
|
|
15
|
+
* Tainted Keeper. Default is false.
|
|
16
16
|
*/
|
|
17
17
|
export declare function spawnCollectible(collectibleType: CollectibleType | int, position: Vector, seedOrRNG?: Seed | RNG, options?: boolean, forceFreeItem?: boolean): EntityPickup;
|
|
18
18
|
/**
|
|
@@ -25,6 +25,6 @@ export declare function spawnCollectible(collectibleType: CollectibleType | int,
|
|
|
25
25
|
*
|
|
26
26
|
* @param position The position to spawn the empty collectible at.
|
|
27
27
|
* @param seedOrRNG The `Seed` or `RNG` object to use. If an `RNG` object is provided, the
|
|
28
|
-
*
|
|
28
|
+
* `RNG.Next` method will be called. Default is `getRandomSeed()`.
|
|
29
29
|
*/
|
|
30
30
|
export declare function spawnEmptyCollectible(position: Vector, seedOrRNG?: Seed | RNG): EntityPickup;
|
|
@@ -4,8 +4,8 @@ local EMPTY_PNG_PATH = ____constants.EMPTY_PNG_PATH
|
|
|
4
4
|
local VectorZero = ____constants.VectorZero
|
|
5
5
|
local ____kColor = require("functions.kColor")
|
|
6
6
|
local kColorEquals = ____kColor.kColorEquals
|
|
7
|
-
local
|
|
8
|
-
local erange =
|
|
7
|
+
local ____utils = require("functions.utils")
|
|
8
|
+
local erange = ____utils.erange
|
|
9
9
|
function ____exports.texelEquals(self, sprite1, sprite2, position, layerID)
|
|
10
10
|
local kColor1 = sprite1:GetTexel(position, VectorZero, 1, layerID)
|
|
11
11
|
local kColor2 = sprite2:GetTexel(position, VectorZero, 1, layerID)
|
|
@@ -17,7 +17,8 @@ export declare function getPlayerTransformations(player: EntityPlayer): Set<Play
|
|
|
17
17
|
/**
|
|
18
18
|
* Helper function to get a transformation name from a PlayerForm enum.
|
|
19
19
|
*
|
|
20
|
-
*
|
|
20
|
+
* For example:
|
|
21
|
+
*
|
|
21
22
|
* ```ts
|
|
22
23
|
* const transformationName = getTransformationName(PlayerForm.LORD_OF_THE_FLIES);
|
|
23
24
|
* // transformationName is "Beelzebub"
|
|
@@ -11,12 +11,12 @@ local ____constantsMax = require("constantsMax")
|
|
|
11
11
|
local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_TYPE
|
|
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 ____trinkets = require("functions.trinkets")
|
|
19
17
|
local trinketHasCacheFlag = ____trinkets.trinketHasCacheFlag
|
|
18
|
+
local ____utils = require("functions.utils")
|
|
19
|
+
local irange = ____utils.irange
|
|
20
20
|
function initCacheFlagMap(self)
|
|
21
21
|
for ____, cacheFlag in ipairs(getEnumValues(nil, CacheFlag)) do
|
|
22
22
|
local trinketsSet = __TS__New(Set)
|
|
@@ -14,7 +14,7 @@ export declare function giveTrinketsBack(player: EntityPlayer, trinketSituation:
|
|
|
14
14
|
* @param player The player to smelt the trinkets to.
|
|
15
15
|
* @param trinketType The trinket type to smelt.
|
|
16
16
|
* @param numTrinkets Optional. If specified, will smelt the given number of trinkets. Use this to
|
|
17
|
-
*
|
|
17
|
+
* avoid calling this function multiple times. Default is 1.
|
|
18
18
|
*/
|
|
19
19
|
export declare function smeltTrinket(player: EntityPlayer, trinketType: TrinketType | int, numTrinkets?: number): void;
|
|
20
20
|
/**
|
|
@@ -6,10 +6,10 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
6
6
|
local itemConfig = ____cachedClasses.itemConfig
|
|
7
7
|
local ____constantsMax = require("constantsMax")
|
|
8
8
|
local MAX_TRINKET_TYPE = ____constantsMax.MAX_TRINKET_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 TRINKET_SET = __TS__New(Set)
|
|
14
14
|
local function initTrinketSet(self)
|
|
15
15
|
for ____, trinketType in ipairs(irange(nil, 1, MAX_TRINKET_TYPE)) do
|
|
@@ -9,7 +9,8 @@ export declare function getGoldenTrinketType(trinketType: TrinketType | int): Tr
|
|
|
9
9
|
/**
|
|
10
10
|
* Returns the slot number corresponding to where a trinket can be safely inserted.
|
|
11
11
|
*
|
|
12
|
-
*
|
|
12
|
+
* For example:
|
|
13
|
+
*
|
|
13
14
|
* ```ts
|
|
14
15
|
* const player = Isaac.GetPlayer();
|
|
15
16
|
* const trinketSlot = getOpenTrinketSlotNum(player);
|
|
@@ -29,7 +30,8 @@ export declare function getTrinketDescription(trinketType: TrinketType | int): s
|
|
|
29
30
|
* Helper function to get the name of a trinket. Returns "Unknown" if the provided trinket type is
|
|
30
31
|
* not valid.
|
|
31
32
|
*
|
|
32
|
-
*
|
|
33
|
+
* For example:
|
|
34
|
+
*
|
|
33
35
|
* ```ts
|
|
34
36
|
* const trinketType = TrinketType.SWALLOWED_PENNY;
|
|
35
37
|
* const trinketName = getTrinketName(trinketType); // trinketName is "Swallowed Penny"
|
|
@@ -53,8 +55,9 @@ export declare function isGoldenTrinket(trinketType: TrinketType | int): boolean
|
|
|
53
55
|
*
|
|
54
56
|
* @param trinket The trinket whose sprite you want to modify.
|
|
55
57
|
* @param pngPath Equal to either the spritesheet path to load (e.g.
|
|
56
|
-
*
|
|
57
|
-
* will be removed, making it appear like the collectible has
|
|
58
|
+
* "gfx/items/collectibles/collectibles_001_thesadonion.png") or undefined. If
|
|
59
|
+
* undefined, the sprite will be removed, making it appear like the collectible has
|
|
60
|
+
* already been taken by the player.
|
|
58
61
|
*/
|
|
59
62
|
export declare function setTrinketSprite(trinket: EntityPickup, pngPath: string | undefined): void;
|
|
60
63
|
export declare function trinketHasCacheFlag(trinketType: TrinketType | int, cacheFlag: CacheFlag): boolean;
|
package/dist/functions/ui.d.ts
CHANGED
|
@@ -6,8 +6,8 @@
|
|
|
6
6
|
* offset setting so that mods can render UI elements to the screen in the correct position.
|
|
7
7
|
*
|
|
8
8
|
* @returns If the user does not have Mod Config Menu enabled, or does not have this option set,
|
|
9
|
-
*
|
|
10
|
-
* a HUD offset that should be added to the position of a UI element.
|
|
9
|
+
* then this function will return `Vector.Zero.` Otherwise, it will return a Vector that
|
|
10
|
+
* represents a HUD offset that should be added to the position of a UI element.
|
|
11
11
|
*/
|
|
12
12
|
export declare function getHUDOffsetVector(): Vector;
|
|
13
13
|
/**
|
|
@@ -4,7 +4,8 @@
|
|
|
4
4
|
*
|
|
5
5
|
* Very useful to be future-safe against people adding values to a type or an enum.
|
|
6
6
|
*
|
|
7
|
-
*
|
|
7
|
+
* For example:
|
|
8
|
+
*
|
|
8
9
|
* ```ts
|
|
9
10
|
* enum Situation {
|
|
10
11
|
* ONE,
|
|
@@ -35,6 +36,15 @@
|
|
|
35
36
|
* ```
|
|
36
37
|
*/
|
|
37
38
|
export declare const ensureAllCases: (obj: never) => never;
|
|
39
|
+
/**
|
|
40
|
+
* Helper function to return an array with the elements from start to end. It is inclusive at the
|
|
41
|
+
* start and exclusive at the end. (The "e" stands for exclusive.)
|
|
42
|
+
*
|
|
43
|
+
* For example, `erange(1, 3)` will return `[1, 2]`.
|
|
44
|
+
*
|
|
45
|
+
* If only one argument is specified, then it will assume that the start is 0.
|
|
46
|
+
*/
|
|
47
|
+
export declare function erange(start: int, end?: int): int[];
|
|
38
48
|
/**
|
|
39
49
|
* Helper function to log what is happening in functions that recursively move through nested data
|
|
40
50
|
* structures.
|
|
@@ -46,6 +56,15 @@ export declare function getTraversalDescription(key: unknown, traversalDescripti
|
|
|
46
56
|
* @param hexString A hex string like "#ffffff" or "ffffff". (The "#" character is optional.)
|
|
47
57
|
*/
|
|
48
58
|
export declare function hexToKColor(hexString: string, alpha: float): KColor;
|
|
59
|
+
/**
|
|
60
|
+
* Helper function to return an array with the elements from start to end, inclusive. (The "i"
|
|
61
|
+
* stands for inclusive.)
|
|
62
|
+
*
|
|
63
|
+
* For example, `irange(1, 3)` will return `[1, 2, 3]`.
|
|
64
|
+
*
|
|
65
|
+
* If only one argument is specified, then it will assume that the start is 0.
|
|
66
|
+
*/
|
|
67
|
+
export declare function irange(start: int, end?: int): int[];
|
|
49
68
|
/**
|
|
50
69
|
* Since this is a UI element, we do not want to draw it in water reflections. `renderOffset` will
|
|
51
70
|
* be a non-zero value in reflections.
|
|
@@ -62,7 +81,8 @@ export declare function printEnabled(enabled: boolean, description: string): voi
|
|
|
62
81
|
/**
|
|
63
82
|
* Helper function to repeat code N times. This is faster to type and cleaner than using a for loop.
|
|
64
83
|
*
|
|
65
|
-
*
|
|
84
|
+
* For example:
|
|
85
|
+
*
|
|
66
86
|
* ```ts
|
|
67
87
|
* const player = Isaac.GetPlayer();
|
|
68
88
|
* repeat(10, () => {
|
package/dist/functions/utils.lua
CHANGED
|
@@ -8,6 +8,21 @@ local ____cachedClasses = require("cachedClasses")
|
|
|
8
8
|
local game = ____cachedClasses.game
|
|
9
9
|
local HEX_STRING_LENGTH = 6
|
|
10
10
|
____exports.ensureAllCases = function(____, obj) return obj end
|
|
11
|
+
function ____exports.erange(self, start, ____end)
|
|
12
|
+
if ____end == nil then
|
|
13
|
+
____end = start
|
|
14
|
+
start = 0
|
|
15
|
+
end
|
|
16
|
+
local array = {}
|
|
17
|
+
do
|
|
18
|
+
local i = start
|
|
19
|
+
while i < ____end do
|
|
20
|
+
array[#array + 1] = i
|
|
21
|
+
i = i + 1
|
|
22
|
+
end
|
|
23
|
+
end
|
|
24
|
+
return array
|
|
25
|
+
end
|
|
11
26
|
function ____exports.getTraversalDescription(self, key, traversalDescription)
|
|
12
27
|
if traversalDescription ~= "" then
|
|
13
28
|
traversalDescription = traversalDescription .. " --> "
|
|
@@ -38,6 +53,21 @@ function ____exports.hexToKColor(self, hexString, alpha)
|
|
|
38
53
|
local base = 255
|
|
39
54
|
return KColor(R / base, G / base, B / base, alpha)
|
|
40
55
|
end
|
|
56
|
+
function ____exports.irange(self, start, ____end)
|
|
57
|
+
if ____end == nil then
|
|
58
|
+
____end = start
|
|
59
|
+
start = 0
|
|
60
|
+
end
|
|
61
|
+
local array = {}
|
|
62
|
+
do
|
|
63
|
+
local i = start
|
|
64
|
+
while i <= ____end do
|
|
65
|
+
array[#array + 1] = i
|
|
66
|
+
i = i + 1
|
|
67
|
+
end
|
|
68
|
+
end
|
|
69
|
+
return array
|
|
70
|
+
end
|
|
41
71
|
function ____exports.isReflectionRender(self)
|
|
42
72
|
local room = game:GetRoom()
|
|
43
73
|
local renderMode = room:GetRenderMode()
|
|
@@ -13,7 +13,7 @@ interface CopyVectorReturn {
|
|
|
13
13
|
* Helper function to copy a `Vector` object.
|
|
14
14
|
*
|
|
15
15
|
* @param vector The vector to copy. In the case of deserialization, this will actually be a Lua
|
|
16
|
-
*
|
|
16
|
+
* table instead of an instantiated Vector class.
|
|
17
17
|
* @param serializationType Default is `SerializationType.NONE`.
|
|
18
18
|
*/
|
|
19
19
|
export declare function copyVector<V extends Vector | SerializedVector, S extends SerializationType>(vector: V, serializationType: S): CopyVectorReturn[S];
|
|
@@ -3,7 +3,8 @@
|
|
|
3
3
|
* PlayerIndex is a specific type of string; see the documentation for the [[`getPlayerIndex`]]
|
|
4
4
|
* function. Mods can signify that data structures handle `EntityPlayer` by using this type.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* For example:
|
|
7
|
+
*
|
|
7
8
|
* ```ts
|
|
8
9
|
* const playersNameMap = new Map<PlayerIndex, string>();
|
|
9
10
|
* ```
|
package/dist/upgradeMod.d.ts
CHANGED
|
@@ -3,7 +3,8 @@ import { ModUpgraded } from "./classes/ModUpgraded";
|
|
|
3
3
|
/**
|
|
4
4
|
* Use this function to enable the custom features and callbacks provided by `isaacscript-common`.
|
|
5
5
|
*
|
|
6
|
-
*
|
|
6
|
+
* For example:
|
|
7
|
+
*
|
|
7
8
|
* ```ts
|
|
8
9
|
* const modVanilla = RegisterMod("My Mod", 1);
|
|
9
10
|
* const mod = upgradeMod(modVanilla);
|
|
@@ -15,9 +16,6 @@ import { ModUpgraded } from "./classes/ModUpgraded";
|
|
|
15
16
|
* mod.AddCallbackCustom(ModCallbackCustom.POST_ITEM_PICKUP, postItemPickup);
|
|
16
17
|
* ```
|
|
17
18
|
*
|
|
18
|
-
* For a list of all custom callbacks, check out the
|
|
19
|
-
* [Function Signatures](https://isaacscript.github.io/docs/function-signatures#custom-callbacks).
|
|
20
|
-
*
|
|
21
19
|
* @param modVanilla The mod object returned by the `RegisterMod` function.
|
|
22
20
|
* @returns The upgraded mod object.
|
|
23
21
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "2.0.
|
|
3
|
+
"version": "2.0.13",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -25,12 +25,13 @@
|
|
|
25
25
|
"dist/**/*.d.ts"
|
|
26
26
|
],
|
|
27
27
|
"dependencies": {
|
|
28
|
-
"isaac-typescript-definitions": "^2.0.
|
|
28
|
+
"isaac-typescript-definitions": "^2.0.15"
|
|
29
29
|
},
|
|
30
30
|
"devDependencies": {
|
|
31
|
-
"isaacscript-lint": "^1.0.
|
|
31
|
+
"isaacscript-lint": "^1.0.150",
|
|
32
32
|
"isaacscript-spell": "^1.0.3",
|
|
33
33
|
"isaacscript-tsconfig": "^1.1.16",
|
|
34
|
+
"npm-check-updates": "^13.0.1",
|
|
34
35
|
"ts-node": "^10.7.0",
|
|
35
36
|
"typedoc": "^0.22.15",
|
|
36
37
|
"typescript": "^4.6.4",
|