isaacscript-common 1.0.331 → 1.0.335
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/collectibleSet.d.ts +1 -3
- package/dist/collectibleSet.lua +3 -6
- package/dist/constants.d.ts +2 -0
- package/dist/constants.lua +2 -0
- package/dist/functions/collectibleSet.d.ts +3 -0
- package/dist/functions/collectibleSet.lua +9 -0
- package/dist/functions/collectibles.d.ts +2 -0
- package/dist/functions/collectibles.lua +26 -3
- package/dist/functions/player.d.ts +3 -5
- package/dist/functions/player.lua +3 -4
- package/dist/functions/transformations.lua +3 -1
- package/dist/functions/util.d.ts +5 -0
- package/dist/functions/util.lua +9 -0
- package/dist/index.d.ts +1 -1
- package/dist/index.lua +4 -0
- package/package.json +1 -2
package/dist/collectibleSet.d.ts
CHANGED
|
@@ -1,3 +1 @@
|
|
|
1
|
-
|
|
2
|
-
/** Returns a set containing every valid collectible type in the game, including modded items. */
|
|
3
|
-
export declare function getCollectibleSet(): Set<CollectibleType | int>;
|
|
1
|
+
export declare const COLLECTIBLE_SET: Set<number>;
|
package/dist/collectibleSet.lua
CHANGED
|
@@ -3,7 +3,7 @@ require("lualib_bundle");
|
|
|
3
3
|
local ____exports = {}
|
|
4
4
|
local ____collectibles = require("functions.collectibles")
|
|
5
5
|
local getMaxCollectibleID = ____collectibles.getMaxCollectibleID
|
|
6
|
-
local
|
|
6
|
+
local initSet
|
|
7
7
|
function initSet(self)
|
|
8
8
|
local itemConfig = Isaac.GetItemConfig()
|
|
9
9
|
do
|
|
@@ -11,15 +11,12 @@ function initSet(self)
|
|
|
11
11
|
while collectibleType <= getMaxCollectibleID(nil) do
|
|
12
12
|
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
13
13
|
if itemConfigItem ~= nil then
|
|
14
|
-
COLLECTIBLE_SET:add(collectibleType)
|
|
14
|
+
____exports.COLLECTIBLE_SET:add(collectibleType)
|
|
15
15
|
end
|
|
16
16
|
collectibleType = collectibleType + 1
|
|
17
17
|
end
|
|
18
18
|
end
|
|
19
19
|
end
|
|
20
|
-
COLLECTIBLE_SET = __TS__New(Set)
|
|
20
|
+
____exports.COLLECTIBLE_SET = __TS__New(Set)
|
|
21
21
|
initSet(nil)
|
|
22
|
-
function ____exports.getCollectibleSet(self)
|
|
23
|
-
return __TS__New(Set, COLLECTIBLE_SET)
|
|
24
|
-
end
|
|
25
22
|
return ____exports
|
package/dist/constants.d.ts
CHANGED
|
@@ -11,6 +11,8 @@ export declare const FIRST_GLITCHED_COLLECTIBLE_TYPE: number;
|
|
|
11
11
|
export declare const GENESIS_ROOM_VARIANT = 1000;
|
|
12
12
|
export declare const GOLDEN_TRINKET_SHIFT: number;
|
|
13
13
|
export declare const GRID_INDEX_CENTER_OF_1X1_ROOM = 67;
|
|
14
|
+
export declare const GAME_FRAMES_PER_SECOND = 30;
|
|
15
|
+
export declare const ISAAC_FRAMES_PER_SECOND = 60;
|
|
14
16
|
/** In a 2x2 room, there can be 8 doors. */
|
|
15
17
|
export declare const MAX_NUM_DOORS = 8;
|
|
16
18
|
/** The game can only handle up to four different players. */
|
package/dist/constants.lua
CHANGED
|
@@ -8,6 +8,8 @@ ____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = (1 << 32) - 1
|
|
|
8
8
|
____exports.GENESIS_ROOM_VARIANT = 1000
|
|
9
9
|
____exports.GOLDEN_TRINKET_SHIFT = 1 << 15
|
|
10
10
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = 67
|
|
11
|
+
____exports.GAME_FRAMES_PER_SECOND = 30
|
|
12
|
+
____exports.ISAAC_FRAMES_PER_SECOND = 60
|
|
11
13
|
____exports.MAX_NUM_DOORS = 8
|
|
12
14
|
____exports.MAX_NUM_INPUTS = 4
|
|
13
15
|
____exports.MAX_PLAYER_POCKET_ITEM_SLOTS = 4
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
3
|
+
local ____exports = {}
|
|
4
|
+
local ____collectibleSet = require("collectibleSet")
|
|
5
|
+
local COLLECTIBLE_SET = ____collectibleSet.COLLECTIBLE_SET
|
|
6
|
+
function ____exports.getCollectibleSet(self)
|
|
7
|
+
return __TS__New(Set, COLLECTIBLE_SET)
|
|
8
|
+
end
|
|
9
|
+
return ____exports
|
|
@@ -7,6 +7,8 @@ export declare function changeCollectibleSubType(collectible: EntityPickup, newC
|
|
|
7
7
|
export declare function collectibleHasTag(collectibleType: CollectibleType | int, tag: ItemConfigTag): boolean;
|
|
8
8
|
export declare function getCollectibleInitCharges(collectibleType: CollectibleType | int): int;
|
|
9
9
|
export declare function getCollectibleMaxCharges(collectibleType: CollectibleType | int): int;
|
|
10
|
+
/** Returns a set containing every valid collectible type in the game, including modded items. */
|
|
11
|
+
export declare function getCollectibleSet(): Set<CollectibleType | int>;
|
|
10
12
|
export declare function getMaxCollectibleID(): int;
|
|
11
13
|
export declare function isQuestCollectible(collectibleType: CollectibleType | int): boolean;
|
|
12
14
|
export declare function setCollectibleBlind(pickup: EntityPickup): void;
|
|
@@ -1,6 +1,13 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
+
require("lualib_bundle");
|
|
2
3
|
local ____exports = {}
|
|
4
|
+
local ____util = require("functions.util")
|
|
5
|
+
local copySet = ____util.copySet
|
|
3
6
|
local COLLECTIBLE_SPRITE_LAYER
|
|
7
|
+
function ____exports.getMaxCollectibleID(self)
|
|
8
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
9
|
+
return itemConfig:GetCollectibles().Size - 1
|
|
10
|
+
end
|
|
4
11
|
function ____exports.setCollectibleSprite(self, pickup, pngPath)
|
|
5
12
|
if pickup.Variant ~= PickupVariant.PICKUP_COLLECTIBLE then
|
|
6
13
|
error(
|
|
@@ -13,6 +20,20 @@ function ____exports.setCollectibleSprite(self, pickup, pngPath)
|
|
|
13
20
|
end
|
|
14
21
|
COLLECTIBLE_SPRITE_LAYER = 1
|
|
15
22
|
local BLIND_ITEM_PNG_PATH = "gfx/items/collectibles/questionmark.png"
|
|
23
|
+
local COLLECTIBLE_SET = __TS__New(Set)
|
|
24
|
+
local function initSet(self)
|
|
25
|
+
local itemConfig = Isaac.GetItemConfig()
|
|
26
|
+
do
|
|
27
|
+
local collectibleType = 1
|
|
28
|
+
while collectibleType <= ____exports.getMaxCollectibleID(nil) do
|
|
29
|
+
local itemConfigItem = itemConfig:GetCollectible(collectibleType)
|
|
30
|
+
if itemConfigItem ~= nil then
|
|
31
|
+
COLLECTIBLE_SET:add(collectibleType)
|
|
32
|
+
end
|
|
33
|
+
collectibleType = collectibleType + 1
|
|
34
|
+
end
|
|
35
|
+
end
|
|
36
|
+
end
|
|
16
37
|
function ____exports.changeCollectibleSubType(self, collectible, newCollectibleType)
|
|
17
38
|
collectible.SubType = newCollectibleType
|
|
18
39
|
local itemConfig = Isaac.GetItemConfig()
|
|
@@ -48,9 +69,11 @@ function ____exports.getCollectibleMaxCharges(self, collectibleType)
|
|
|
48
69
|
end
|
|
49
70
|
return itemConfigItem.MaxCharges
|
|
50
71
|
end
|
|
51
|
-
function ____exports.
|
|
52
|
-
|
|
53
|
-
|
|
72
|
+
function ____exports.getCollectibleSet(self)
|
|
73
|
+
if COLLECTIBLE_SET.size == 0 then
|
|
74
|
+
initSet(nil)
|
|
75
|
+
end
|
|
76
|
+
return copySet(nil, COLLECTIBLE_SET)
|
|
54
77
|
end
|
|
55
78
|
function ____exports.isQuestCollectible(self, collectibleType)
|
|
56
79
|
return ____exports.collectibleHasTag(nil, collectibleType, 32768)
|
|
@@ -10,8 +10,8 @@ import PocketItemDescription from "../types/PocketItemDescription";
|
|
|
10
10
|
*
|
|
11
11
|
* This type is branded for extra type safety.
|
|
12
12
|
*/
|
|
13
|
-
export declare type PlayerIndex =
|
|
14
|
-
__playerIndexBrand:
|
|
13
|
+
export declare type PlayerIndex = int & {
|
|
14
|
+
__playerIndexBrand: unknown;
|
|
15
15
|
};
|
|
16
16
|
/** Iterates over all players and checks if any player is close enough to the specified position. */
|
|
17
17
|
export declare function anyPlayerCloserThan(position: Vector, distance: float): boolean;
|
|
@@ -81,9 +81,7 @@ export declare function getPlayersOfType(playerType: PlayerType): EntityPlayer[]
|
|
|
81
81
|
* relaunching the game.
|
|
82
82
|
*
|
|
83
83
|
* Instead, we use `EntityPlayer.GetCollectibleRNG()` with an arbitrary value of 1 (i.e. Sad Onion).
|
|
84
|
-
* This works even if the player does not have any Sad Onions.
|
|
85
|
-
* a string to avoid null element creation when saving the table as JSON (which is necessary when
|
|
86
|
-
* saving variables on run exit).
|
|
84
|
+
* This works even if the player does not have any Sad Onions.
|
|
87
85
|
*
|
|
88
86
|
* Finally, this index fails in the case of Tainted Lazarus, since the RNG will be the same for both
|
|
89
87
|
* Tainted Lazarus and Dead Tainted Lazarus. We revert to using the RNG of Inner Eye for this case.
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
2
|
require("lualib_bundle");
|
|
3
3
|
local ____exports = {}
|
|
4
|
-
local ____collectibleSet = require("collectibleSet")
|
|
5
|
-
local getCollectibleSet = ____collectibleSet.getCollectibleSet
|
|
6
4
|
local ____PocketItemType = require("types.PocketItemType")
|
|
7
5
|
local PocketItemType = ____PocketItemType.default
|
|
6
|
+
local ____collectibles = require("functions.collectibles")
|
|
7
|
+
local getCollectibleSet = ____collectibles.getCollectibleSet
|
|
8
8
|
local EXCLUDED_CHARACTERS
|
|
9
9
|
function ____exports.getPlayers(self, performExclusions)
|
|
10
10
|
if performExclusions == nil then
|
|
@@ -40,8 +40,7 @@ function ____exports.getPlayerIndex(self, player)
|
|
|
40
40
|
local collectibleToUse = ((character == PlayerType.PLAYER_LAZARUS2_B) and CollectibleType.COLLECTIBLE_INNER_EYE) or CollectibleType.COLLECTIBLE_SAD_ONION
|
|
41
41
|
local collectibleRNG = player:GetCollectibleRNG(collectibleToUse)
|
|
42
42
|
local seed = collectibleRNG:GetSeed()
|
|
43
|
-
|
|
44
|
-
return seedString
|
|
43
|
+
return seed
|
|
45
44
|
end
|
|
46
45
|
function ____exports.isChildPlayer(self, player)
|
|
47
46
|
return player.Parent ~= nil
|
|
@@ -5,6 +5,8 @@ local ____transformationMap = require("transformationMap")
|
|
|
5
5
|
local ITEM_TO_TRANSFORMATION_MAP = ____transformationMap.ITEM_TO_TRANSFORMATION_MAP
|
|
6
6
|
local TRANSFORMATIONS_NOT_TRACKED = ____transformationMap.TRANSFORMATIONS_NOT_TRACKED
|
|
7
7
|
local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMap.TRANSFORMATION_TO_ITEMS_MAP
|
|
8
|
+
local ____util = require("functions.util")
|
|
9
|
+
local copySet = ____util.copySet
|
|
8
10
|
function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
|
|
9
11
|
if TRANSFORMATIONS_NOT_TRACKED:has(playerForm) then
|
|
10
12
|
error(
|
|
@@ -27,6 +29,6 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
27
29
|
end
|
|
28
30
|
function ____exports.getTransformationsForItem(self, collectibleType)
|
|
29
31
|
local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
30
|
-
return ((transformations == nil) and __TS__New(Set)) or transformations
|
|
32
|
+
return ((transformations == nil) and __TS__New(Set)) or copySet(nil, transformations)
|
|
31
33
|
end
|
|
32
34
|
return ____exports
|
package/dist/functions/util.d.ts
CHANGED
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
+
/**
|
|
4
|
+
* Using a Set constructor to copy a Set does not seem to work properly, so this helper function is
|
|
5
|
+
* used instead.
|
|
6
|
+
*/
|
|
7
|
+
export declare function copySet<T>(oldSet: Set<T>): Set<T>;
|
|
3
8
|
/**
|
|
4
9
|
* Helper function to get type safety on a switch statement.
|
|
5
10
|
* Very useful to be future-safe against people adding values to a type or an enum.
|
package/dist/functions/util.lua
CHANGED
|
@@ -6,6 +6,15 @@ local VECTOR_BRAND = ____constants.VECTOR_BRAND
|
|
|
6
6
|
local ____math = require("functions.math")
|
|
7
7
|
local getAngleDifference = ____math.getAngleDifference
|
|
8
8
|
local HEX_STRING_LENGTH = 6
|
|
9
|
+
function ____exports.copySet(self, oldSet)
|
|
10
|
+
local newSet = __TS__New(Set)
|
|
11
|
+
for ____, value in __TS__Iterator(
|
|
12
|
+
oldSet:values()
|
|
13
|
+
) do
|
|
14
|
+
newSet:add(value)
|
|
15
|
+
end
|
|
16
|
+
return newSet
|
|
17
|
+
end
|
|
9
18
|
____exports.ensureAllCases = function(____, obj) return obj end
|
|
10
19
|
function ____exports.getEnumValues(self, transpiledEnum)
|
|
11
20
|
local enumValues = {}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export { forceNewLevelCallback, forceNewRoomCallback, } from "./callbacks/reorderedCallbacks";
|
|
2
|
-
export { CHARACTERS_WITH_NO_RED_HEARTS, DISTANCE_OF_GRID_TILE, DOOR_HITBOX_DISTANCE, FIRST_GLITCHED_COLLECTIBLE_TYPE, GENESIS_ROOM_VARIANT, GOLDEN_TRINKET_SHIFT, GRID_INDEX_CENTER_OF_1X1_ROOM, MAX_NUM_DOORS, MAX_NUM_INPUTS, MAX_PLAYER_POCKET_ITEM_SLOTS, MAX_PLAYER_SPEED_IN_UNITS, MAX_PLAYER_TRINKET_SLOTS, MAX_ROOM_INDEX, MAX_VANILLA_COLLECTIBLE_TYPE, SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES, } from "./constants";
|
|
2
|
+
export { CHARACTERS_WITH_NO_RED_HEARTS, DISTANCE_OF_GRID_TILE, DOOR_HITBOX_DISTANCE, FIRST_GLITCHED_COLLECTIBLE_TYPE, GAME_FRAMES_PER_SECOND, GENESIS_ROOM_VARIANT, GOLDEN_TRINKET_SHIFT, GRID_INDEX_CENTER_OF_1X1_ROOM, ISAAC_FRAMES_PER_SECOND, MAX_NUM_DOORS, MAX_NUM_INPUTS, MAX_PLAYER_POCKET_ITEM_SLOTS, MAX_PLAYER_SPEED_IN_UNITS, MAX_PLAYER_TRINKET_SLOTS, MAX_ROOM_INDEX, MAX_VANILLA_COLLECTIBLE_TYPE, SINGLE_USE_ACTIVE_COLLECTIBLE_TYPES, } from "./constants";
|
|
3
3
|
export { disableAllInputs, disableAllInputsExceptFor, disableMovementInputs, disableShootingInputs, enableAllInputs, enableAllInputsExceptFor, } from "./features/disableInputs";
|
|
4
4
|
export { forgottenSwitch } from "./features/forgottenSwitch";
|
|
5
5
|
export { runInNFrames, runNextFrame } from "./features/runInNFrames";
|
package/dist/index.lua
CHANGED
|
@@ -13,9 +13,11 @@ do
|
|
|
13
13
|
local DISTANCE_OF_GRID_TILE = ____constants.DISTANCE_OF_GRID_TILE
|
|
14
14
|
local DOOR_HITBOX_DISTANCE = ____constants.DOOR_HITBOX_DISTANCE
|
|
15
15
|
local FIRST_GLITCHED_COLLECTIBLE_TYPE = ____constants.FIRST_GLITCHED_COLLECTIBLE_TYPE
|
|
16
|
+
local GAME_FRAMES_PER_SECOND = ____constants.GAME_FRAMES_PER_SECOND
|
|
16
17
|
local GENESIS_ROOM_VARIANT = ____constants.GENESIS_ROOM_VARIANT
|
|
17
18
|
local GOLDEN_TRINKET_SHIFT = ____constants.GOLDEN_TRINKET_SHIFT
|
|
18
19
|
local GRID_INDEX_CENTER_OF_1X1_ROOM = ____constants.GRID_INDEX_CENTER_OF_1X1_ROOM
|
|
20
|
+
local ISAAC_FRAMES_PER_SECOND = ____constants.ISAAC_FRAMES_PER_SECOND
|
|
19
21
|
local MAX_NUM_DOORS = ____constants.MAX_NUM_DOORS
|
|
20
22
|
local MAX_NUM_INPUTS = ____constants.MAX_NUM_INPUTS
|
|
21
23
|
local MAX_PLAYER_POCKET_ITEM_SLOTS = ____constants.MAX_PLAYER_POCKET_ITEM_SLOTS
|
|
@@ -28,9 +30,11 @@ do
|
|
|
28
30
|
____exports.DISTANCE_OF_GRID_TILE = DISTANCE_OF_GRID_TILE
|
|
29
31
|
____exports.DOOR_HITBOX_DISTANCE = DOOR_HITBOX_DISTANCE
|
|
30
32
|
____exports.FIRST_GLITCHED_COLLECTIBLE_TYPE = FIRST_GLITCHED_COLLECTIBLE_TYPE
|
|
33
|
+
____exports.GAME_FRAMES_PER_SECOND = GAME_FRAMES_PER_SECOND
|
|
31
34
|
____exports.GENESIS_ROOM_VARIANT = GENESIS_ROOM_VARIANT
|
|
32
35
|
____exports.GOLDEN_TRINKET_SHIFT = GOLDEN_TRINKET_SHIFT
|
|
33
36
|
____exports.GRID_INDEX_CENTER_OF_1X1_ROOM = GRID_INDEX_CENTER_OF_1X1_ROOM
|
|
37
|
+
____exports.ISAAC_FRAMES_PER_SECOND = ISAAC_FRAMES_PER_SECOND
|
|
34
38
|
____exports.MAX_NUM_DOORS = MAX_NUM_DOORS
|
|
35
39
|
____exports.MAX_NUM_INPUTS = MAX_NUM_INPUTS
|
|
36
40
|
____exports.MAX_PLAYER_POCKET_ITEM_SLOTS = MAX_PLAYER_POCKET_ITEM_SLOTS
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "isaacscript-common",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.335",
|
|
4
4
|
"description": "Helper functions for IsaacScript mods",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"isaac",
|
|
@@ -27,7 +27,6 @@
|
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"isaac-typescript-definitions": "^1.0.190",
|
|
29
29
|
"isaacscript-lint": "^1.0.61",
|
|
30
|
-
"ts-prune": "^0.10.1",
|
|
31
30
|
"typedoc": "^0.22.5",
|
|
32
31
|
"typescript": "4.4.3",
|
|
33
32
|
"typescript-to-lua": "^1.0.1"
|