isaacscript-common 1.0.548 → 1.0.552
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/functions/array.d.ts +2 -0
- package/dist/functions/array.lua +19 -0
- package/dist/functions/rooms.d.ts +12 -0
- package/dist/functions/rooms.lua +18 -17
- package/dist/functions/seeds.d.ts +1 -1
- package/dist/functions/stage.d.ts +2 -2
- package/dist/functions/transformations.d.ts +1 -1
- package/dist/functions/transformations.lua +4 -7
- package/dist/maps/transformationMaps.d.ts +2 -2
- package/dist/maps/transformationMaps.lua +4 -7
- package/package.json +1 -1
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/// <reference types="typescript-to-lua/language-extensions" />
|
|
3
|
+
export declare function arrayCombine<T>(array1: T[], array2: T[]): T[];
|
|
4
|
+
export declare function arrayCopy<T>(array: T[]): T[];
|
|
3
5
|
export declare function arrayEmpty<T>(array: T[]): void;
|
|
4
6
|
/** Helper function for determining if two arrays contain the exact same elements. */
|
|
5
7
|
export declare function arrayEquals<T>(array1: T[], array2: T[]): boolean;
|
package/dist/functions/array.lua
CHANGED
|
@@ -27,6 +27,25 @@ function ____exports.getRandomArrayIndex(self, array, seed)
|
|
|
27
27
|
local randomIndex = getRandomInt(nil, 0, #array - 1, seed)
|
|
28
28
|
return randomIndex
|
|
29
29
|
end
|
|
30
|
+
function ____exports.arrayCombine(self, array1, array2)
|
|
31
|
+
return {
|
|
32
|
+
table.unpack(
|
|
33
|
+
__TS__ArrayConcat(
|
|
34
|
+
{
|
|
35
|
+
table.unpack(array1)
|
|
36
|
+
},
|
|
37
|
+
{
|
|
38
|
+
table.unpack(array2)
|
|
39
|
+
}
|
|
40
|
+
)
|
|
41
|
+
)
|
|
42
|
+
}
|
|
43
|
+
end
|
|
44
|
+
function ____exports.arrayCopy(self, array)
|
|
45
|
+
return {
|
|
46
|
+
table.unpack(array)
|
|
47
|
+
}
|
|
48
|
+
end
|
|
30
49
|
function ____exports.arrayEmpty(self, array)
|
|
31
50
|
__TS__ArraySplice(array, 0, #array)
|
|
32
51
|
end
|
|
@@ -7,6 +7,8 @@
|
|
|
7
7
|
export declare function changeRoom(roomGridIndex: int): void;
|
|
8
8
|
export declare function getAllRoomGridIndexes(): int[];
|
|
9
9
|
export declare function getCurrentDimension(): Dimension;
|
|
10
|
+
/** An alias to the `Level.GetCurrentRoomDesc()` method. */
|
|
11
|
+
export declare function getCurrentRoomDescReadOnly(): RoomDescriptorReadOnly;
|
|
10
12
|
export declare function getRoomData(): RoomConfig | undefined;
|
|
11
13
|
/**
|
|
12
14
|
* Helper function to get the type for the room from the XML/STB data. The room data type will
|
|
@@ -126,6 +128,11 @@ export declare function inCrawlspace(): boolean;
|
|
|
126
128
|
* with the Death Certificate area.
|
|
127
129
|
*/
|
|
128
130
|
export declare function inDeathCertificateArea(): boolean;
|
|
131
|
+
/**
|
|
132
|
+
* Helper function to detect if the current room is a Treasure Room created when entering with a
|
|
133
|
+
* Devil's Crown trinket. Under the hood, this checks for the `RoomDescriptorFlag.DEVIL_TREASURE`
|
|
134
|
+
* flag.
|
|
135
|
+
*/
|
|
129
136
|
export declare function inDevilsCrownTreasureRoom(): boolean;
|
|
130
137
|
export declare function inDimension(dimension: Dimension): boolean;
|
|
131
138
|
/** Helper function to determine if the current room shape is one of the four L room shapes. */
|
|
@@ -152,6 +159,11 @@ export declare function inStartingRoom(): boolean;
|
|
|
152
159
|
* default.
|
|
153
160
|
*/
|
|
154
161
|
export declare function isAllRoomsClear(onlyCheckRoomTypes?: RoomType[]): boolean;
|
|
162
|
+
/**
|
|
163
|
+
* Helper function to detect if the current room was created by the Red Key item. Under the hood,
|
|
164
|
+
* this checks for the `RoomDescriptorFlag.FLAG_RED_ROOM` flag.
|
|
165
|
+
*/
|
|
166
|
+
export declare function isRedKeyRoom(): boolean;
|
|
155
167
|
/**
|
|
156
168
|
* Helper function to determine whether or not the current room is part of the floor layout. For
|
|
157
169
|
* example, Devil Rooms and the Mega Satan room are not considered to be inside the map.
|
package/dist/functions/rooms.lua
CHANGED
|
@@ -17,6 +17,11 @@ local setEntityPositions = ____entity.setEntityPositions
|
|
|
17
17
|
local setEntityVelocities = ____entity.setEntityVelocities
|
|
18
18
|
local ____flag = require("functions.flag")
|
|
19
19
|
local hasFlag = ____flag.hasFlag
|
|
20
|
+
function ____exports.getCurrentRoomDescReadOnly(self)
|
|
21
|
+
local game = Game()
|
|
22
|
+
local level = game:GetLevel()
|
|
23
|
+
return level:GetCurrentRoomDesc()
|
|
24
|
+
end
|
|
20
25
|
function ____exports.getRoomData(self)
|
|
21
26
|
local game = Game()
|
|
22
27
|
local level = game:GetLevel()
|
|
@@ -25,9 +30,7 @@ function ____exports.getRoomData(self)
|
|
|
25
30
|
return roomDesc.Data
|
|
26
31
|
end
|
|
27
32
|
function ____exports.getRoomSafeGridIndex(self)
|
|
28
|
-
local
|
|
29
|
-
local level = game:GetLevel()
|
|
30
|
-
local roomDesc = level:GetCurrentRoomDesc()
|
|
33
|
+
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
31
34
|
return roomDesc.SafeGridIndex
|
|
32
35
|
end
|
|
33
36
|
function ____exports.getRoomStageID(self)
|
|
@@ -130,9 +133,7 @@ function ____exports.getRoomDataType(self)
|
|
|
130
133
|
return roomData.Type
|
|
131
134
|
end
|
|
132
135
|
function ____exports.getRoomListIndex(self)
|
|
133
|
-
local
|
|
134
|
-
local level = game:GetLevel()
|
|
135
|
-
local roomDesc = level:GetCurrentRoomDesc()
|
|
136
|
+
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
136
137
|
return roomDesc.ListIndex
|
|
137
138
|
end
|
|
138
139
|
function ____exports.getRoomGridIndexesForType(self, roomType)
|
|
@@ -169,9 +170,7 @@ function ____exports.getRoomVariant(self)
|
|
|
169
170
|
return roomData.Variant
|
|
170
171
|
end
|
|
171
172
|
function ____exports.getRoomVisitedCount(self)
|
|
172
|
-
local
|
|
173
|
-
local level = game:GetLevel()
|
|
174
|
-
local roomDesc = level:GetCurrentRoomDesc()
|
|
173
|
+
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
175
174
|
return roomDesc.VisitedCount
|
|
176
175
|
end
|
|
177
176
|
function ____exports.gridToPos(self, x, y)
|
|
@@ -214,9 +213,7 @@ function ____exports.inCrawlspace(self)
|
|
|
214
213
|
return (roomSafeGridIndex == GridRooms.ROOM_DUNGEON_IDX) and (roomSubType ~= 4)
|
|
215
214
|
end
|
|
216
215
|
function ____exports.inDevilsCrownTreasureRoom(self)
|
|
217
|
-
local
|
|
218
|
-
local level = game:GetLevel()
|
|
219
|
-
local roomDesc = level:GetCurrentRoomDesc()
|
|
216
|
+
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
220
217
|
return hasFlag(nil, roomDesc.Flags, 2048)
|
|
221
218
|
end
|
|
222
219
|
function ____exports.inDimension(self, dimension)
|
|
@@ -259,20 +256,24 @@ function ____exports.isAllRoomsClear(self, onlyCheckRoomTypes)
|
|
|
259
256
|
do
|
|
260
257
|
local roomData = roomDesc.Data
|
|
261
258
|
if roomData == nil then
|
|
262
|
-
goto
|
|
259
|
+
goto __continue49
|
|
263
260
|
end
|
|
264
261
|
local roomType = roomData.Type
|
|
265
262
|
if (roomTypeWhitelist ~= nil) and (not roomTypeWhitelist:has(roomType)) then
|
|
266
|
-
goto
|
|
263
|
+
goto __continue49
|
|
267
264
|
end
|
|
268
265
|
if not roomDesc.Clear then
|
|
269
266
|
return false
|
|
270
267
|
end
|
|
271
268
|
end
|
|
272
|
-
::
|
|
269
|
+
::__continue49::
|
|
273
270
|
end
|
|
274
271
|
return true
|
|
275
272
|
end
|
|
273
|
+
function ____exports.isRedKeyRoom(self)
|
|
274
|
+
local roomDesc = ____exports.getCurrentRoomDescReadOnly(nil)
|
|
275
|
+
return hasFlag(nil, roomDesc.Flags, 1024)
|
|
276
|
+
end
|
|
276
277
|
function ____exports.isRoomInsideMap(self)
|
|
277
278
|
local roomSafeGridIndex = ____exports.getRoomSafeGridIndex(nil)
|
|
278
279
|
return roomSafeGridIndex >= 0
|
|
@@ -301,14 +302,14 @@ function ____exports.setRoomCleared(self)
|
|
|
301
302
|
) do
|
|
302
303
|
do
|
|
303
304
|
if isHiddenSecretRoomDoor(nil, door) then
|
|
304
|
-
goto
|
|
305
|
+
goto __continue58
|
|
305
306
|
end
|
|
306
307
|
door.State = DoorState.STATE_OPEN
|
|
307
308
|
local sprite = door:GetSprite()
|
|
308
309
|
sprite:Play("Opened", true)
|
|
309
310
|
door.ExtraVisible = false
|
|
310
311
|
end
|
|
311
|
-
::
|
|
312
|
+
::__continue58::
|
|
312
313
|
end
|
|
313
314
|
sfx:Stop(SoundEffect.SOUND_DOOR_HEAVY_OPEN)
|
|
314
315
|
game:ShakeScreen(0)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
/**
|
|
1
|
+
/** Alias for the `Seeds.GetStartSeedString` method. */
|
|
2
2
|
export declare function getStartSeedString(): string;
|
|
@@ -5,9 +5,9 @@
|
|
|
5
5
|
* consider Downpour 2 to have a stage of 3.
|
|
6
6
|
*/
|
|
7
7
|
export declare function getEffectiveStage(): int;
|
|
8
|
-
/**
|
|
8
|
+
/** Alias for the `Level.GetStage` method. */
|
|
9
9
|
export declare function getStage(): LevelStage;
|
|
10
|
-
/**
|
|
10
|
+
/** Alias for the `Level.GetStageType` method. */
|
|
11
11
|
export declare function getStageType(): StageType;
|
|
12
12
|
/** Helper function to directly warp to a specific stage using the "stage" console command. */
|
|
13
13
|
export declare function goToStage(stage: LevelStage, stageType: StageType): void;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
/** Returns the number of items that a player has towards a particular transformation. */
|
|
3
3
|
export declare function getPlayerNumTransformationCollectibles(player: EntityPlayer, playerForm: PlayerForm): int;
|
|
4
|
-
export declare function getTransformationsForItem(collectibleType: CollectibleType | int):
|
|
4
|
+
export declare function getTransformationsForItem(collectibleType: CollectibleType | int): PlayerForm[];
|
|
5
5
|
/**
|
|
6
6
|
* Helper function to get a transformation name from a PlayerForm enum.
|
|
7
7
|
*
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
--[[ Generated with https://github.com/TypeScriptToLua/TypeScriptToLua ]]
|
|
2
|
-
require("lualib_bundle");
|
|
3
2
|
local ____exports = {}
|
|
4
3
|
local ____transformationMaps = require("maps.transformationMaps")
|
|
5
4
|
local ITEM_TO_TRANSFORMATION_MAP = ____transformationMaps.ITEM_TO_TRANSFORMATION_MAP
|
|
@@ -7,8 +6,6 @@ local TRANSFORMATIONS_NOT_BASED_ON_ITEMS = ____transformationMaps.TRANSFORMATION
|
|
|
7
6
|
local TRANSFORMATION_TO_ITEMS_MAP = ____transformationMaps.TRANSFORMATION_TO_ITEMS_MAP
|
|
8
7
|
local ____transformationNameMap = require("maps.transformationNameMap")
|
|
9
8
|
local TRANSFORMATION_NAME_MAP = ____transformationNameMap.TRANSFORMATION_NAME_MAP
|
|
10
|
-
local ____util = require("functions.util")
|
|
11
|
-
local copySet = ____util.copySet
|
|
12
9
|
function ____exports.getPlayerNumTransformationCollectibles(self, player, playerForm)
|
|
13
10
|
if TRANSFORMATIONS_NOT_BASED_ON_ITEMS:has(playerForm) then
|
|
14
11
|
error(
|
|
@@ -22,16 +19,16 @@ function ____exports.getPlayerNumTransformationCollectibles(self, player, player
|
|
|
22
19
|
)
|
|
23
20
|
end
|
|
24
21
|
local numCollectibles = 0
|
|
25
|
-
for ____, collectibleType in
|
|
26
|
-
itemsForTransformation:values()
|
|
27
|
-
) do
|
|
22
|
+
for ____, collectibleType in ipairs(itemsForTransformation) do
|
|
28
23
|
numCollectibles = numCollectibles + player:GetCollectibleNum(collectibleType)
|
|
29
24
|
end
|
|
30
25
|
return numCollectibles
|
|
31
26
|
end
|
|
32
27
|
function ____exports.getTransformationsForItem(self, collectibleType)
|
|
33
28
|
local transformations = ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
34
|
-
return ((transformations == nil) and
|
|
29
|
+
return ((transformations == nil) and ({})) or ({
|
|
30
|
+
table.unpack(transformations)
|
|
31
|
+
})
|
|
35
32
|
end
|
|
36
33
|
function ____exports.getTransformationName(self, transformation)
|
|
37
34
|
local defaultName = "Unknown"
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/// <reference types="isaac-typescript-definitions" />
|
|
2
2
|
export declare const TRANSFORMATION_TO_TAG_MAP: Map<PlayerForm, ItemConfigTag>;
|
|
3
3
|
export declare const TRANSFORMATIONS_NOT_BASED_ON_ITEMS: Set<PlayerForm>;
|
|
4
|
-
export declare const TRANSFORMATION_TO_ITEMS_MAP: Map<PlayerForm,
|
|
5
|
-
export declare const ITEM_TO_TRANSFORMATION_MAP: Map<number,
|
|
4
|
+
export declare const TRANSFORMATION_TO_ITEMS_MAP: Map<PlayerForm, number[]>;
|
|
5
|
+
export declare const ITEM_TO_TRANSFORMATION_MAP: Map<number, PlayerForm[]>;
|
|
@@ -9,10 +9,7 @@ function initMaps(self)
|
|
|
9
9
|
for ____, playerForm in __TS__Iterator(
|
|
10
10
|
____exports.TRANSFORMATION_TO_TAG_MAP:keys()
|
|
11
11
|
) do
|
|
12
|
-
____exports.TRANSFORMATION_TO_ITEMS_MAP:set(
|
|
13
|
-
playerForm,
|
|
14
|
-
__TS__New(Set)
|
|
15
|
-
)
|
|
12
|
+
____exports.TRANSFORMATION_TO_ITEMS_MAP:set(playerForm, {})
|
|
16
13
|
end
|
|
17
14
|
do
|
|
18
15
|
local collectibleType = 1
|
|
@@ -34,13 +31,13 @@ function initMaps(self)
|
|
|
34
31
|
"Failed to get the items for transformation: " .. tostring(playerForm)
|
|
35
32
|
)
|
|
36
33
|
end
|
|
37
|
-
items
|
|
34
|
+
__TS__ArrayPush(items, collectibleType)
|
|
38
35
|
local transformations = ____exports.ITEM_TO_TRANSFORMATION_MAP:get(collectibleType)
|
|
39
36
|
if transformations == nil then
|
|
40
|
-
transformations =
|
|
37
|
+
transformations = {}
|
|
41
38
|
____exports.ITEM_TO_TRANSFORMATION_MAP:set(collectibleType, transformations)
|
|
42
39
|
end
|
|
43
|
-
transformations
|
|
40
|
+
__TS__ArrayPush(transformations, playerForm)
|
|
44
41
|
end
|
|
45
42
|
::__continue5::
|
|
46
43
|
end
|